ping counter overflow

Gerald Heinig gheinig at syskonnect.de
Mon Dec 6 06:32:22 PST 2004


Hi all,

I've run into a possible bug in ping(8) while investigating a strange 
duplicate packet effect in our driver.
The effect shows up on other drivers and I believe it's due to a counter 
overflow in ping.
Basically, leave ping -f on a gigabit link for a few days (for medium to 
large values of "a few", ie. at least 3 or 4). Stop the ping and get 
lots of duplicate packets.
I changed the 5 counter variables (nmissedmax, npackets, nreceived, 
nrepeats, ntransmitted) to short (from long) to reduce the time taken to 
overflow and managed to get the effect very easily - it takes about 3 
seconds on a gigabit link.
Changing these variables to their unsigned counterparts solved the problem.
My question: shouldn't these counters be unsigned? (ie. unsigned long, 
instead of long)

Regards,
Gerald


More information about the freebsd-net mailing list