Skip to content

Commit

Permalink
Netkvm: replace tshark.exe with WinDump.exe
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
heywji committed Jul 5, 2024
1 parent c68c2f5 commit a64cc14
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
13 changes: 7 additions & 6 deletions qemu/tests/cfg/enable_scatter_windows.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
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.exe"
check_installed_cmd = 'dir "${installed_path}" | findstr /I "${WinDump_name}"'
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"
installation_cmd = "xcopy WIN_UTILS:\${WinDump_name} c:\ /y && xcopy WIN_UTILS:\${wireshark_name} c:\ /y && c:\${wireshark_name} /S"

autoit_name = "AutoIt3_%PROCESSOR_ARCHITECTURE%.exe"
install_winpcap_cmd = "WIN_UTILS:\${autoit_name} WIN_UTILS:\install_winpcap.au3"
Expand All @@ -27,6 +28,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.exe /f"
parse_log_temp = '"C:\Program Files\Wireshark\tshark.exe" -2 -r c:\temp.pcap -R "%s"'
21 changes: 11 additions & 10 deletions qemu/tests/enable_scatter_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ 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)

if status:
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:
Expand All @@ -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"
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -174,12 +175,12 @@ def _get_driver_version(session):
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:
if "WinDump" 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,
installation_cmd = params.get("installation_cmd")
installation_cmd = utils_misc.set_winutils_letter(
session, installation_cmd)
status, output = session.cmd_status_output(installation_cmd,
timeout=timeout)
if status:
test.error("Failed to install wireshark, status=%s, output=%s"
Expand Down

0 comments on commit a64cc14

Please sign in to comment.