diff --git a/capture/capture-pcap-util-unix.c b/capture/capture-pcap-util-unix.c index ecb1d22db9..5e4bdaab67 100644 --- a/capture/capture-pcap-util-unix.c +++ b/capture/capture-pcap-util-unix.c @@ -18,7 +18,7 @@ #ifdef HAVE_LIBPCAP -#include "wspcap.h" +#include #ifdef HAVE_LIBCAP # include diff --git a/capture/capture-pcap-util.h b/capture/capture-pcap-util.h index c6cbb87f17..94640a8ee6 100644 --- a/capture/capture-pcap-util.h +++ b/capture/capture-pcap-util.h @@ -16,7 +16,7 @@ #ifdef HAVE_LIBPCAP -#include "wspcap.h" +#include #include "capture_opts.h" diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in index 623de76cd5..bd4c64e004 100644 --- a/cmakeconfig.h.in +++ b/cmakeconfig.h.in @@ -346,6 +346,55 @@ #define PCRE2_CODE_UNIT_WIDTH 8 #endif +/* + * If HAVE_PCAP_REMOTE is defined, it forces the WinPcap header files to + * define things required for remote capture, by defining HAVE_REMOTE. + * + * With all versions of the WinPcap SDK, if: + * + * 1) you are building with any current WinPcap SDK; + * 2) you do not define HAVE_REMOTE before including pcap.h (or + * pcap/pcap.h); + * 3) you define a struct pcap_stat and pass it to a call to + * pcap_stats(); + * 4) the system you're running on has WinPcap, rather than Npcap, + * installed; + * + * whatever is in memory after the struct pcap_stat may get overwritten, + * with unpredictable results, because the pcap_stats() implementation for + * WinPcap will assume that the structure has the additional members that + * are added if and only if HAVE_REMOTE is defined, and will fill them in, + * even if they're not there. + * + * Yes, this is q WinPcap bug; if your project has a public header file + * that checks or otherwise uses a #define that's defined by your project's + * configuration process, and don't ensure that it's always defined + * appropriately when that header file is included, before its first use, + * you have made a mistake. + * + * In libpcap 1.7.0 and later, the pcap_stats() implementation for WinPcap + * will not fill those fields in; however, no WinPcap implementation was + * based on that recent a libpcap release, so they all have the bug. + * + * Npcap was originally based on libpcap 1.8.0, and later releases are + * based on later releases of libpcap, so they will not overwrite memory + * past the end of the structure. + * + * The header file bug is fixed in libpcap 1.9.0 or later - the fields + * are present on Windows, regardless of whether HAVE_REMOTE is defined + * or not when the header is included (and are not present on UN*X), so + * if you build with an SDK with libpcap 1.9.0 or later headers, you + * do not need to define HAVE_REMOTE before including pcap.h (including it + * will make no difference). + * + * No version of the WinPcap SDK provided libpcap 1.9.0-or-later headers. + * The Npcap SDK, as of SDK version 1.04, provides them, so this is + * only necessary for building with the WinPcap SDK. + */ +#ifdef HAVE_PCAP_REMOTE +#define HAVE_REMOTE +#endif + #include #endif /* __CONFIG_H__ */ diff --git a/extcap/androiddump.c b/extcap/androiddump.c index 09864b067c..901dc4f1bb 100644 --- a/extcap/androiddump.c +++ b/extcap/androiddump.c @@ -58,7 +58,7 @@ #define PCAP_RECORD_HEADER_LENGTH 16 #ifdef ANDROIDDUMP_USE_LIBPCAP - #include "wspcap.h" + #include #include #include diff --git a/ringbuffer.c b/ringbuffer.c index ff2b42e2c0..9d810d2d81 100644 --- a/ringbuffer.c +++ b/ringbuffer.c @@ -39,7 +39,7 @@ #include #include -#include "wspcap.h" +#include #include diff --git a/tools/checkAPIs.pl b/tools/checkAPIs.pl index 70e0321e31..d943338876 100755 --- a/tools/checkAPIs.pl +++ b/tools/checkAPIs.pl @@ -547,19 +547,6 @@ sub check_included_files($$) } } - # only our wrapper file wspcap.h may include pcap.h - # all other files should include the wrapper - if ($filename !~ /wspcap\.h/) { - foreach (@incFiles) { - if ( m#([<"]|/+)pcap\.h[>"]$# ) { - print STDERR "Warning: ".$filename. - " includes pcap.h directly. ". - "Include wspcap.h instead.\n"; - last; - } - } - } - # files in the ui/qt directory should include the ui class includes # by using #include <> # this ensures that Visual Studio picks up these files from the diff --git a/tools/radiotap-gen/radiotap-gen.c b/tools/radiotap-gen/radiotap-gen.c index 7e4482ce1d..378912c2ef 100644 --- a/tools/radiotap-gen/radiotap-gen.c +++ b/tools/radiotap-gen/radiotap-gen.c @@ -15,7 +15,7 @@ #include #include -#include "wspcap.h" +#include #include #include #include diff --git a/ui/qt/capture_filter_syntax_worker.cpp b/ui/qt/capture_filter_syntax_worker.cpp index 711acb46eb..f76df73082 100644 --- a/ui/qt/capture_filter_syntax_worker.cpp +++ b/ui/qt/capture_filter_syntax_worker.cpp @@ -12,7 +12,7 @@ #ifdef HAVE_LIBPCAP #include -#include "wspcap.h" +#include #include "capture_opts.h" #include "ui/capture_globals.h" diff --git a/ui/qt/compiled_filter_output.cpp b/ui/qt/compiled_filter_output.cpp index 5b6a7e4e46..fc64b37c3c 100644 --- a/ui/qt/compiled_filter_output.cpp +++ b/ui/qt/compiled_filter_output.cpp @@ -13,7 +13,7 @@ #include "compiled_filter_output.h" #ifdef HAVE_LIBPCAP -#include "wspcap.h" +#include #endif #include "capture_opts.h" diff --git a/wspcap.h b/wspcap.h deleted file mode 100644 index 0ccb8d4818..0000000000 --- a/wspcap.h +++ /dev/null @@ -1,65 +0,0 @@ -/** @file - * - * Wrapper around libpcap/WinPcap's pcap.h. - * - * If HAVE_PCAP_REMOTE is defined, it forces the WinPcap header files to - * define things required for remote capture, by defining HAVE_REMOTE. - * - * With all versions of the WinPcap SDK, if: - * - * 1) you are building with any current WinPcap SDK; - * 2) you do not define HAVE_REMOTE before including pcap.h (or - * pcap/pcap.h); - * 3) you define a struct pcap_stat and pass it to a call to - * pcap_stats(); - * 4) the system you're running on has WinPcap, rather than Npcap, - * installed; - * - * whatever is in memory after the struct pcap_stat may get overwritten, - * with unpredictable results, because the pcap_stats() implementation for - * WinPcap will assume that the structure has the additional members that - * are added if and only if HAVE_REMOTE is defined, and will fill them in, - * even if they're not there. - * - * Yes, this is q WinPcap bug; if your project has a public header file - * that checks or otherwise uses a #define that's defined by your project's - * configuration process, and don't ensure that it's always defined - * appropriately when that header file is included, before its first use, - * you have made a mistake. - * - * In libpcap 1.7.0 and later, the pcap_stats() implementation for WinPcap - * will not fill those fields in; however, no WinPcap implementation was - * based on that recent a libpcap release, so they all have the bug. - * - * Npcap was originally based on libpcap 1.8.0, and later releases are - * based on later releases of libpcap, so they will not overwrite memory - * past the end of the structure. - * - * The header file bug is fixed in libpcap 1.9.0 or later - the fields - * are present on Windows, regardless of whether HAVE_REMOTE is defined - * or not when the header is included (and are not present on UN*X), so - * if you build with an SDK with libpcap 1.9.0 or later headers, you - * do not need to define HAVE_REMOTE before including pcap.h (including it - * will make no difference). - * - * No version of the WinPcap SDK provided libpcap 1.9.0-or-later headers. - * The Npcap SDK, as of SDK version 1.04, provides them, so this is - * only necessary for building with the WinPcap SDK. - * - * Wireshark - Network traffic analyzer - * By Gerald Combs - * Copyright 2007 Gerald Combs - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -#ifndef __WSPCAP_H__ -#define __WSPCAP_H__ - -#ifdef HAVE_PCAP_REMOTE -#define HAVE_REMOTE -#endif - -#include - -#endif /* __WSPCAP_H__ */