Regressed by base r368045. Affects "nooption INET6" in kernel config. Compared to other userland tools ping(8) seems to abort when a host has both IPv4 and IPv6 address(es) but one of those is not supported by running kernel. $ ping localhost ping: socket ssend: Address family not supported by protocol family $ ping freebsd.org ping: socket ssend: Address family not supported by protocol family $ sysctl kern.conftxt | fgrep INET options INET $ getaddrinfo localhost dgram inet6 udp ::1 0 stream inet6 tcp ::1 0 seqpacket inet6 sctp ::1 0 dgram inet udp 127.0.0.1 0 stream inet tcp 127.0.0.1 0 seqpacket inet sctp 127.0.0.1 0 $ getaddrinfo freebsd.org dgram inet6 udp 2610:1c1:1:606c::50:15 0 stream inet6 tcp 2610:1c1:1:606c::50:15 0 seqpacket inet6 sctp 2610:1c1:1:606c::50:15 0 dgram inet udp 96.47.72.84 0 stream inet tcp 96.47.72.84 0 seqpacket inet sctp 96.47.72.84 0 $ fetch http://freebsd.org freebsd.org 24 kB 97 kBps 01s
Good catch. I'll fix it. In the meantime, you can use "ping -4"
Created attachment 221094 [details] Fix ping when the kernel lacks INET6 support jbeich, could you please review and test this patch?
Created attachment 221097 [details] Fix ping when the kernel lacks INET6 support, v2 Please, use git-format-patch(1) to facilitate amending patches. (In reply to Alan Somers from comment #2) > review Use feature_present(3) instead of poking kern.features.* directly. I don't know much about base/ style otherwise. > test Works for me.
Thanks for the feature_present change. That does look better now.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=b586c66baf4824d175d051b3f5b06588c9aa2bc8 commit b586c66baf4824d175d051b3f5b06588c9aa2bc8 Author: Alan Somers <asomers@FreeBSD.org> AuthorDate: 2021-01-01 17:25:49 +0000 Commit: Alan Somers <asomers@FreeBSD.org> CommitDate: 2021-01-01 17:25:49 +0000 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 sbin/ping/main.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
Fixed. No plans to MFC.