mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 14:11:29 +00:00
Start timeout clocks closer to first probe, not in batches. Closes #1150
This commit is contained in:
@@ -2035,6 +2035,15 @@ static bool ultrascan_host_pspec_update(UltraScanInfo *USI, HostScanStats *hss,
|
||||
return hss->target->flags != oldstate;
|
||||
}
|
||||
|
||||
static void ultrascan_host_timeout_init(UltraScanInfo *USI, HostScanStats *hss) {
|
||||
if (!hss->target->timeOutClockRunning() && !hss->target->timedOut(NULL)) {
|
||||
if (o.debugging > 2) {
|
||||
log_write(LOG_STDOUT, "Ultrascan timeout init for %s at %.6f\n", hss->target->targetipstr(), TIMEVAL_SECS(USI->now));
|
||||
}
|
||||
hss->target->startTimeOutClock(&USI->now);
|
||||
}
|
||||
}
|
||||
|
||||
/* Called when a new status is determined for host in hss (eg. it is
|
||||
found to be up or down by a ping/ping_arp scan. The probe that led
|
||||
to this new decision is in probeI. This function needs to update
|
||||
@@ -2255,6 +2264,7 @@ static void doAnyNewProbes(UltraScanInfo *USI) {
|
||||
hss = USI->nextIncompleteHost();
|
||||
while (hss != NULL && hss != unableToSend && USI->gstats->sendOK(NULL)) {
|
||||
if (hss->freshPortsLeft() && hss->sendOK(NULL)) {
|
||||
ultrascan_host_timeout_init(USI, hss);
|
||||
sendNextScanProbe(USI, hss);
|
||||
unableToSend = NULL;
|
||||
} else if (unableToSend == NULL) {
|
||||
@@ -2688,18 +2698,6 @@ static void processData(UltraScanInfo *USI) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Start the timeout clocks of any targets that aren't already timedout */
|
||||
static void startTimeOutClocks(std::vector<Target *> &Targets) {
|
||||
struct timeval tv;
|
||||
std::vector<Target *>::iterator hostI;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
for (hostI = Targets.begin(); hostI != Targets.end(); hostI++) {
|
||||
if (!(*hostI)->timedOut(NULL))
|
||||
(*hostI)->startTimeOutClock(&tv);
|
||||
}
|
||||
}
|
||||
|
||||
/* 3rd generation Nmap scanning function. Handles most Nmap port scan types.
|
||||
|
||||
The parameter to gives group timing information, and if it is not NULL,
|
||||
@@ -2730,7 +2728,6 @@ void ultra_scan(std::vector<Target *> &Targets, struct scan_lists *ports,
|
||||
// Set the variable for status printing
|
||||
o.numhosts_scanning = Targets.size();
|
||||
|
||||
startTimeOutClocks(Targets);
|
||||
UltraScanInfo USI(Targets, ports, scantype);
|
||||
|
||||
/* Use the requested timeouts. */
|
||||
|
||||
Reference in New Issue
Block a user