Nmap Development mailing list archives

Re: [PATCH] USI->now, gettimeofday() and debugging


From: David Fifield <david () bamsoftware com>
Date: Mon, 10 May 2010 17:41:29 -0600

On Wed, May 05, 2010 at 12:46:18PM -0500, Kris Katterjohn wrote:
Hey everyone,

The UltraScanInfo{} "now" member is used to keep the near-current time
so gettimeofday() doesn't have to be called over and over while port
scanning.  However I found a couple of places where "now" can vary
depending on if debugging is enabled.  I've attached a patch and
describe the changes below.

In processData(), "now" can be updated with gettimeofday if debugging
is enabled (but not otherwise) even just before using "now" to compare
times for probe timeout, moving a probe to the bench, etc.  So it seems
Nmap will behave differently here just based on debugging, which surely
doesn't seem correct.  Here I update "now" at the beginning regardless
of debugging.

In doAnyOutstandingRetransmits(), gettimeofday() is called for "now"
back to back if debugging is enabled, which also isn't good.  Here I
just reorder a few lines and have it called once.

The ends of both of these functions update "now" again only if
debugging is enabled, so I decided to do it update it either way so
following functions get the same time independent of debugging.

I don't think this causes any problems. It looks good.

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: