Nmap Development mailing list archives

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


From: Kris Katterjohn <katterjohn () gmail com>
Date: Mon, 10 May 2010 22:24:13 -0500

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

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.


Thanks, David.  I've committed this as r17532.

David Fifield

Cheers,
Kris Katterjohn

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAEBAgAGBQJL6M3dAAoJEEQxgFs5kUfurCQQAJ9WllQ3RG8UzxVS7twY8N6V
FSm3tRUFQCLM6n755OFDmY2z41VygsFiyJcbLhUqza+iWBIOPe97aLKdYB7H1Wx+
eWDUigZPhLbiyXzGpzCZRqtc848lH45LOVGwPymbQBM551nANUL+jPM9MRbPkO68
a8Ma9l5h2NNkx8/CcZpiLSUgeuIQSHyG9WY0cTCGGXfHG3ASBjFytCNpxfLG7pYo
2cwY0GAenAN2sEhmLYqFMOwOE88ArFpJCyJCtVbsR8kIX8fmCF4Gm+tJVVp5tijJ
2TXOUj5GT2mB5Ex/rSQOkJP88uHmZphUYDbxOOqVvVc9RfTHiD8pNH0Qai+4FEdY
OxMbgoCuDeov3//GtWqe33nPgDw6XQ5xJ5vvf/vT8e6wtYDBh/cKlBZTbSjSr7Ik
RmjndG+wZAZD/XQU2+T0Zbrj8i8ZveR0npJ1nOwKMYJQTubFJeLt1ma++ijcu3fX
PYVioMj2NPidTpriqc9E2SKlURzya4gzry2TJoZiN8rw6EbDb7PuCZAKZi9kXDCQ
gd2z/uLXqL51EMd1//DRoCvnMpfLT2FjQugNFGwa3YO0RRILwI5S99L6wMmJmTcW
vsBh79nOFABFJ4HLGVA8Drp3d6b7XL/knjS5XyHxFOnMLFackecbUmRHu1kviLHe
j3qY1GtwGDp6YdjP3e9c
=r15p
-----END PGP SIGNATURE-----
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: