From a7eaa38ebf24e89e2b5cd13a5d18a23779e4bbb1 Mon Sep 17 00:00:00 2001 From: Dan Church Date: Sun, 9 Jul 2023 12:10:31 -0500 Subject: [PATCH] Fix detection of DLT_* macros pcap.h in its entirety must be included in order for bpf.h to work properly. --- configure | 49 ++++++++++++++++++++++--------------------------- configure.in | 36 +++++++++++++++--------------------- 2 files changed, 37 insertions(+), 48 deletions(-) diff --git a/configure b/configure index ef30a34..a1acd04 100755 --- a/configure +++ b/configure @@ -3890,21 +3890,16 @@ fi fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BPF include path" >&5 -$as_echo_n "checking for BPF include path... " >&6; } -BPF=`/usr/bin/perl -ne '/include\s+<(.*bpf\.h)>/ && print "$1\n"' $pcap_base/pcap.h` -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BPF" >&5 -$as_echo "$BPF" >&6; } +PCAP_H=$pcap_base/pcap.h present="" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLT_LINUX_SLL in $BPF" >&5 -$as_echo_n "checking for DLT_LINUX_SLL in $BPF... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLT_LINUX_SLL in $PCAP_H" >&5 +$as_echo_n "checking for DLT_LINUX_SLL in $PCAP_H... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <$BPF> +#include <$PCAP_H> #ifdef DLT_LINUX_SLL yes #endif @@ -3922,12 +3917,12 @@ rm -f conftest* present="" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLT_LOOP in $BPF" >&5 -$as_echo_n "checking for DLT_LOOP in $BPF... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLT_LOOP in $PCAP_H" >&5 +$as_echo_n "checking for DLT_LOOP in $PCAP_H... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <$BPF> +#include <$PCAP_H> #ifdef DLT_LOOP yes #endif @@ -3945,12 +3940,12 @@ rm -f conftest* present="" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLT_IEEE802_11 in $BPF" >&5 -$as_echo_n "checking for DLT_IEEE802_11 in $BPF... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLT_IEEE802_11 in $PCAP_H" >&5 +$as_echo_n "checking for DLT_IEEE802_11 in $PCAP_H... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <$BPF> +#include <$PCAP_H> #ifdef DLT_IEEE802_11 yes #endif @@ -3969,12 +3964,12 @@ rm -f conftest* present="" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLT_IEEE802_11_RADIO in $BPF" >&5 -$as_echo_n "checking for DLT_IEEE802_11_RADIO in $BPF... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLT_IEEE802_11_RADIO in $PCAP_H" >&5 +$as_echo_n "checking for DLT_IEEE802_11_RADIO in $PCAP_H... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <$BPF> +#include <$PCAP_H> #ifdef DLT_IEEE802_11_RADIO yes #endif @@ -3993,12 +3988,12 @@ rm -f conftest* present="" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLT_RAW in $BPF" >&5 -$as_echo_n "checking for DLT_RAW in $BPF... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLT_RAW in $PCAP_H" >&5 +$as_echo_n "checking for DLT_RAW in $PCAP_H... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <$BPF> +#include <$PCAP_H> #ifdef DLT_RAW yes #endif @@ -4017,12 +4012,12 @@ rm -f conftest* present="" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLT_PFLOG in $BPF" >&5 -$as_echo_n "checking for DLT_PFLOG in $BPF... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLT_PFLOG in $PCAP_H" >&5 +$as_echo_n "checking for DLT_PFLOG in $PCAP_H... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <$BPF> +#include <$PCAP_H> #ifdef DLT_PFLOG yes #endif @@ -4041,12 +4036,12 @@ rm -f conftest* present="" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLT_IPNET in $BPF" >&5 -$as_echo_n "checking for DLT_IPNET in $BPF... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DLT_IPNET in $PCAP_H" >&5 +$as_echo_n "checking for DLT_IPNET in $PCAP_H... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <$BPF> +#include <$PCAP_H> #ifdef DLT_IPNET yes #endif diff --git a/configure.in b/configure.in index dbef39b..781dd62 100644 --- a/configure.in +++ b/configure.in @@ -373,13 +373,7 @@ if test "$USE_PCAP_RESTART" = "1"; then fi -dnl -dnl Next figure out which bpf header file to look at. -dnl - -AC_MSG_CHECKING(for BPF include path) -BPF=`/usr/bin/perl -ne '/include\s+<(.*bpf\.h)>/ && print "$1\n"' $pcap_base/pcap.h` -AC_MSG_RESULT($BPF) +PCAP_H=$pcap_base/pcap.h dnl dnl Check for DLT_* types that might not have existed in older @@ -387,10 +381,10 @@ dnl libpcap's dnl present="" -AC_MSG_CHECKING(for DLT_LINUX_SLL in $BPF) +AC_MSG_CHECKING(for DLT_LINUX_SLL in $PCAP_H) AC_EGREP_CPP(yes, [ -#include <$BPF> +#include <$PCAP_H> #ifdef DLT_LINUX_SLL yes #endif @@ -398,10 +392,10 @@ yes [HAVE_DLT_LINUX_SLL="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_LINUX_SLL="0" && AC_MSG_RESULT(no)]) present="" -AC_MSG_CHECKING(for DLT_LOOP in $BPF) +AC_MSG_CHECKING(for DLT_LOOP in $PCAP_H) AC_EGREP_CPP(yes, [ -#include <$BPF> +#include <$PCAP_H> #ifdef DLT_LOOP yes #endif @@ -409,10 +403,10 @@ yes [HAVE_DLT_LOOP="1" && AC_MSG_RESULT(yes)], [HAVE_DLT_LOOP="0" && AC_MSG_RESULT(no)]) present="" -AC_MSG_CHECKING(for DLT_IEEE802_11 in $BPF) +AC_MSG_CHECKING(for DLT_IEEE802_11 in $PCAP_H) AC_EGREP_CPP(yes, [ -#include <$BPF> +#include <$PCAP_H> #ifdef DLT_IEEE802_11 yes #endif @@ -421,10 +415,10 @@ yes present="" -AC_MSG_CHECKING(for DLT_IEEE802_11_RADIO in $BPF) +AC_MSG_CHECKING(for DLT_IEEE802_11_RADIO in $PCAP_H) AC_EGREP_CPP(yes, [ -#include <$BPF> +#include <$PCAP_H> #ifdef DLT_IEEE802_11_RADIO yes #endif @@ -433,10 +427,10 @@ yes present="" -AC_MSG_CHECKING(for DLT_RAW in $BPF) +AC_MSG_CHECKING(for DLT_RAW in $PCAP_H) AC_EGREP_CPP(yes, [ -#include <$BPF> +#include <$PCAP_H> #ifdef DLT_RAW yes #endif @@ -445,10 +439,10 @@ yes present="" -AC_MSG_CHECKING(for DLT_PFLOG in $BPF) +AC_MSG_CHECKING(for DLT_PFLOG in $PCAP_H) AC_EGREP_CPP(yes, [ -#include <$BPF> +#include <$PCAP_H> #ifdef DLT_PFLOG yes #endif @@ -457,10 +451,10 @@ yes present="" -AC_MSG_CHECKING(for DLT_IPNET in $BPF) +AC_MSG_CHECKING(for DLT_IPNET in $PCAP_H) AC_EGREP_CPP(yes, [ -#include <$BPF> +#include <$PCAP_H> #ifdef DLT_IPNET yes #endif