mirror of
https://github.com/nmap/nmap.git
synced 2026-01-03 05:09:14 +00:00
Send global pings when num_probes_active == 0, not when
num_probes_outstanding() == 0. The active probes are probes that haven't timed out; the outstanding probes includes those and some timed-out probes. When a host makes it to the completed list with outstanding probes, it is unlikely they will ever be removed, so we weren't sending any global pings in some cases. A host only moves to the completed list with it has no active probes, and any active probes it has after that are global pings. Also remove only timed-out ping probes from the ping host. All other probes are timed out but waiting for a response.
This commit is contained in:
@@ -2617,7 +2617,7 @@ static void ultrascan_host_probe_update(UltraScanInfo *USI, HostScanStats *hss,
|
||||
/* Make this the new global ping host, but only if the old one is not
|
||||
waiting for any probes. */
|
||||
if (USI->gstats->pinghost == NULL
|
||||
|| USI->gstats->pinghost->probes_outstanding_empty()) {
|
||||
|| USI->gstats->pinghost->num_probes_active == 0) {
|
||||
if (o.debugging > 1)
|
||||
log_write(LOG_PLAIN, "Changing global ping host to %s.\n", hss->target->targetipstr());
|
||||
USI->gstats->pinghost = hss;
|
||||
@@ -3175,7 +3175,7 @@ static void doAnyPings(UltraScanInfo *USI) {
|
||||
|
||||
/* Next come global pings. We never send more than one of these at at time. */
|
||||
if (USI->gstats->pinghost != NULL && USI->gstats->pinghost->target->pingprobe_state != PORT_UNKNOWN &&
|
||||
USI->gstats->pinghost->probes_outstanding_empty() &&
|
||||
USI->gstats->pinghost->num_probes_active == 0 &&
|
||||
USI->gstats->probes_sent >= USI->gstats->lastping_sent_numprobes + 20 &&
|
||||
TIMEVAL_SUBTRACT(USI->now, USI->gstats->lastrcvd) > USI->perf.pingtime &&
|
||||
TIMEVAL_SUBTRACT(USI->now, USI->gstats->lastping_sent) > USI->perf.pingtime &&
|
||||
@@ -4800,7 +4800,8 @@ static void processData(UltraScanInfo *USI) {
|
||||
nextProbeI++;
|
||||
/* If a global ping probe times out, we want to get rid of it so a new
|
||||
host can take its place. */
|
||||
if (TIMEVAL_SUBTRACT(USI->now, (*probeI)->sent) > (long) pinghost->probeTimeout()) {
|
||||
if ((*probeI)->isPing()
|
||||
&& TIMEVAL_SUBTRACT(USI->now, (*probeI)->sent) > (long) pinghost->probeTimeout()) {
|
||||
if (o.debugging)
|
||||
log_write(LOG_STDOUT, "Destroying timed-out global ping from %s.\n", pinghost->target->targetipstr());
|
||||
pinghost->destroyOutstandingProbe(probeI);
|
||||
|
||||
Reference in New Issue
Block a user