Bug 1901780

Summary: incorrect time in ping statistics
Product: Red Hat Enterprise Linux 8 Reporter: Jing Huo <jhuo>
Component: iputilsAssignee: Jan Macku <jamacku>
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.2CC: fsumsal
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: iputils-20180629-3.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:06:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Fix incorrect statistics PATCH none

Description Jing Huo 2020-11-26 03:34:17 UTC
Description of problem:

incorrect "time" in ping statistics

Version-Release number of selected component (if applicable):

iputils-20180629-2.el8

How reproducible:


Steps to Reproduce:
1.ping any host
2.check the output
3."time" in ping statistics is incorrect

Actual results:

RHEL 8 :

# ping vm67
PING vm67 (192.168.122.142) 56(84) bytes of data.
64 bytes from vm67 (192.168.122.142): icmp_seq=1 ttl=64 time=0.692 ms
64 bytes from vm67 (192.168.122.142): icmp_seq=2 ttl=64 time=1.02 ms
64 bytes from vm67 (192.168.122.142): icmp_seq=3 ttl=64 time=1.06 ms
64 bytes from vm67 (192.168.122.142): icmp_seq=4 ttl=64 time=0.928 ms
64 bytes from vm67 (192.168.122.142): icmp_seq=5 ttl=64 time=0.520 ms
^C
--- vm67 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, ***time 10ms*** 
rtt min/avg/max/mdev = 0.520/0.842/1.058/0.207 ms

Expected results:

RHEL 7:

# ping vm67
PING vm67 (192.168.122.142) 56(84) bytes of data.
64 bytes from vm67 (192.168.122.142): icmp_seq=1 ttl=64 time=0.562 ms
64 bytes from vm67 (192.168.122.142): icmp_seq=2 ttl=64 time=0.677 ms
64 bytes from vm67 (192.168.122.142): icmp_seq=3 ttl=64 time=0.680 ms
64 bytes from vm67 (192.168.122.142): icmp_seq=4 ttl=64 time=0.383 ms
^C
--- vm67 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, ****time 3003ms****
rtt min/avg/max/mdev = 0.383/0.575/0.680/0.123 ms

Additional info:

~~source code~~

/RHEL-8/iputils/20180629/2.el8/iputils-s20180629/ping_common.c 

937 		printf(", time %ldms", (1000*tv.tv_sec+tv.tv_usec+500)/1000);
~~~~~~~~~~~~~~~

tv_sec is second
tv_usec is Microsecond

1000000 Microsecond = 1 second

So 1000*tv.tv_sec can't add tv.tv_usec directly.

Comment 1 Jan Macku 2020-11-27 08:24:05 UTC
This bug seems to be fixed in upstream and fedora.

I'll try to find out which upstream patch fixes this issue.

Comment 2 Jan Macku 2020-12-07 14:43:49 UTC
Created attachment 1737320 [details]
Fix incorrect statistics PATCH

Comment 9 errata-xmlrpc 2021-05-18 15:06:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (iputils bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1683