Skip to content

Commit 9beea81

Browse files
committed
Require config.h to be from the tcpdump build.
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.
1 parent 9276398 commit 9beea81

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
8080
autogen.sh: Allow to configure Autoconf warnings.
8181
autogen.sh: Delete all trailing blank lines at end of configure.
8282
Reimplement the tests similarly to libpcap.
83+
Require config.h to be from the tcpdump build.
8384
Documentation:
8485
man: Clarify the "any" pseudo-interface further.
8586

cmakeconfig.h.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/* cmakeconfig.h.in */
22

3+
#ifndef TCPDUMP_CONFIG_H_
4+
#define TCPDUMP_CONFIG_H_
5+
36
/* Define to 1 if arpa/inet.h declares `ether_ntohost' */
47
#cmakedefine ARPA_INET_H_DECLARES_ETHER_NTOHOST 1
58

@@ -185,3 +188,5 @@
185188

186189
/* Define to `uint8_t' if u_int8_t not defined. */
187190
#cmakedefine u_int8_t 1
191+
192+
#endif // TCPDUMP_CONFIG_H_

configure.ac

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,13 @@ AC_SUBST(MAN_MISC_INFO)
11211121
AC_PROG_INSTALL
11221122

11231123
AC_CONFIG_HEADERS([config.h])
1124+
AH_TOP([
1125+
#ifndef TCPDUMP_CONFIG_H_
1126+
#define TCPDUMP_CONFIG_H_
1127+
])
1128+
AH_BOTTOM([
1129+
#endif // TCPDUMP_CONFIG_H_
1130+
])
11241131

11251132
AC_CONFIG_COMMANDS([.devel],[[if test -f .devel; then
11261133
echo timestamp > stamp-h

tcpdump.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
*/
3535

3636
#include <config.h>
37+
#ifndef TCPDUMP_CONFIG_H_
38+
#error "The included config.h header is not from the tcpdump build."
39+
#endif
3740

3841
#include "netdissect-stdinc.h"
3942

0 commit comments

Comments
 (0)