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
This commit is contained in:
parent
3d3de5ce17
commit
f759f2c261
@ -37,8 +37,6 @@
|
|||||||
# done
|
# done
|
||||||
|
|
||||||
# 20201124: ping6(8) was merged into ping(8)
|
# 20201124: ping6(8) was merged into ping(8)
|
||||||
OLD_FILES+=sbin/ping6
|
|
||||||
OLD_FILES+=rescue/ping6
|
|
||||||
OLD_FILES+=usr/lib/debug/sbin/ping6.debug
|
OLD_FILES+=usr/lib/debug/sbin/ping6.debug
|
||||||
OLD_FILES+=usr/share/man/man8/ping6.8.gz
|
OLD_FILES+=usr/share/man/man8/ping6.8.gz
|
||||||
OLD_FILES+=usr/tests/sbin/ping6/Kyuafile
|
OLD_FILES+=usr/tests/sbin/ping6/Kyuafile
|
||||||
|
@ -103,6 +103,7 @@ CRUNCH_PROGS_sbin+= ccdconfig
|
|||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MK_INET6_SUPPORT} != "no"
|
.if ${MK_INET6_SUPPORT} != "no"
|
||||||
|
CRUNCH_ALIAS_ping= ping6
|
||||||
CRUNCH_PROGS_sbin+= rtsol
|
CRUNCH_PROGS_sbin+= rtsol
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ LIBADD= m
|
|||||||
CFLAGS+= -DINET6 -DKAME_SCOPEID
|
CFLAGS+= -DINET6 -DKAME_SCOPEID
|
||||||
SRCS+= ping6.c
|
SRCS+= ping6.c
|
||||||
LIBADD+= md
|
LIBADD+= md
|
||||||
|
LINKS= ${BINDIR}/ping ${BINDIR}/ping6
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MK_DYNAMICROOT} == "no"
|
.if ${MK_DYNAMICROOT} == "no"
|
||||||
|
@ -66,6 +66,9 @@ main(int argc, char *argv[])
|
|||||||
struct in6_addr a6;
|
struct in6_addr a6;
|
||||||
bool ipv6;
|
bool ipv6;
|
||||||
|
|
||||||
|
if (strcmp(getprogname(), "ping6") == 0)
|
||||||
|
ipv6 = true;
|
||||||
|
else
|
||||||
ipv6 = false;
|
ipv6 = false;
|
||||||
#endif
|
#endif
|
||||||
ipv4 = false;
|
ipv4 = false;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
.\" @(#)ping.8 8.2 (Berkeley) 12/11/93
|
.\" @(#)ping.8 8.2 (Berkeley) 12/11/93
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd November 24, 2020
|
.Dd November 26, 2020
|
||||||
.Dt PING 8
|
.Dt PING 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -141,6 +141,9 @@ the specific IP version can be requested by
|
|||||||
or
|
or
|
||||||
.Fl 6
|
.Fl 6
|
||||||
options, respectively.
|
options, respectively.
|
||||||
|
For backwards-compatibility, ICMPv6 can also be selected by invoking the binary
|
||||||
|
as
|
||||||
|
.Nm ping6 .
|
||||||
.Ss Options common to both IPv4 and IPv6 targets
|
.Ss Options common to both IPv4 and IPv6 targets
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
.It Fl A
|
.It Fl A
|
||||||
|
@ -53,9 +53,23 @@ ping_6_c1_s8_t1_body() {
|
|||||||
check_ping_statistics std.out $(atf_get_srcdir)/ping_6_c1_s8_t1.out
|
check_ping_statistics std.out $(atf_get_srcdir)/ping_6_c1_s8_t1.out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
atf_test_case ping6_c1_s8_t1
|
||||||
|
ping6_c1_s8_t1_head() {
|
||||||
|
atf_set "descr" "Use IPv6 when invoked as ping6"
|
||||||
|
}
|
||||||
|
ping6_c1_s8_t1_body() {
|
||||||
|
if ! getaddrinfo -f inet6 localhost 1>/dev/null 2>&1; then
|
||||||
|
atf_skip "IPv6 is not configured"
|
||||||
|
fi
|
||||||
|
atf_check -s exit:0 -o save:std.out -e empty \
|
||||||
|
ping6 -c 1 -s 8 -t 1 localhost
|
||||||
|
check_ping_statistics std.out $(atf_get_srcdir)/ping_6_c1_s8_t1.out
|
||||||
|
}
|
||||||
|
|
||||||
atf_init_test_cases() {
|
atf_init_test_cases() {
|
||||||
atf_add_test_case ping_c1_s56_t1
|
atf_add_test_case ping_c1_s56_t1
|
||||||
atf_add_test_case ping_6_c1_s8_t1
|
atf_add_test_case ping_6_c1_s8_t1
|
||||||
|
atf_add_test_case ping6_c1_s8_t1
|
||||||
}
|
}
|
||||||
|
|
||||||
check_ping_statistics() {
|
check_ping_statistics() {
|
||||||
|
@ -2583,6 +2583,7 @@ OLD_DIRS+=usr/share/i18n/csmapper/GB
|
|||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MK_INET6} == no
|
.if ${MK_INET6} == no
|
||||||
|
OLD_FILES+=sbin/ping6
|
||||||
OLD_FILES+=sbin/rtsol
|
OLD_FILES+=sbin/rtsol
|
||||||
OLD_FILES+=usr/sbin/ip6addrctl
|
OLD_FILES+=usr/sbin/ip6addrctl
|
||||||
OLD_FILES+=usr/sbin/mld6query
|
OLD_FILES+=usr/sbin/mld6query
|
||||||
@ -2611,6 +2612,7 @@ OLD_FILES+=usr/share/man/man8/traceroute6.8.gz
|
|||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MK_INET6_SUPPORT} == no
|
.if ${MK_INET6_SUPPORT} == no
|
||||||
|
OLD_FILES+=rescue/ping6
|
||||||
OLD_FILES+=rescue/rtsol
|
OLD_FILES+=rescue/rtsol
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user