From 721e2f42c5c883dd653081949bff070652490df8 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Wed, 19 Feb 2020 01:39:13 -0800 Subject: [PATCH] ETHER: Report Windows Npcap as unsupported in the Ethernet version string Current versions of Npcap can talk directly to the host system's network stack. This defect was just discovered. Fortunately, WinPcap 4.1.3 works as needed and is still functional on Windows 10. As discussed in nmap/nmap#1929 and nmap/nmap#1343 --- sim_ether.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sim_ether.c b/sim_ether.c index e5a5bc8b..5231793b 100644 --- a/sim_ether.c +++ b/sim_ether.c @@ -1077,7 +1077,7 @@ static const char* lib_name = static char no_pcap[PCAP_ERRBUF_SIZE] = #if defined(_WIN32) || defined(__CYGWIN__) - "wpcap.dll failed to load, install Npcap or WinPcap 4.x to use pcap networking"; + "wpcap.dll failed to load, install Npcap or WinPcap 4.1.3 to use pcap networking"; #elif defined(__APPLE__) "/usr/lib/libpcap.A.dylib failed to load, install libpcap to use pcap networking"; #else @@ -2474,7 +2474,15 @@ return SCPE_OK; const char *eth_version (void) { #if defined(HAVE_PCAP_NETWORK) -return pcap_lib_version(); +static char version[256]; + +if (!version[0]) { + if (memcmp(pcap_lib_version(), "Npcap", 5)) + strlcpy(version, pcap_lib_version(), sizeof(version)); + else + snprintf(version, sizeof(version), "Unsupported - %s", pcap_lib_version()); + } +return version; #else return NULL; #endif