freebsd-src/sbin/ping
Jose Luis Duran 03d4d1c778 ping: Unify ping/ping6 statistics section
This is a first step towards a unification/simplification of ping/ping6
(internally).  The end goal is to produce a standardized user-facing
output.

Before (ping6):

    PING6(56=40+8+8 bytes) 2001:db8::1 --> 2001:db8::2
    16 bytes from ::1, icmp_seq=0 hlim=64 time=0.168 ms
    16 bytes from ::1, icmp_seq=1 hlim=64 time=0.068 ms

    --- 2001:db8::2 ping6 statistics ---
    round-trip min/avg/max/std-dev = 0.068/0.118/0.168/0.050 ms

After (ping6):

    PING(56=40+8+8 bytes) 2001:db8::1 --> 2001:db8::2
    16 bytes from ::1, icmp_seq=0 hlim=64 time=0.168 ms
    16 bytes from ::1, icmp_seq=1 hlim=64 time=0.068 ms

    --- 2001:db8::2 ping statistics ---
    round-trip min/avg/max/stddev = 0.068/0.118/0.168/0.050 ms

This has the nice side-effect of adding units to SIGINFO's statistics,
as printing numbers without units may not be of much help.  Also
mentions the fact that these times are round-trip.

Before (ping/ping6 SIGINFO):

    2/2 packets received (100.0%) 0.068 min / 0.118 avg / 0.168 max

After (ping/ping6 SIGINFO):

    --- <ipv4/ipv6 address> ping statistics ---
    2 packets transmitted, 2 packets received, 0.0% packet loss
    round-trip min/avg/max/stddev = 0.068/0.118/0.168/0.050 ms

In the case of a SIGINFO, the output will be printed to stderr, for both
ping and ping6.

Reviewed by:	markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/863
Differential Revision:	https://reviews.freebsd.org/D39126
2023-10-11 13:48:28 -04:00
..
tests ping: Unify ping/ping6 statistics section 2023-10-11 13:48:28 -04:00
main.c ping: Unify ping/ping6 statistics section 2023-10-11 13:48:28 -04:00
main.h ping: Unify ping/ping6 statistics section 2023-10-11 13:48:28 -04:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend.options Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
ping.8 ping: The -C option is also supported for IPv6. 2023-09-19 10:47:11 +02:00
ping.c ping: Unify ping/ping6 statistics section 2023-10-11 13:48:28 -04:00
ping.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
ping6.c ping: Unify ping/ping6 statistics section 2023-10-11 13:48:28 -04:00
ping6.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
utils.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
utils.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00