Both negative and large positive round-trip times may hang ping(8)
because of integer overflows in the statistics code.

This patch will cause ping not to print statistics if a negative RTT
is encountered or an overflow occurs during accumulation of
statistics:

http://www.durlej.net/pingneg.diff

To reproduce:

# ping -c25 wormhole.durlej.net.
PING wormhole.durlej.net (91.228.198.188): 56 data bytes
64 bytes from 91.228.198.188: icmp_seq=0 ttl=255 time=-998999.-802 ms
64 bytes from 91.228.198.188: icmp_seq=1 ttl=255 time=-998999.-790 ms
64 bytes from 91.228.198.188: icmp_seq=2 ttl=255 time=-998999.-790 ms
64 bytes from 91.228.198.188: icmp_seq=3 ttl=255 time=-998999.-789 ms
64 bytes from 91.228.198.188: icmp_seq=4 ttl=255 time=-998999.-793 ms
64 bytes from 91.228.198.188: icmp_seq=5 ttl=255 time=-998999.-786 ms
64 bytes from 91.228.198.188: icmp_seq=6 ttl=255 time=-998999.-787 ms
64 bytes from 91.228.198.188: icmp_seq=7 ttl=255 time=-998999.-781 ms
64 bytes from 91.228.198.188: icmp_seq=8 ttl=255 time=-998999.-786 ms
64 bytes from 91.228.198.188: icmp_seq=9 ttl=255 time=-998999.-785 ms
64 bytes from 91.228.198.188: icmp_seq=10 ttl=255 time=-998999.-780 ms
64 bytes from 91.228.198.188: icmp_seq=11 ttl=255 time=-998999.-783 ms
64 bytes from 91.228.198.188: icmp_seq=12 ttl=255 time=-998999.-785 ms
64 bytes from 91.228.198.188: icmp_seq=13 ttl=255 time=-998999.-785 ms
64 bytes from 91.228.198.188: icmp_seq=14 ttl=255 time=-998999.-782 ms
64 bytes from 91.228.198.188: icmp_seq=15 ttl=255 time=-998999.-777 ms
64 bytes from 91.228.198.188: icmp_seq=16 ttl=255 time=-998999.-794 ms
64 bytes from 91.228.198.188: icmp_seq=17 ttl=255 time=-998999.-785 ms
64 bytes from 91.228.198.188: icmp_seq=18 ttl=255 time=-998999.-789 ms
64 bytes from 91.228.198.188: icmp_seq=19 ttl=255 time=-998999.-784 ms
64 bytes from 91.228.198.188: icmp_seq=20 ttl=255 time=-998999.-816 ms
64 bytes from 91.228.198.188: icmp_seq=21 ttl=255 time=-998999.-784 ms
64 bytes from 91.228.198.188: icmp_seq=22 ttl=255 time=-998999.-785 ms
64 bytes from 91.228.198.188: icmp_seq=23 ttl=255 time=-998999.-791 ms
64 bytes from 91.228.198.188: icmp_seq=24 ttl=255 time=-998999.-785 ms
^C^\Quit 

# 

Regards,
Piotr

Reply via email to