1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-14 18:39:03 +00:00

Short-circuit HostScanStats::completed in host discovery: once we know the host

is up or down, we can move it to the completed list, regardless of any active
probes. However I can imagine changing this so that we move it when it is found
up, or when it is found down and there are no probes left to send. That would
give a down host a chance to become up with a different probe later on.
This commit is contained in:
david
2009-01-03 22:04:43 +00:00
parent b0b0c0926a
commit 6998d72ccc

View File

@@ -2172,18 +2172,18 @@ void HostScanStats::markProbeTimedout(list<UltraProbe *>::iterator probeI) {
}
bool HostScanStats::completed() {
/* If there are probes active or awaiting retransmission, we are not done. */
if (num_probes_active != 0 || num_probes_waiting_retransmit != 0
|| !probe_bench.empty() || !retry_stack.empty()) {
return false;
}
/* With ping scan, we are done once we know the host is up or down. */
if (USI->ping_scan && ((target->flags & HOST_UP)
|| (target->flags & HOST_DOWN) || target->weird_responses)) {
return true;
}
/* If there are probes active or awaiting retransmission, we are not done. */
if (num_probes_active != 0 || num_probes_waiting_retransmit != 0
|| !probe_bench.empty() || !retry_stack.empty()) {
return false;
}
/* With other types of scan, we are done when there are no more ports to
probe. */
return freshPortsLeft() == 0;