]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Require config.h to be from the tcpdump build. 1317/head
authorDenis Ovsienko <[email protected]>
Thu, 3 Apr 2025 10:30:27 +0000 (11:30 +0100)
committerDenis Ovsienko <[email protected]>
Thu, 3 Apr 2025 10:49:59 +0000 (11:49 +0100)
This way the build will reliably fail if it happened to include the
header from some other build (e.g. libpcap).  See GitHub bug report
#1313.

CHANGES
cmakeconfig.h.in
configure.ac
tcpdump.c

diff --git a/CHANGES b/CHANGES
index 6173b3e8a8645b16c94b4bf810f6eb47928e355f..45c6ad6c9f68765c1b38099e769d68bdad9364b3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -80,6 +80,7 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
       autogen.sh: Allow to configure Autoconf warnings.
       autogen.sh: Delete all trailing blank lines at end of configure.
       Reimplement the tests similarly to libpcap.
+      Require config.h to be from the tcpdump build.
     Documentation:
       man: Clarify the "any" pseudo-interface further.
 
index 82a4a4bf1ddf63c88de6eab47557c01b460492be..b97e54171b045005745011006dff4387b31f6d9b 100644 (file)
@@ -1,5 +1,8 @@
 /* cmakeconfig.h.in */
 
+#ifndef TCPDUMP_CONFIG_H_
+#define TCPDUMP_CONFIG_H_
+
 /* Define to 1 if arpa/inet.h declares `ether_ntohost' */
 #cmakedefine ARPA_INET_H_DECLARES_ETHER_NTOHOST 1
 
 
 /* Define to `uint8_t' if u_int8_t not defined. */
 #cmakedefine u_int8_t 1
+
+#endif // TCPDUMP_CONFIG_H_
index a26c6414a8f93a8721c33baf094473208ad0acc0..f8d7f55b5c3d408488ebf8794e468fcca5ec3b0c 100644 (file)
@@ -1121,6 +1121,13 @@ AC_SUBST(MAN_MISC_INFO)
 AC_PROG_INSTALL
 
 AC_CONFIG_HEADERS([config.h])
+AH_TOP([
+#ifndef TCPDUMP_CONFIG_H_
+#define TCPDUMP_CONFIG_H_
+])
+AH_BOTTOM([
+#endif // TCPDUMP_CONFIG_H_
+])
 
 AC_CONFIG_COMMANDS([.devel],[[if test -f .devel; then
        echo timestamp > stamp-h
index 77fc084ea2d5379466eb21dc778873caf7fb3f46..36c7325967cb4fa5f845ff8b47e54241f181c153 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -34,6 +34,9 @@
  */
 
 #include <config.h>
+#ifndef TCPDUMP_CONFIG_H_
+#error "The included config.h header is not from the tcpdump build."
+#endif
 
 #include "netdissect-stdinc.h"