Index: ObsoleteFiles.inc =================================================================== --- ObsoleteFiles.inc +++ ObsoleteFiles.inc @@ -37,7 +37,6 @@ # done # 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/share/man/man8/ping6.8.gz Index: sbin/ping/Makefile =================================================================== --- sbin/ping/Makefile +++ sbin/ping/Makefile @@ -15,6 +15,7 @@ CFLAGS+= -DINET6 -DKAME_SCOPEID SRCS+= ping6.c LIBADD+= md +LINKS= ${BINDIR}/ping ${BINDIR}/ping6 .endif .if ${MK_DYNAMICROOT} == "no" Index: sbin/ping/main.c =================================================================== --- sbin/ping/main.c +++ sbin/ping/main.c @@ -70,6 +70,11 @@ #endif ipv4 = false; +#ifdef INET6 + if (strcmp(getprogname(), "ping6") == 0) + ipv6 = true; +#endif + while ((ch = getopt(argc, argv, OPTSTR)) != -1) { switch(ch) { case '4': Index: sbin/ping/ping.8 =================================================================== --- sbin/ping/ping.8 +++ sbin/ping/ping.8 @@ -28,7 +28,7 @@ .\" @(#)ping.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd November 24, 2020 +.Dd November 26, 2020 .Dt PING 8 .Os .Sh NAME @@ -141,6 +141,9 @@ or .Fl 6 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 .Bl -tag -width indent .It Fl A Index: sbin/ping/tests/ping_test.sh =================================================================== --- sbin/ping/tests/ping_test.sh +++ sbin/ping/tests/ping_test.sh @@ -53,9 +53,23 @@ 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_add_test_case ping_c1_s56_t1 atf_add_test_case ping_6_c1_s8_t1 + atf_add_test_case ping6_c1_s8_t1 } check_ping_statistics() { Index: tools/build/mk/OptionalObsoleteFiles.inc =================================================================== --- tools/build/mk/OptionalObsoleteFiles.inc +++ tools/build/mk/OptionalObsoleteFiles.inc @@ -2583,6 +2583,7 @@ .endif .if ${MK_INET6} == no +OLD_FILES+=sbin/ping6 OLD_FILES+=sbin/rtsol OLD_FILES+=usr/sbin/ip6addrctl OLD_FILES+=usr/sbin/mld6query