Force HAVE_REMOTE to be defined when including pcap.h with remote support.
authorGuy Harris <guy@alum.mit.edu>
Thu, 11 May 2017 10:56:44 +0000 (03:56 -0700)
committerGuy Harris <guy@alum.mit.edu>
Thu, 11 May 2017 10:57:22 +0000 (10:57 +0000)
WinPcap made the mistake of having stuff in its public header fines
depend on a configuration #define, HAVE_REMOTE; this means that we need
to forcibly define it when building with remote capture support.

The tip of the libpcap master branch does not have that botch; hopefully
future versions of libpcap-for-Windows will be based on that libpcap and
thus lack that botch as well.

Defining HAVE_REMOTE in config.h is not the right fix, as it makes it
look like a *Wireshark* configuration option that code in Wireshark
should test, rather than a *WinPcap* configuration option that the
pcap.h that ships with the WinPcap SDK should have been changed, as part
of the build process, to correctly define or not, so that users of
WinPcap don't have to define it themselves.

Change-Id: I62d1eca6d3c900d0dcc9fbc011db77f595a86313
Reviewed-on: https://code.wireshark.org/review/21593
Reviewed-by: Guy Harris <guy@alum.mit.edu>
caputils/capture-pcap-util-unix.c
caputils/capture-pcap-util.h
caputils/capture_wpcap_packet.c
extcap/androiddump.c
ringbuffer.c
trigcap.c
ui/gtk/airpcap_dlg.c
ui/qt/capture_filter_syntax_worker.cpp
ui/qt/compiled_filter_output.cpp

index 362317e914cc9d2447f1afecab15623d6f048dac..5d57a02797d144b0d63747e52dd63d4307ee8c78 100644 (file)
 
 #ifdef HAVE_LIBPCAP
 
+#ifdef HAVE_PCAP_REMOTE
+/*
+ * Force the WinPcap header files to define things required for remote
+ * capture.  (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.)
+ */
+#define HAVE_REMOTE
+#endif
+
 #include <pcap.h>
 
 #ifdef __APPLE__
index a5c3825900ab4ac642d195c6a2c68b860bb04e0c..87a05e8283e157af97bddd1246b47306887d5bd9 100644 (file)
@@ -29,6 +29,18 @@ extern "C" {
 
 #ifdef HAVE_LIBPCAP
 
+#ifdef HAVE_PCAP_REMOTE
+/*
+ * Force the WinPcap header files to define things required for remote
+ * capture.  (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.)
+ */
+#define HAVE_REMOTE
+#endif
+
 #include <pcap.h>
 
 #include "capture_opts.h"
index 5b3ffc479d3f4cfb0bfc78eb6ec0a820c39f2f9e..6d1b77cb11e9c9cdd32ab75fbca280ead5bda325 100644 (file)
 #include <glib.h>
 #include <gmodule.h>
 
+#ifdef HAVE_PCAP_REMOTE
+/*
+ * Force the WinPcap header files to define things required for remote
+ * capture.  (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.)
+ */
+#define HAVE_REMOTE
+#endif
+
 #include <pcap.h>
 
 /* XXX - yes, I know, I should move cppmagic.h to a generic location. */
index d5a267e9547fb7088275016e62484eaa61ca0090..00cc0e03fbdb3031db3d1c03130f84c4d4c0b2b6 100644 (file)
 #define PCAP_RECORD_HEADER_LENGTH              16
 
 #ifdef ANDROIDDUMP_USE_LIBPCAP
+    #ifdef HAVE_PCAP_REMOTE
+    /*
+     * Force the WinPcap header files to define things required for remote
+     * capture.  (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.)
+     */
+    #define HAVE_REMOTE
+    #endif
+
     #include <pcap.h>
     #include <pcap-bpf.h>
     #include <pcap/bluetooth.h>
index 0ba365c25f2a44247f7af8f37c46d7707e1c8380..51a1a2ff6bcb7a20622e7897db016c3f1b5e4f01 100644 (file)
 #include <time.h>
 #include <errno.h>
 
+#ifdef HAVE_PCAP_REMOTE
+/*
+ * Force the WinPcap header files to define things required for remote
+ * capture.  (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.)
+ */
+#define HAVE_REMOTE
+#endif
+
 #include <pcap.h>
 
 #include <glib.h>
index c0779584d68d21e3ca12732e5d447976445bf520..3c14c6a37e9d58adbba2ea292f5105edabda680c 100644 (file)
--- a/trigcap.c
+++ b/trigcap.c
 #include <signal.h>
 #include <errno.h>
 #include <getopt.h>
+
+#ifdef HAVE_PCAP_REMOTE
+/*
+ * Force the WinPcap header files to define things required for remote
+ * capture.  (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.)
+ */
+#define HAVE_REMOTE
+#endif
+
 #include <pcap.h>
 
 static int dumping;
index b3660b387f2aac06576a314e0d08de91a35918cd..b02034c2db877f3bff1f415c17fab8b0cc7aad6f 100644 (file)
 #include <epan/prefs.h>
 #include <epan/crypt/wep-wpadefs.h>
 
+#ifdef HAVE_PCAP_REMOTE
+/*
+ * Force the WinPcap header files to define things required for remote
+ * capture.  (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.)
+ */
+#define HAVE_REMOTE
+#endif
+
 #include <pcap.h>
 
 #include "ui/simple_dialog.h"
index 9f6ae0cc1caad62283311c0eea828e9a292c1798..a296f89c51ca006109279ed31e7b5683bb545baa 100644 (file)
 
 #ifdef HAVE_LIBPCAP
 #include <glib.h>
+
+#ifdef HAVE_PCAP_REMOTE
+/*
+ * Force the WinPcap header files to define things required for remote
+ * capture.  (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.)
+ */
+#define HAVE_REMOTE
+#endif
+
 #include <pcap.h>
+
 #include "capture_opts.h"
 #include "ui/capture_globals.h"
 #endif
index 67c5f64daa0902f8cb153df19afb780b5158be2c..c78ab713acabb5d1a61d8de1e93250ce88b66a76 100644 (file)
 #include <ui_compiled_filter_output.h>
 #include "compiled_filter_output.h"
 
+#ifdef HAVE_PCAP_REMOTE
+/*
+ * Force the WinPcap header files to define things required for remote
+ * capture.  (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.)
+ */
+#define HAVE_REMOTE
+#endif
+
 #include <pcap.h>
 
 #include "capture_opts.h"