Use headers to determine BSD-style BPF support. Fixes #3289

This commit is contained in:
dmiller 2026-03-16 17:21:51 +00:00
parent 84961d5133
commit ce2e99cb29
3 changed files with 1210 additions and 1057 deletions

File diff suppressed because it is too large Load diff

View file

@ -109,11 +109,11 @@ else
AC_CHECK_HEADERS(fcntl.h unistd.h)
AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi.h sys/dlpihdr.h sys/dlpi_ext.h \
sys/ioctl.h sys/mib.h sys/ndd_var.h sys/socket.h sys/sockio.h \
sys/sysctl.h sys/time.h sys/types.h)
sys/ioccom.h sys/sysctl.h sys/time.h sys/types.h)
AC_CHECK_HEADERS(net/bpf.h net/if.h net/if_var.h \
net/if_arp.h net/if_dl.h net/pfilt.h \
net/pfvar.h net/radix.h net/raw.h netinet/in_var.h \
netinet/in6_var.h \
netinet/in6_var.h linux/netlink.h \
net/if_tun.h linux/if_tun.h netinet/ip_fw.h linux/ip_fw.h \
linux/ip_fwchains.h linux/netfilter_ipv4/ipchains_core.h)
AC_CHECK_HEADERS(ip_fil_compat.h netinet/ip_fil_compat.h ip_compat.h \
@ -127,6 +127,7 @@ AC_INCLUDES_DEFAULT
#endif
])
fi
AC_CHECK_HEADERS(bsd/string.h)
if test "$ac_cv_header_bsd_string_h" = yes; then
STRLCPY_HEADER="bsd/string.h"

View file

@ -91,14 +91,25 @@ dnl
dnl usage: AC_DNET_BSD_BPF
dnl results: HAVE_BSD_BPF
dnl
dnl Copied from libpcap's configure.ac
AC_DEFUN([AC_DNET_BSD_BPF],
[AC_MSG_CHECKING(for Berkeley Packet Filter)
AC_CACHE_VAL(ac_cv_dnet_bsd_bpf,
if test -c /dev/bpf -o -c /dev/bpf0 ; then
ac_cv_dnet_bsd_bpf=yes
else
ac_cv_dnet_bsd_bpf=no
fi)
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#ifdef HAVE_SYS_IOCCOM_H
#include <sys/ioccom.h>
#endif
#include <net/bpf.h>
#include <net/if.h>
],
[u_int i = BIOCSETIF;],
ac_cv_dnet_bsd_bpf=yes,
ac_cv_dnet_bsd_bpf=no))
AC_MSG_RESULT($ac_cv_dnet_bsd_bpf)
if test $ac_cv_dnet_bsd_bpf = yes ; then
AC_DEFINE(HAVE_BSD_BPF, 1,
@ -114,7 +125,7 @@ dnl
AC_DEFUN([AC_DNET_LINUX_PROCFS],
[AC_MSG_CHECKING(for Linux proc filesystem)
AC_CACHE_VAL(ac_cv_dnet_linux_procfs,
if test "x`cat /proc/sys/kernel/ostype 2>&-`" = "xLinux" ; then
if test "$ac_cv_header_linux_netlink_h" = yes ; then
ac_cv_dnet_linux_procfs=yes
else
ac_cv_dnet_linux_procfs=no