Nmap Development mailing list archives
Packet rate logging and division by zero
From: jah <jah () zadkiel plus com>
Date: Wed, 17 Dec 2008 01:39:40 +0000
Hi folks,
Overall sending rates: *1.#J* packets / s.
I've only been able to reproduce this on windows and it's fairly easy to
do with a connect scan to localhost (it doesn't always happen). It
occurs before any packets are sent at the start of a scan after TIMING
STATS are printed.
double RateMeter::getOverallRate(const struct timeval *now) const {
return total / elapsedTime(now);
}
if elapsedTime() returns 0, then RateMeter::getOverallRate returns
double "1.#INF000000000000" which somehow is turned into 1.#J by a %.2f
format string.
The attached timing.cc.patch will prevent division by zero and instead
return 0.
Regards,
jah
--- timing.cc.orig 2008-12-17 01:28:14.828125000 +0000
+++ timing.cc 2008-12-17 01:13:54.046875000 +0000
@@ -349,7 +349,8 @@
}
double RateMeter::getOverallRate(const struct timeval *now) const {
- return total / elapsedTime(now);
+ double et_now = elapsedTime(now);
+ return et_now ? total / et_now : 0;
}
/* Get the "current" rate (actually a moving average of the last
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- Packet rate logging and division by zero jah (Dec 16)
- Re: Packet rate logging and division by zero Brandon Enright (Dec 16)
- Re: Packet rate logging and division by zero jah (Dec 16)
- Re: Packet rate logging and division by zero jah (Dec 16)
- Re: Packet rate logging and division by zero David Fifield (Dec 16)
- Re: Packet rate logging and division by zero Brandon Enright (Dec 16)
