mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Add configure test for PCAP_NETMASK_UNKNOWN
This commit is contained in:
21
acinclude.m4
21
acinclude.m4
@@ -87,6 +87,27 @@ int main() {
|
||||
[AC_MSG_RESULT(cross-compiling -- assuming yes); $3])
|
||||
])
|
||||
|
||||
dnl Checks if PCAP_NETMASK_UNKNOWN is defined (has been since libpcap 1.1.1)
|
||||
dnl Sets it to 0 (no checking) if it's not defined.
|
||||
AC_DEFUN([PCAP_DEFINE_NETMASK_UNKNOWN],
|
||||
[
|
||||
AC_MSG_CHECKING(if PCAP_NETMASK_UNKNOWN is defined/handled by libpcap)
|
||||
AC_CACHE_VAL(ac_cv_have_pcap_netmask_unknown,
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#include <pcap.h>
|
||||
],
|
||||
[
|
||||
int i = PCAP_NETMASK_UNKNOWN;
|
||||
],
|
||||
ac_cv_have_pcap_netmask_unknown=yes,
|
||||
ac_cv_have_pcap_netmask_unknown=no))
|
||||
if test $ac_cv_have_pcap_netmask_unknown = no; then
|
||||
AC_DEFINE(PCAP_NETMASK_UNKNOWN, 0, [Possibly using libpcap prior to 1.1.0.])
|
||||
fi
|
||||
AC_MSG_RESULT($ac_cv_have_pcap_netmask_unknown)
|
||||
])
|
||||
|
||||
dnl Checks if IPPROTO_RAW induces IP_HDRINCL-like behavior in AF_INET6 sockets.
|
||||
dnl Defines HAVE_IPV6_IPPROTO_RAW if so. So far I only know this happens on
|
||||
dnl Linux.
|
||||
|
||||
38
configure
vendored
38
configure
vendored
@@ -6526,6 +6526,44 @@ fi
|
||||
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if PCAP_NETMASK_UNKNOWN is defined/handled by libpcap" >&5
|
||||
$as_echo_n "checking if PCAP_NETMASK_UNKNOWN is defined/handled by libpcap... " >&6; }
|
||||
if ${ac_cv_have_pcap_netmask_unknown+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <pcap.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
int i = PCAP_NETMASK_UNKNOWN;
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
ac_cv_have_pcap_netmask_unknown=yes
|
||||
else
|
||||
ac_cv_have_pcap_netmask_unknown=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
|
||||
if test $ac_cv_have_pcap_netmask_unknown = no; then
|
||||
|
||||
$as_echo "#define PCAP_NETMASK_UNKNOWN 0" >>confdefs.h
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_pcap_netmask_unknown" >&5
|
||||
$as_echo "$ac_cv_have_pcap_netmask_unknown" >&6; }
|
||||
|
||||
|
||||
have_pcre=no
|
||||
requested_included_pcre=no
|
||||
LIBPCREDIR=libpcre
|
||||
|
||||
@@ -458,6 +458,8 @@ AC_SUBST(PCAP_CLEAN)
|
||||
AC_SUBST(PCAP_DIST_CLEAN)
|
||||
AC_SUBST(LIBPCAP_LIBS)
|
||||
|
||||
PCAP_DEFINE_NETMASK_UNKNOWN
|
||||
|
||||
have_pcre=no
|
||||
requested_included_pcre=no
|
||||
LIBPCREDIR=libpcre
|
||||
|
||||
@@ -118,3 +118,24 @@ $1],[AC_MSG_RESULT([no])
|
||||
$2])
|
||||
])dnl
|
||||
|
||||
dnl Checks if PCAP_NETMASK_UNKNOWN is defined (has been since libpcap 1.1.1)
|
||||
dnl Sets it to 0 (no checking) if it's not defined.
|
||||
AC_DEFUN([PCAP_DEFINE_NETMASK_UNKNOWN],
|
||||
[
|
||||
AC_MSG_CHECKING(if PCAP_NETMASK_UNKNOWN is defined/handled by libpcap)
|
||||
AC_CACHE_VAL(ac_cv_have_pcap_netmask_unknown,
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#include <pcap.h>
|
||||
],
|
||||
[
|
||||
int i = PCAP_NETMASK_UNKNOWN;
|
||||
],
|
||||
ac_cv_have_pcap_netmask_unknown=yes,
|
||||
ac_cv_have_pcap_netmask_unknown=no))
|
||||
if test $ac_cv_have_pcap_netmask_unknown = no; then
|
||||
AC_DEFINE(PCAP_NETMASK_UNKNOWN, 0, [Possibly using libpcap prior to 1.1.0.])
|
||||
fi
|
||||
AC_MSG_RESULT($ac_cv_have_pcap_netmask_unknown)
|
||||
])
|
||||
|
||||
|
||||
38
nsock/src/configure
vendored
38
nsock/src/configure
vendored
@@ -3625,6 +3625,44 @@ if test "$have_libpcap" != "no"; then
|
||||
fi
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if PCAP_NETMASK_UNKNOWN is defined/handled by libpcap" >&5
|
||||
$as_echo_n "checking if PCAP_NETMASK_UNKNOWN is defined/handled by libpcap... " >&6; }
|
||||
if ${ac_cv_have_pcap_netmask_unknown+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <pcap.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
int i = PCAP_NETMASK_UNKNOWN;
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
ac_cv_have_pcap_netmask_unknown=yes
|
||||
else
|
||||
ac_cv_have_pcap_netmask_unknown=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
|
||||
if test $ac_cv_have_pcap_netmask_unknown = no; then
|
||||
|
||||
$as_echo "#define PCAP_NETMASK_UNKNOWN 0" >>confdefs.h
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_pcap_netmask_unknown" >&5
|
||||
$as_echo "$ac_cv_have_pcap_netmask_unknown" >&6; }
|
||||
|
||||
|
||||
ax_have_epoll_cppflags="${CPPFLAGS}"
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "linux/version.h" "ac_cv_header_linux_version_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_linux_version_h" = xyes; then :
|
||||
|
||||
@@ -168,6 +168,8 @@ if test "$have_libpcap" != "no"; then
|
||||
fi
|
||||
AC_SUBST(LIBPCAP_LIBS)
|
||||
|
||||
PCAP_DEFINE_NETMASK_UNKNOWN
|
||||
|
||||
AX_HAVE_EPOLL([AC_DEFINE(HAVE_EPOLL)], )
|
||||
AX_HAVE_POLL([AC_DEFINE(HAVE_POLL)], )
|
||||
AC_CHECK_FUNCS(kqueue kevent, [AC_DEFINE(HAVE_KQUEUE)], )
|
||||
|
||||
@@ -107,7 +107,7 @@ static int nsock_pcap_set_filter(struct npool *nsp, pcap_t *pt, const char *devi
|
||||
struct bpf_program fcode;
|
||||
int rc;
|
||||
|
||||
rc = pcap_compile(pt, &fcode, (char *)bpf, 1, 0);
|
||||
rc = pcap_compile(pt, &fcode, (char *)bpf, 1, PCAP_NETMASK_UNKNOWN);
|
||||
if (rc) {
|
||||
nsock_log_error(nsp, "Error compiling pcap filter: %s", pcap_geterr(pt));
|
||||
return rc;
|
||||
|
||||
Reference in New Issue
Block a user