From 857bfcda9a297bf91bcc6b963010fe0c4187945a Mon Sep 17 00:00:00 2001 From: wji Date: Tue, 2 Jul 2024 12:06:03 +0800 Subject: [PATCH] Netkvm: replace tshark.exe with WinDump.exe Replace tshark.exe with WinDump.exe for capturing network traffic. This resolves the issue where enabling netkvm driver TxLSO results in no packet length >= 1514 after file transfer, identified as a Wireshark problem. Signed-off-by: wji --- qemu/tests/cfg/enable_scatter_windows.cfg | 15 ++++++---- qemu/tests/enable_scatter_windows.py | 36 ++++++++++++++--------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/qemu/tests/cfg/enable_scatter_windows.cfg b/qemu/tests/cfg/enable_scatter_windows.cfg index d14236bde8..8f63c7f608 100644 --- a/qemu/tests/cfg/enable_scatter_windows.cfg +++ b/qemu/tests/cfg/enable_scatter_windows.cfg @@ -10,13 +10,16 @@ driver_verifier = netkvm Win2016, Win2019, Win8..1, Win2012..r2: driver_verifier += " ndis" - installed_path = "C:\Program Files\Wireshark\tshark.exe" - check_installed_cmd = 'dir "${installed_path}"|findstr /I tshark.exe' + WinDump_name = "WinDump.exe" + installed_path = "C:\${WinDump_name}" + check_WinDump_installed_cmd = 'dir "${WinDump_name}" | findstr /I "${installed_path}"' x86_64: wireshark_name = "Wireshark-win64-1.10.1.exe" i386, i686: wireshark_name = "Wireshark-win32-1.10.1.exe" - install_wireshark_cmd = "xcopy WIN_UTILS:\${wireshark_name} c:\ /y && c:\${wireshark_name} /S" + Windump_installation_cmd = "xcopy WIN_UTILS:\${WinDump_name} c:\ /y" + Wireshark_installation_cmd = "xcopy WIN_UTILS:\${wireshark_name} c:\ /y && c:\${wireshark_name} /S" + check_Wireshark_installed_cmd = 'dir "C:\Program Files\Wireshark" | findstr /I "tshark.exe"' autoit_name = "AutoIt3_%PROCESSOR_ARCHITECTURE%.exe" install_winpcap_cmd = "WIN_UTILS:\${autoit_name} WIN_UTILS:\install_winpcap.au3" @@ -27,6 +30,6 @@ query_version_cmd += "where (DeviceName like 'Red Hat VirtIO Ethernet Adapter') " query_version_cmd += "get DriverVersion /format:list" - run_wireshark_temp = 'start "" "${installed_path}" -n -w c:\temp.pcapng tcp and dst %s and src %s' - stop_wireshark_cmd = "taskkill /im tshark.exe /f" - parse_log_temp = '"${installed_path}" -2 -r c:\temp.pcapng -R "%s"' + run_windump_temp = 'start "" "${installed_path}" -n -w c:\temp.pcap tcp and dst %s and src %s' + stop_windump_cmd = 'taskkill /im "WinDump_name" /f' + parse_log_temp = '"C:\Program Files\Wireshark\tshark.exe" -2 -r c:\temp.pcap -R "%s"' diff --git a/qemu/tests/enable_scatter_windows.py b/qemu/tests/enable_scatter_windows.py index 2027a717cf..7fea3156b9 100644 --- a/qemu/tests/enable_scatter_windows.py +++ b/qemu/tests/enable_scatter_windows.py @@ -49,7 +49,7 @@ def _start_wireshark_session(): session_serial = vm.wait_for_serial_login(timeout=timeout) guest_ip = vm.get_address() try: - run_wireshark_cmd = run_wireshark_temp % (host_ip, guest_ip) + run_wireshark_cmd = run_windump_temp % (host_ip, guest_ip) status, output = session_serial.cmd_status_output(run_wireshark_cmd, timeout=timeout) @@ -57,7 +57,7 @@ def _start_wireshark_session(): test.error("Failed to start wireshark session, " "status=%s, output=%s" % (status, output)) is_started = utils_misc.wait_for( - lambda: not _is_process_finished(session_serial, "tshark.exe"), 20, 5, 1) + lambda: not _is_process_finished(session_serial, "WinDump.exe"), 20, 5, 1) if not is_started: test.error("Timeout when wait for wireshark start") finally: @@ -68,7 +68,7 @@ def _stop_wireshark_session(): Stop the running wireshark session """ error_context.context("Stop wireshark", test.log.info) - status, output = session.cmd_status_output(stop_wireshark_cmd, + status, output = session.cmd_status_output(stop_windump_cmd, timeout=timeout) if status: test.error("Failed to stop wireshark: status=%s, output=%s" @@ -102,7 +102,7 @@ def _get_traffic_log(packet_filter): error_context.context("Start file transfer", test.log.info) utils_test.run_file_transfer(test, params, env) time.sleep(30) - _stop_wireshark_session() +# _stop_wireshark_session() return _parse_log_file(packet_filter) def _set_driver_param(index): @@ -128,9 +128,10 @@ def _get_driver_version(session): timeout = params.get("timeout", 360) driver_verifier = params["driver_verifier"] + WinDump_name = params.get("WinDump_name") wireshark_name = params.get("wireshark_name") - run_wireshark_temp = params.get("run_wireshark_temp") - stop_wireshark_cmd = params.get("stop_wireshark_cmd") + run_windump_temp = params.get("run_windump_temp") + stop_windump_cmd = params.get("stop_windump_cmd") check_proc_temp = params.get("check_proc_temp") parse_log_temp = params.get("parse_log_temp") param_names = params.get("param_names").split() @@ -171,15 +172,22 @@ def _get_driver_version(session): utils_misc.wait_for( lambda: _is_process_finished(session, autoit_name), timeout, 20, 3) - error_context.context("Check if wireshark is installed", test.log.info) - check_installed_cmd = params.get("check_installed_cmd") - check_result = session.cmd_output(check_installed_cmd) - if "tshark" not in check_result: + error_context.context("Check if Windump is installed", test.log.info) + Windump_installation_cmd = params.get("Windump_installation_cmd") + status, output = session.cmd_status_output(Windump_installation_cmd, + timeout=timeout) + if status: + test.error("Failed to install Windump, status=%s, output=%s" + % (status, output)) + error_context.context("Check if Windump is installed", test.log.info) + check_WinDump_installed_cmd = params.get("check_WinDump_installed_cmd") + check_result = session.cmd_output(check_WinDump_installed_cmd) + if WinDump_name not in check_result: error_context.context("Install wireshark", test.log.info) - install_wireshark_cmd = params.get("install_wireshark_cmd") - install_wireshark_cmd = utils_misc.set_winutils_letter( - session, install_wireshark_cmd) - status, output = session.cmd_status_output(install_wireshark_cmd, + Wireshark_installation_cmd = params.get("Windump_installation_cmd") + Wireshark_installation_cmd = utils_misc.set_winutils_letter( + session, Windump_installation_cmd) + status, output = session.cmd_status_output(Wireshark_installation_cmd, timeout=timeout) if status: test.error("Failed to install wireshark, status=%s, output=%s"