From ed59a3d3700851ac2ae32c502c7058905cebfba6 Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 18 Aug 2016 23:53:46 +0000 Subject: [PATCH] Avoid macro redefinition and WinPcap incompatibility now that Npcap defines PCAP_NETMASK_UNKNOWN --- nmap_winconfig.h | 3 --- nsock/include/nsock_winconfig.h | 2 -- nsock/src/nsock_pcap.h | 6 ++++++ tcpip.h | 6 ++++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/nmap_winconfig.h b/nmap_winconfig.h index 50223b263..05d2ecbfe 100644 --- a/nmap_winconfig.h +++ b/nmap_winconfig.h @@ -142,8 +142,5 @@ #define DNET_INCLUDED 1 #define PCRE_INCLUDED 1 -/* WinPCAP doesn't have this */ -#define PCAP_NETMASK_UNKNOWN 0 - #endif /* NMAP_WINCONFIG_H */ diff --git a/nsock/include/nsock_winconfig.h b/nsock/include/nsock_winconfig.h index aa9162e12..7f1cfcd07 100644 --- a/nsock/include/nsock_winconfig.h +++ b/nsock/include/nsock_winconfig.h @@ -95,8 +95,6 @@ #ifndef DISABLE_NSOCK_PCAP #define HAVE_PCAP 1 -/* WinPCAP doesn't have this */ -#define PCAP_NETMASK_UNKNOWN 0 #endif /* Need this for _WIN32_WINNT below */ diff --git a/nsock/src/nsock_pcap.h b/nsock/src/nsock_pcap.h index 269b04ebb..3edcfaebd 100644 --- a/nsock/src/nsock_pcap.h +++ b/nsock/src/nsock_pcap.h @@ -66,6 +66,12 @@ #include #include +#ifdef WIN32 +/* WinPCAP doesn't have this, but Npcap does. + * Using 0 is safe for both, but change this if we decide to drop WinPcap */ +#undef PCAP_NETMASK_UNKNOWN +#define PCAP_NETMASK_UNKNOWN 0 +#endif /* * There are three possible ways to read packets from pcap descriptor: diff --git a/tcpip.h b/tcpip.h index 5f7329a76..19d78859e 100644 --- a/tcpip.h +++ b/tcpip.h @@ -131,6 +131,12 @@ #include "nbase.h" #include +#ifdef WIN32 +/* WinPCAP doesn't have this, but Npcap does. + * Using 0 is safe for both, but change this if we decide to drop WinPcap */ +#undef PCAP_NETMASK_UNKNOWN +#define PCAP_NETMASK_UNKNOWN 0 +#endif class Target;