History log of /freebsd/sbin/ping/main.c (Results 1 – 17 of 17)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# b53ae8a8 12-Mar-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

ping: Fix protocol selection with NOINET6 kernel.

A missing else caused the correct resolver hint (AF_INET) to be
overwritten with AF_UNSPEC when the kernel supports IPv4 but not
IPv6.

MFC after: 3

ping: Fix protocol selection with NOINET6 kernel.

A missing else caused the correct resolver hint (AF_INET) to be
overwritten with AF_UNSPEC when the kernel supports IPv4 but not
IPv6.

MFC after: 3 days
PR: 277592
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D44304

show more ...


Revision tags: release/13.3.0
# 32e86a82 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sbin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remo

sbin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix

show more ...


Revision tags: release/14.0.0
# 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

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

show more ...


Revision tags: release/13.2.0, release/12.4.0
# 03d4d1c7 21-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

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

show more ...


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

ping: Simplify protocol selection.

* Interrupt the option loop as soon as we have an indication of which
protocol is intended.
* If we end up having to perform a DNS lookup, loop over the entire

ping: Simplify protocol selection.

* Interrupt the option loop as soon as we have an indication of which
protocol is intended.
* If we end up having to perform a DNS lookup, loop over the entire
result looking for either IPv4 or IPv6 addresses.

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

show more ...


# a2d13601 19-Sep-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

ping: The -C option is also supported for IPv6.

MFC after: 3 days
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: rscheff, allanjude
Differential Revision: https://reviews.freebsd.

ping: The -C option is also supported for IPv6.

MFC after: 3 days
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: rscheff, allanjude
Differential Revision: https://reviews.freebsd.org/D41881

show more ...


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

Remove $FreeBSD$: one-line .c pattern

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


# 9f2cddd2 08-Aug-2023 R. Christian McDonald <rcm@rcm.sh>

ping: use the in6_addr buffer when parsing src address as AF_INET6

Reviewed by: kp
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

show more ...


# 526e8a7d 01-Nov-2022 Jose Luis Duran <jlduran@gmail.com>

ping: main.c: Consistent use of white space/tabs

If a user has tabs set at a value other than 8, the output of the usage
may not be consistently aligned.

% tabs -2

Before:
% ping
usage

ping: main.c: Consistent use of white space/tabs

If a user has tabs set at a value other than 8, the output of the usage
may not be consistently aligned.

% tabs -2

Before:
% ping
usage:
ping [-4AaDdfHnoQqRrv] [-C pcp] [-c count] [-G sweepmaxsize]
[-g sweepminsize] [-h sweepincrsize] [-i wait] [-l preload]
[-M mask | time] [-m ttl] [-P policy] [-p pattern] [-S src_addr]
[-s packetsize] [-t timeout] [-W waittime] [-z tos] IPv4-host
ping [-4AaDdfHLnoQqRrv] [-C pcp] [-c count] [-I iface] [-i wait]
[-l preload] [-M mask | time] [-m ttl] [-P policy] [-p pattern]
[-S src_addr] [-s packetsize] [-T ttl] [-t timeout] [-W waittime]
[-z tos] IPv4-mcast-group
ping [-6AaDdfHnNoOquvyY] [-b bufsiz] [-c count] [-e gateway]
[-I interface] [-i wait] [-k addrtype] [-l preload] [-m hoplimit]
[-p pattern] [-P policy] [-S sourceaddr] [-s packetsize] [-t timeout]
[-W waittime] [-z tclass] [IPv6-hops ...] IPv6-host

After:
% ping
usage:
ping [-4AaDdfHnoQqRrv] [-C pcp] [-c count] [-G sweepmaxsize]
[-g sweepminsize] [-h sweepincrsize] [-i wait] [-l preload]
[-M mask | time] [-m ttl] [-P policy] [-p pattern] [-S src_addr]
[-s packetsize] [-t timeout] [-W waittime] [-z tos] IPv4-host
ping [-4AaDdfHLnoQqRrv] [-C pcp] [-c count] [-I iface] [-i wait]
[-l preload] [-M mask | time] [-m ttl] [-P policy] [-p pattern]
[-S src_addr] [-s packetsize] [-T ttl] [-t timeout] [-W waittime]
[-z tos] IPv4-mcast-group
ping [-6AaDdfHnNoOquvyY] [-b bufsiz] [-c count] [-e gateway]
[-I interface] [-i wait] [-k addrtype] [-l preload] [-m hoplimit]
[-p pattern] [-P policy] [-S sourceaddr] [-s packetsize] [-t timeout]
[-W waittime] [-z tclass] [IPv6-hops ...] IPv6-host

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

show more ...


# 5af718a5 20-May-2022 Mike Karels <karels@FreeBSD.org>

ping: if -S srcaddr uses a numeric address, use that protocol

The command "ping -S dotted.quad hostname" fails on dual-stack hosts
with the confusing message "ping: invalid source address: Name does

ping: if -S srcaddr uses a numeric address, use that protocol

The command "ping -S dotted.quad hostname" fails on dual-stack hosts
with the confusing message "ping: invalid source address: Name does
not resolve" because IPv6 is selected in preference. If the argument
to -S is numeric (likely), select the corresponding address family,
as if -4 or -6 was specified. Add tests that either IPv4 or IPv6 can
be forced via a -S parameter.

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

show more ...


Revision tags: release/13.1.0, release/12.3.0
# a4ef9e58 28-Nov-2021 Ed Maste <emaste@FreeBSD.org>

sbin: build ping if at least one of INET & INET6 is enabled

It does not build (and serves no purpose) if neither is true (i.e.,
building WITHOUT_INET and WITHOUT_INET6). Also add an explicit error

sbin: build ping if at least one of INET & INET6 is enabled

It does not build (and serves no purpose) if neither is true (i.e.,
building WITHOUT_INET and WITHOUT_INET6). Also add an explicit error
in ping to make this case clear.

PR: 260082
Sponsored by: The FreeBSD Foundation

show more ...


# 9ce201f2 07-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

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

show more ...


Revision tags: release/13.0.0
# b586c66b 01-Jan-2021 Alan Somers <asomers@FreeBSD.org>

ping: fix ping when the kernel was built without INET6

If the kernel was built without INET6, default to ICMP. Or, if it was
built without INET, default to ICMPv6.

PR: 251725
Reported by: jbeich

ping: fix ping when the kernel was built without INET6

If the kernel was built without INET6, default to ICMP. Or, if it was
built without INET, default to ICMPv6.

PR: 251725
Reported by: jbeich
Reviewed by: jbeich
Tested by: jbeich
MFC with: 368045

show more ...


# fd26389b 29-Nov-2020 Alan Somers <asomers@FreeBSD.org>

ping: allow building without INET support

Building without INET6 support was already possible. Now it's possible to
build ping with only INET6, or even with neither INET nor INET6.

Reported by: bz

ping: allow building without INET support

Building without INET6 support was already possible. Now it's possible to
build ping with only INET6, or even with neither INET nor INET6.

Reported by: bz
Reviewed by: bz
MFC-With: 368045
Differential Revision: https://reviews.freebsd.org/D27394

show more ...


# d2624517 26-Nov-2020 Alan Somers <asomers@FreeBSD.org>

ping: add a ping6 hard link for backwards compatibility

When invoked as "ping6", ping will now attempt to use ICMPv6 for hostnames
that resolve both IPv4 and IPv6 addresses.

Reviewed by: bz, manu
M

ping: add a ping6 hard link for backwards compatibility

When invoked as "ping6", ping will now attempt to use ICMPv6 for hostnames
that resolve both IPv4 and IPv6 addresses.

Reviewed by: bz, manu
MFC-With: r368045
Differential Revision: https://reviews.freebsd.org/D27384

show more ...


# 3cde9171 26-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

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

show more ...