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

Avoid matching ARP/ND response with probes sent after it was received. Fixes #863

This commit is contained in:
dmiller
2019-02-26 19:59:34 +00:00
parent 504e9d767e
commit f519e64b1d
2 changed files with 13 additions and 2 deletions

View File

@@ -1,5 +1,8 @@
#Nmap Changelog ($Id$); -*-text-*- #Nmap Changelog ($Id$); -*-text-*-
o [GH#863] Avoid reporting negative latencies due to matching an ARP or ND
response to a probe sent after it was recieved. [Daniel Miller]
o [ncat][GH#1441] To avoid confusion and to support default proxy ports, o [ncat][GH#1441] To avoid confusion and to support default proxy ports,
option --proxy now requires a literal IPv6 address to be specified using option --proxy now requires a literal IPv6 address to be specified using
square-bracket notation, such as --proxy [2001:db8::123]:456. [nnposter] square-bracket notation, such as --proxy [2001:db8::123]:456. [nnposter]

View File

@@ -1594,7 +1594,11 @@ bool get_arp_result(UltraScanInfo *USI, struct timeval *stime) {
continue; continue;
} }
probeI = hss->probes_outstanding.end(); probeI = hss->probes_outstanding.end();
probeI--; do {
/* Delay in libpcap could mean we sent another probe *after* this
* response was received. Search back for the last probe before rcvdtime. */
probeI--;
} while (TIMEVAL_AFTER((*probeI)->sent, rcvdtime) && probeI != hss->probes_outstanding.begin());
ultrascan_host_probe_update(USI, hss, probeI, HOST_UP, &rcvdtime); ultrascan_host_probe_update(USI, hss, probeI, HOST_UP, &rcvdtime);
/* Now that we know the host is up, we can forget our other probes. */ /* Now that we know the host is up, we can forget our other probes. */
hss->destroyAllOutstandingProbes(); hss->destroyAllOutstandingProbes();
@@ -1666,7 +1670,11 @@ bool get_ns_result(UltraScanInfo *USI, struct timeval *stime) {
/* TODO: I suppose I should really mark the @@# host as up */ /* TODO: I suppose I should really mark the @@# host as up */
} }
probeI = hss->probes_outstanding.end(); probeI = hss->probes_outstanding.end();
probeI--; do {
/* Delay in libpcap could mean we sent another probe *after* this
* response was received. Search back for the last probe before rcvdtime. */
probeI--;
} while (TIMEVAL_AFTER((*probeI)->sent, rcvdtime) && probeI != hss->probes_outstanding.begin());
ultrascan_host_probe_update(USI, hss, probeI, HOST_UP, &rcvdtime); ultrascan_host_probe_update(USI, hss, probeI, HOST_UP, &rcvdtime);
/* Now that we know the host is up, we can forget our other probes. */ /* Now that we know the host is up, we can forget our other probes. */
hss->destroyAllOutstandingProbes(); hss->destroyAllOutstandingProbes();