added check for net/bpf.h in configure.ac

This commit is contained in:
hyung-hwan 2020-11-16 16:55:22 +00:00
parent 330135bb26
commit 802b8038bd
4 changed files with 10 additions and 3 deletions

2
mio/configure vendored
View File

@ -13997,7 +13997,7 @@ fi
done
for ac_header in net/if.h net/if_dl.h netpacket/packet.h
for ac_header in net/if.h net/if_dl.h netpacket/packet.h net/bpf.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "

View File

@ -113,7 +113,7 @@ AC_CHECK_HEADERS([sys/resource.h sys/wait.h sys/syscall.h sys/ioctl.h])
AC_CHECK_HEADERS([sys/sendfile.h sys/epoll.h sys/event.h sys/poll.h])
AC_CHECK_HEADERS([sys/sysctl.h sys/socket.h sys/sockio.h sys/un.h])
AC_CHECK_HEADERS([ifaddrs.h tiuser.h linux/netfilter_ipv4.h netinet/in.h netinet/sctp.h])
AC_CHECK_HEADERS([net/if.h net/if_dl.h netpacket/packet.h], [], [], [
AC_CHECK_HEADERS([net/if.h net/if_dl.h netpacket/packet.h net/bpf.h], [], [], [
#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_HEADERS([sys/stropts.h sys/macstat.h linux/ethtool.h linux/sockios.h])

View File

@ -217,6 +217,9 @@
/* Define to 1 if you have the <netpacket/packet.h> header file. */
#undef HAVE_NETPACKET_PACKET_H
/* Define to 1 if you have the <net/bpf.h> header file. */
#undef HAVE_NET_BPF_H
/* Define to 1 if you have the <net/if_dl.h> header file. */
#undef HAVE_NET_IF_DL_H

View File

@ -55,7 +55,9 @@
# include <sys/ioctl.h>
#endif
#include <net/bpf.h>
#if defined(HAVE_NET_BPF_H)
# include <net/bpf.h>
#endif
#if defined(__linux__)
# include <limits.h>
@ -179,8 +181,10 @@ static mio_syshnd_t open_async_bpf (mio_t* mio)
fd = open("/dev/bpf", O_RDWR);
if (fd == MIO_SYSHND_INVALID) goto oops;
#if 0
if (ioctl(fd, BIOCIMMEDIATE, &tmp) == -1) goto oops;
if (ioctl(fd, BIOCGBLEN, &bufsize) == -1) goto oops;
#endif
return fd;
oops: