1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 14:11:29 +00:00

Fix Nsock's make check: wrong value tested

This commit is contained in:
dmiller
2014-11-17 13:25:35 +00:00
parent 85bb2d388d
commit 2b9fade75b
9 changed files with 6 additions and 77 deletions

View File

@@ -85,5 +85,3 @@
#undef HAVE_EPOLL
#undef HAVE_POLL
#undef HAVE_KQUEUE
#undef PCAP_NETMASK_UNKNOWN

View File

@@ -95,8 +95,6 @@
#ifndef DISABLE_NSOCK_PCAP
#define HAVE_PCAP 1
/* WinPCAP doesn't have this */
#define PCAP_NETMASK_UNKNOWN 0
#endif
/* WSAPoll() isn't available before Vista */

View File

@@ -118,24 +118,3 @@ $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
View File

@@ -3625,44 +3625,6 @@ 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 :

View File

@@ -168,8 +168,6 @@ 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)], )

View File

@@ -74,18 +74,13 @@
#include <unistd.h>
#endif
#if defined(__GNUC__)
#define NORETURN __attribute__((noreturn))
#elif defined(_MSC_VER)
#define NORETURN __declspec((noreturn))
#else
#define NORETURN
#endif
NORETURN void fatal(char *fmt, ...)
void fatal(char *fmt, ...)
__attribute__ ((noreturn))
__attribute__ ((format (printf, 1, 2)));
NORETURN void pfatal(char *fmt, ...)
void pfatal(char *fmt, ...)
__attribute__ ((noreturn))
__attribute__ ((format (printf, 1, 2)));
#endif /* ERROR_H */

View File

@@ -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, PCAP_NETMASK_UNKNOWN);
rc = pcap_compile(pt, &fcode, (char *)bpf, 1, 0);
if (rc) {
nsock_log_error(nsp, "Error compiling pcap filter: %s", pcap_geterr(pt));
return rc;

View File

@@ -375,7 +375,6 @@ static struct proxy_node *proxy_node_new(char *proxystr) {
}
}
fatal("Invalid protocol in proxy specification string: %s", proxystr);
return NULL;
}
struct proxy_parser *proxy_parser_new(const char *proxychainstr) {

View File

@@ -93,7 +93,7 @@ static int connect_tcp_failure(void *tdata) {
(struct sockaddr *)&peer, 0, PORT_TCP);
nsock_loop(ctd->nsp, 4000);
AssertEqual(ctd->connect_result, EINVAL);
AssertEqual(ctd->connect_result, -EINVAL);
return 0;
}