History log of /freebsd-current/sbin/ping/ping6.c
Revision Date Author Comments
# e9866ce8 30-Dec-2023 Hao-Yu Hou <howard.hou.fan@elsa.cs.nthu.edu.tw>

ping(8): Fix typo in ping6.c

Line 703 & 863: kerel -> kernel
Line 2110: resposne -> response

Event: Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request: https://github.com/freebsd/freebsd-src/pull/967


# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix


# 51e16cb8 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

sbin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# c4ffb80e 11-Oct-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

ping: Consistently use EX_NOHOST for DNS failures.

Traditionally, ping returned exit code EX_NOHOST if a DNS lookup failed.
That is still the case for the legacy code in the new merged ping, but
not for IPv6 targets, nor when a DNS lookup is performed in order to
determine which version of the tool to invoke.

While here, also make sure that the error message is consistent.

Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D42159


# 03d4d1c7 20-Nov-2022 Jose Luis Duran <jlduran@gmail.com>

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


# 4d348e83 06-Oct-2023 Jose Luis Duran <jlduran@gmail.com>

ping: Avoid reporting NaNs

Avoid calculating the square root of negative zero, which can easily
happen on certain architectures when calculating the population standard
deviation with a sample size of one, e.g., 0.01 - (0.1 * 0.1) =
-0.000000.

Avoid returning a NaN by capping the minimum possible variance value to
zero (positive).

In the future, maybe skip reporting statistics at all for a single
sample.

Reported by: Jenkins
Reviewed by: asomers
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/863
Differential Revision: https://reviews.freebsd.org/D42114


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# f32d6f74 14-Mar-2023 Jose Luis Duran <jlduran@gmail.com>

ping6: Use errx to avoid appending a specious error message

Reviewed by: asomers, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38418


# eec35f1f 04-Sep-2022 Gordon Bergling <gbe@FreeBSD.org>

ping(8): Correct a typo in source code comment

- s/occured/occurred/

MFC after: 3 days


# d399eb3e 11-Apr-2022 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

ping: split the visual part of -f into a new option -.

After this, we'll be able to ping a host and not spam the terminal, and
no flooding will have to be involved. I've been doing this under Linux
as ping -fi1 host.

Reviewed by: rpokala, Pau Amma
Differential Revision: https://reviews.freebsd.org/D34882


# 9ce201f2 06-Oct-2021 Alan Somers <asomers@FreeBSD.org>

ping: fix parsing of options including '4' and '6'

ping uses a two-pass option parser. The first pass determines whether
ipv4 or ipv6 is desired, and the second parses the rest of the options.
But the first pass wrongly detects a '4' or '6' in an option's value as
a request to use ipv6 or ipv6 respectively, for example in an invocation
like "ping -c6 1.2.3.4".

Fix this confusion by including all options in the first round of
parsing, but ignoring those unrelated to ipv4/ipv6 selection.

PR: 258048
Reported by: ghuckriede@blackberry.com
Submitted by: ghuckriede@blackberry.com
MFC after: 2 weeks
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D32344


# 3cde9171 25-Nov-2020 Alan Somers <asomers@FreeBSD.org>

Merge ping6 to ping

There is now a single ping binary, which chooses to use ICMP or ICMPv4
based on the -4 and -6 options, and the format of the address.

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google LLC (Google Summer of Code 2019)
MFC after: Never
Differential Revision: https://reviews.freebsd.org/D21377