Nmap Development mailing list archives

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


From: Kris Katterjohn <katterjohn () gmail com>
Date: Wed, 5 May 2010 12:46:18 -0500

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

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.

Does this create any problems that I'm not seeing?

Cheers,
Kris Katterjohn

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

iQIcBAEBAgAGBQJL4a7qAAoJEEQxgFs5kUfuWVoQAK/BcPVNYT6WwAnGVaLEg8Jz
+A3fjKi+zbZHaonr9zx1nInAfnrLjxh77urZsiooxqSNyw+fqR9Xbqpk8vO8qydP
9ahC4/Ye4KrJDyGWvcuSjCMDYbP69qjPovXiZUJnThind6RSRwSkCWB8eBVLP9Cd
LX2Nu2L1D6pENZJnoe+C0rCBkrloW3YqJwstItgV2F0606prZiFC/QvMlccb0LV4
1/3AHSuUJWmdtFd+P+tnDBflaLWdyQ9bwz0TmNsrL0yzWfNTbefbvQOc8qrtRLBp
bdeSHQ2cKcdo7PHZr5+ycrCXD2zkKB3dBYmeGI61UgBDSjl5qhq5cDBhpZVKRNWf
6PkR2Ho7ymlENvKwfqAKHj/6INEOHxmM9BA8ELhshK9p1vmUJfeEujTh/9RwE4Ey
QoFxLNC+GnupzHmM3ITnxWq2da1xMLEOjwj7ZzykNTokCuEwhBXMaf/7vuiBn5lc
wQljYFUZ28uH6FY8rRti1eqZvhS5FispOTVR7kxuArUd+1GTvr3lNTmGnNqSU8Ly
k9M8E42VWPnQHXZLNA3LUBtnsyKiv++fs/0kspmwR46O+9/i+C15Hauobpdu6rjZ
Z6u+IwFXC9DjzfTtzhgIs1e/2tAgBVadVm2PQecoyZFM2AitNaE812S75aEPkjEz
HBhhOTjGzSk7+uVU0Thm
=78b1
-----END PGP SIGNATURE-----

Attachment: gettimeofday.patch
Description:

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

Current thread: