mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 06:40:48 +00:00
Move around a few gettimeofday() calls, including where port scan timing
comparisons would be affected by debugging level: http://seclists.org/nmap-dev/2010/q2/373
This commit is contained in:
parent
3f7b440c49
commit
0be83cf063
2 changed files with 16 additions and 14 deletions
|
|
@ -1,5 +1,9 @@
|
|||
# Nmap Changelog ($Id$); -*-text-*-
|
||||
|
||||
o Fixed where the time variable used in port scanning for comparison
|
||||
to other times (for probe timeouts, etc) could result in different
|
||||
behavior based on the debugging level. [Kris]
|
||||
|
||||
o Moved the parse_long function from ncat to nbase for better reuse,
|
||||
and used it to simplify netmask parsing code. This patch was
|
||||
contributed by William Pursell.
|
||||
|
|
|
|||
|
|
@ -3575,13 +3575,12 @@ static void doAnyOutstandingRetransmits(UltraScanInfo *USI) {
|
|||
unsigned int maxtries;
|
||||
|
||||
struct timeval tv_start = {0};
|
||||
if (o.debugging) {
|
||||
gettimeofday(&USI->now, NULL);
|
||||
tv_start = USI->now;
|
||||
}
|
||||
|
||||
gettimeofday(&USI->now, NULL);
|
||||
|
||||
if (o.debugging)
|
||||
tv_start = USI->now;
|
||||
|
||||
/* Loop until we get through all the hosts without a retransmit or we're not
|
||||
OK to send any more. */
|
||||
do {
|
||||
|
|
@ -3634,10 +3633,9 @@ static void doAnyOutstandingRetransmits(UltraScanInfo *USI) {
|
|||
}
|
||||
} while (USI->gstats->sendOK(NULL) && retrans != 0);
|
||||
|
||||
gettimeofday(&USI->now, NULL);
|
||||
if (o.debugging) {
|
||||
long tv_diff;
|
||||
gettimeofday(&USI->now, NULL);
|
||||
tv_diff = TIMEVAL_MSEC_SUBTRACT(USI->now, tv_start);
|
||||
long tv_diff = TIMEVAL_MSEC_SUBTRACT(USI->now, tv_start);
|
||||
if (tv_diff > 30) log_write(LOG_PLAIN, "%s took %lims\n", __func__, tv_diff);
|
||||
}
|
||||
}
|
||||
|
|
@ -4948,11 +4946,12 @@ static void processData(UltraScanInfo *USI) {
|
|||
|
||||
bool tryno_capped = false, tryno_mayincrease = false;
|
||||
struct timeval tv_start = {0};
|
||||
if (o.debugging) {
|
||||
gettimeofday(&USI->now, NULL);
|
||||
|
||||
gettimeofday(&USI->now, NULL);
|
||||
|
||||
if (o.debugging)
|
||||
tv_start = USI->now;
|
||||
}
|
||||
|
||||
|
||||
/* First go through hosts and remove any completed ones from incompleteHosts */
|
||||
USI->removeCompletedHosts();
|
||||
if (USI->incompleteHostsEmpty())
|
||||
|
|
@ -5065,10 +5064,9 @@ static void processData(UltraScanInfo *USI) {
|
|||
}
|
||||
}
|
||||
|
||||
gettimeofday(&USI->now, NULL);
|
||||
if (o.debugging) {
|
||||
long tv_diff;
|
||||
gettimeofday(&USI->now, NULL);
|
||||
tv_diff = TIMEVAL_MSEC_SUBTRACT(USI->now, tv_start);
|
||||
long tv_diff = TIMEVAL_MSEC_SUBTRACT(USI->now, tv_start);
|
||||
if (tv_diff > 30) log_write(LOG_PLAIN, "%s took %lims\n", __func__, tv_diff);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue