Bug 192417 - counter overflows in ping(8)
Summary: counter overflows in ping(8)
Status: Closed Unable to Reproduce
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.0-STABLE
Hardware: amd64 Any
: --- Affects Many People
Assignee: Gavin Atkinson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-06 06:26 UTC by Dmitry Sivachenko
Modified: 2023-03-19 16:33 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Sivachenko freebsd_committer freebsd_triage 2014-08-06 06:26:27 UTC
After leaving ping(8) running for several hours, I get the following statistics:

50199 packets transmitted, 50194 packets received, +5 duplicates, 0.0% packet loss
round-trip min/avg/max/stddev = -1120352444249.007/-111591111.331/237.479/11180738897.087 ms

Looks like some variables overflow.
Comment 1 Gavin Atkinson freebsd_committer freebsd_triage 2014-08-29 16:37:43 UTC
Hi,

I've been trying to recreate this, and can't - despite leaving ping running for several days I have not managed to get anything to overflow.  Are you using a 32- or 64-bit host?

Is it possible that the system time may have stepped back whilst the ping was running?

Thanks,

Gavin
Comment 2 Dmitry Sivachenko freebsd_committer freebsd_triage 2014-08-29 16:51:51 UTC
(In reply to Gavin Atkinson from comment #1)
> Hi,
> 
> I've been trying to recreate this, and can't - despite leaving ping running
> for several days I have not managed to get anything to overflow.  Are you
> using a 32- or 64-bit host?


This is amd64 (as stated in bug report).


> 
> Is it possible that the system time may have stepped back whilst the ping
> was running?
> 


Hard to tell now, I have ntpd running.
Comment 3 Gavin Atkinson freebsd_committer freebsd_triage 2015-02-24 19:38:08 UTC
I've now had a ping running for five months, and haven't managed to produce any sort of overflow or similar that would produce the issue you saw.  However, I can't find any other way of explaining it, either.  -1120352444249 ms is ~35 years, it seems likely that you'd notice a jump of that size :)
Comment 4 Dmitry Sivachenko freebsd_committer freebsd_triage 2015-02-24 20:31:59 UTC
Well, I observed this after about 1 day or running (+-), so may be you are right and ntpd stepped time back a bit?  If this is a possible cause, then it is probably wise to close this PR.  I never encountered the same after that.
Comment 5 Jose Luis Duran 2023-02-10 01:10:47 UTC
I have created: https://reviews.freebsd.org/D38480 , which attempt to fix the current behavior.
Comment 6 commit-hook freebsd_committer freebsd_triage 2023-03-19 16:33:55 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=ea6d16926666a717e2c0a898b954d1477ac34804

commit ea6d16926666a717e2c0a898b954d1477ac34804
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2023-02-09 23:38:54 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-03-19 16:24:06 +0000

    ping: Avoid reporting negative time statistics

    Display a warning when the time goes back.

    PR:             192417
    Reviewed by:    markj
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D38480

 sbin/ping/ping.c             |  8 +++++++-
 sbin/ping/tests/test_ping.py | 30 +++++++++++++++++++++++++++++-
 2 files changed, 36 insertions(+), 2 deletions(-)