mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 21:21:31 +00:00
Call pcap_set_immediate_mode to get results back immediately.
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
#Nmap Changelog ($Id$); -*-text-*-
|
#Nmap Changelog ($Id$); -*-text-*-
|
||||||
|
|
||||||
|
o [GH#1291][GH#34] Use pcap_create instead of pcap_live_open in Nmap, and set
|
||||||
|
immediate mode on the pcap descriptor. This solves packet loss problems on
|
||||||
|
Linux and may improve performance on other platforms. [Daniel Cater, Mike
|
||||||
|
Pontillo, Daniel Miller]
|
||||||
|
|
||||||
o [GH#1150] Start host timeout clocks when the first probe is sent to a host,
|
o [GH#1150] Start host timeout clocks when the first probe is sent to a host,
|
||||||
not when the hostgroup is started. Sometimes a host doesn't get probes until
|
not when the hostgroup is started. Sometimes a host doesn't get probes until
|
||||||
late in the hostgroup, increasing the chance it will time out. [jsiembida]
|
late in the hostgroup, increasing the chance it will time out. [jsiembida]
|
||||||
|
|||||||
98
configure
vendored
98
configure
vendored
@@ -1948,48 +1948,6 @@ $as_echo "$ac_res" >&6; }
|
|||||||
|
|
||||||
} # ac_fn_c_check_decl
|
} # ac_fn_c_check_decl
|
||||||
|
|
||||||
# ac_fn_cxx_try_run LINENO
|
|
||||||
# ------------------------
|
|
||||||
# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
|
|
||||||
# that executables *can* be run.
|
|
||||||
ac_fn_cxx_try_run ()
|
|
||||||
{
|
|
||||||
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
|
||||||
if { { ac_try="$ac_link"
|
|
||||||
case "(($ac_try" in
|
|
||||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
|
||||||
*) ac_try_echo=$ac_try;;
|
|
||||||
esac
|
|
||||||
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
|
||||||
$as_echo "$ac_try_echo"; } >&5
|
|
||||||
(eval "$ac_link") 2>&5
|
|
||||||
ac_status=$?
|
|
||||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
|
||||||
test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
|
|
||||||
{ { case "(($ac_try" in
|
|
||||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
|
||||||
*) ac_try_echo=$ac_try;;
|
|
||||||
esac
|
|
||||||
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
|
||||||
$as_echo "$ac_try_echo"; } >&5
|
|
||||||
(eval "$ac_try") 2>&5
|
|
||||||
ac_status=$?
|
|
||||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
|
||||||
test $ac_status = 0; }; }; then :
|
|
||||||
ac_retval=0
|
|
||||||
else
|
|
||||||
$as_echo "$as_me: program exited with status $ac_status" >&5
|
|
||||||
$as_echo "$as_me: failed program was:" >&5
|
|
||||||
sed 's/^/| /' conftest.$ac_ext >&5
|
|
||||||
|
|
||||||
ac_retval=$ac_status
|
|
||||||
fi
|
|
||||||
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
|
|
||||||
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
|
||||||
as_fn_set_status $ac_retval
|
|
||||||
|
|
||||||
} # ac_fn_cxx_try_run
|
|
||||||
|
|
||||||
# ac_fn_c_check_func LINENO FUNC VAR
|
# ac_fn_c_check_func LINENO FUNC VAR
|
||||||
# ----------------------------------
|
# ----------------------------------
|
||||||
# Tests whether FUNC exists, setting the cache variable VAR accordingly
|
# Tests whether FUNC exists, setting the cache variable VAR accordingly
|
||||||
@@ -2056,6 +2014,48 @@ $as_echo "$ac_res" >&6; }
|
|||||||
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
||||||
|
|
||||||
} # ac_fn_c_check_func
|
} # ac_fn_c_check_func
|
||||||
|
|
||||||
|
# ac_fn_cxx_try_run LINENO
|
||||||
|
# ------------------------
|
||||||
|
# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
|
||||||
|
# that executables *can* be run.
|
||||||
|
ac_fn_cxx_try_run ()
|
||||||
|
{
|
||||||
|
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
||||||
|
if { { ac_try="$ac_link"
|
||||||
|
case "(($ac_try" in
|
||||||
|
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||||
|
*) ac_try_echo=$ac_try;;
|
||||||
|
esac
|
||||||
|
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
||||||
|
$as_echo "$ac_try_echo"; } >&5
|
||||||
|
(eval "$ac_link") 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
|
||||||
|
{ { case "(($ac_try" in
|
||||||
|
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||||
|
*) ac_try_echo=$ac_try;;
|
||||||
|
esac
|
||||||
|
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
|
||||||
|
$as_echo "$ac_try_echo"; } >&5
|
||||||
|
(eval "$ac_try") 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; }; }; then :
|
||||||
|
ac_retval=0
|
||||||
|
else
|
||||||
|
$as_echo "$as_me: program exited with status $ac_status" >&5
|
||||||
|
$as_echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
ac_retval=$ac_status
|
||||||
|
fi
|
||||||
|
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
|
||||||
|
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
||||||
|
as_fn_set_status $ac_retval
|
||||||
|
|
||||||
|
} # ac_fn_cxx_try_run
|
||||||
cat >config.log <<_ACEOF
|
cat >config.log <<_ACEOF
|
||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
@@ -6413,6 +6413,9 @@ if test $have_libpcap != yes; then
|
|||||||
|
|
||||||
$as_echo "#define PCAP_INCLUDED 1" >>confdefs.h
|
$as_echo "#define PCAP_INCLUDED 1" >>confdefs.h
|
||||||
|
|
||||||
|
|
||||||
|
$as_echo "#define HAVE_PCAP_SET_IMMEDIATE_MODE 1" >>confdefs.h
|
||||||
|
|
||||||
else
|
else
|
||||||
# We assume our included libpcap doesn't need this check-and-define
|
# We assume our included libpcap doesn't need this check-and-define
|
||||||
|
|
||||||
@@ -6452,6 +6455,17 @@ $as_echo "#define PCAP_NETMASK_UNKNOWN 0" >>confdefs.h
|
|||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_pcap_netmask_unknown" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_pcap_netmask_unknown" >&5
|
||||||
$as_echo "$ac_cv_have_pcap_netmask_unknown" >&6; }
|
$as_echo "$ac_cv_have_pcap_netmask_unknown" >&6; }
|
||||||
|
|
||||||
|
for ac_func in pcap_set_immediate_mode
|
||||||
|
do :
|
||||||
|
ac_fn_c_check_func "$LINENO" "pcap_set_immediate_mode" "ac_cv_func_pcap_set_immediate_mode"
|
||||||
|
if test "x$ac_cv_func_pcap_set_immediate_mode" = xyes; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_PCAP_SET_IMMEDIATE_MODE 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$as_echo "#define HAVE_LIBPCAP 1" >>confdefs.h
|
$as_echo "#define HAVE_LIBPCAP 1" >>confdefs.h
|
||||||
|
|||||||
@@ -479,9 +479,11 @@ if test $have_libpcap != yes; then
|
|||||||
PCAP_CLEAN="clean-pcap"
|
PCAP_CLEAN="clean-pcap"
|
||||||
PCAP_DIST_CLEAN="distclean-pcap"
|
PCAP_DIST_CLEAN="distclean-pcap"
|
||||||
AC_DEFINE(PCAP_INCLUDED, 1, [Using included libpcap])
|
AC_DEFINE(PCAP_INCLUDED, 1, [Using included libpcap])
|
||||||
|
AC_DEFINE(HAVE_PCAP_SET_IMMEDIATE_MODE, 1, [Included libpcap has pcap_set_immediate_mode])
|
||||||
else
|
else
|
||||||
# We assume our included libpcap doesn't need this check-and-define
|
# We assume our included libpcap doesn't need this check-and-define
|
||||||
PCAP_DEFINE_NETMASK_UNKNOWN
|
PCAP_DEFINE_NETMASK_UNKNOWN
|
||||||
|
AC_CHECK_FUNCS([pcap_set_immediate_mode])
|
||||||
|
|
||||||
AC_DEFINE(HAVE_LIBPCAP, 1, [Have libpcap library])
|
AC_DEFINE(HAVE_LIBPCAP, 1, [Have libpcap library])
|
||||||
LIBPCAP_LIBS="-lpcap"
|
LIBPCAP_LIBS="-lpcap"
|
||||||
|
|||||||
@@ -4127,6 +4127,9 @@ pcap_t *my_pcap_open_live(const char *device, int snaplen, int promisc, int to_m
|
|||||||
MY_PCAP_SET(pcap_set_snaplen, pt, snaplen);
|
MY_PCAP_SET(pcap_set_snaplen, pt, snaplen);
|
||||||
MY_PCAP_SET(pcap_set_promisc, pt, promisc);
|
MY_PCAP_SET(pcap_set_promisc, pt, promisc);
|
||||||
MY_PCAP_SET(pcap_set_timeout, pt, to_ms);
|
MY_PCAP_SET(pcap_set_timeout, pt, to_ms);
|
||||||
|
#ifdef HAVE_PCAP_SET_IMMEDIATE_MODE
|
||||||
|
MY_PCAP_SET(pcap_set_immediate_mode, pt, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
failed = pcap_activate(pt);
|
failed = pcap_activate(pt);
|
||||||
if (failed < 0) {
|
if (failed < 0) {
|
||||||
@@ -4147,6 +4150,9 @@ pcap_t *my_pcap_open_live(const char *device, int snaplen, int promisc, int to_m
|
|||||||
}
|
}
|
||||||
CloseHandle(pcapMutex);
|
CloseHandle(pcapMutex);
|
||||||
/* We want any responses back ASAP */
|
/* We want any responses back ASAP */
|
||||||
|
/* This is unnecessary with Npcap since libpcap calls PacketSetMinToCopy(0)
|
||||||
|
* based on immediate mode. Have not determined if it is needed for WinPcap
|
||||||
|
* or not, but it's not hurting anything. */
|
||||||
pcap_setmintocopy(pt, 1);
|
pcap_setmintocopy(pt, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -255,5 +255,6 @@ extern "C" int gethostname (char *, unsigned int);
|
|||||||
|
|
||||||
#undef HAVE_IPV6_IPPROTO_RAW
|
#undef HAVE_IPV6_IPPROTO_RAW
|
||||||
#undef PCAP_NETMASK_UNKNOWN
|
#undef PCAP_NETMASK_UNKNOWN
|
||||||
|
#undef HAVE_PCAP_SET_IMMEDIATE_MODE
|
||||||
|
|
||||||
#endif /* CONFIG_H */
|
#endif /* CONFIG_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user