From 07c274ac9783752d2aa2ee3497aceccf38fb51e9 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 6 Apr 2020 10:36:31 -0700 Subject: [PATCH] ETHER: Restore support fir Windows Npcap as Ethernet packet API Version of Npcap 0.9990 restores full WinPcap functionality As discussed in nmap/nmap#1929 and nmap/nmap#1343 --- sim_ether.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sim_ether.c b/sim_ether.c index 58adb234..f85fc072 100644 --- a/sim_ether.c +++ b/sim_ether.c @@ -2478,10 +2478,17 @@ const char *eth_version (void) 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()); + strlcpy(version, pcap_lib_version(), sizeof(version)); + if (memcmp(pcap_lib_version(), "Npcap", 5) == 0) { + char maj_min[CBUFSIZE]; + char *c = version; + + while (*c && !isdigit (*c)) + ++c; + get_glyph (c, maj_min, ','); + if (strcmp ("0.9990", maj_min) < 0) + snprintf(version, sizeof(version), "Unsupported - %s", pcap_lib_version()); + } } return version; #else