Bug 269643 - ping: UDP connect: No route to host
Summary: ping: UDP connect: No route to host
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.1-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-net (Nobody)
URL: https://www.freebsd.org/releases/13.0...
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2023-02-18 09:10 UTC by crypt47
Modified: 2024-06-04 18:52 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description crypt47 2023-02-18 09:10:46 UTC
After update from F12 to F13.1 the ping behavior has changed, because it's now requires -4/-6 option to resolve names:

ping ya.ru
ping: UDP connect: No route to host



It's kinda breaking change for scripts and it's hard to figure out without searching internet. What's more strange the ping6 utility still persist in the system for the same purpose. 

ping6 -4 ya.ru
ping6: -4 and -6 cannot be used simultaneously

So I understand this is some kind of compilation bug and some part of IPv6 code was included in simple ping utility.
Comment 1 Graham Perrin freebsd_committer freebsd_triage 2023-02-18 12:38:01 UTC
(In reply to crypt47 from comment #0)

> … from F12 to F13.1 …

Release notes for 13.1 should be read alongside notes for 13.0; there's a note about the ping(8) and ping6(8) utilities. 

----

> … requires -4/-6 option to resolve names: …

I don't see the requirement: 

root@fuji:~ # freebsd-version -kru ; uname -aKU
13.1-RELEASE-p6
13.1-RELEASE-p6
13.1-RELEASE-p6
FreeBSD fuji 13.1-RELEASE-p6 FreeBSD 13.1-RELEASE-p6 GENERIC amd64 1301000 1301000
root@fuji:~ # ping -c 2 ya.ru
PING ya.ru (77.88.55.242): 56 data bytes
64 bytes from 77.88.55.242: icmp_seq=0 ttl=245 time=54.332 ms
64 bytes from 77.88.55.242: icmp_seq=1 ttl=245 time=54.695 ms

--- ya.ru ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 54.332/54.514/54.695/0.181 ms
root@fuji:~ #
Comment 2 Mike Karels freebsd_committer freebsd_triage 2023-02-18 13:21:01 UTC
(In reply to crypt47 from comment #0)

> After update from F12 to F13.1 the ping behavior has changed, because it's now requires -4/-6 option to resolve names:

> ping ya.ru
> ping: UDP connect: No route to host

The problem is that ya.ru has both IPv4 and IPv6 addresses, ping is defaulting to IPv6, and the host on which the command was run has IPv6 configured but cannot route to ya.ru.  ping -4 ya.ru should work.  ping, like many other utilities, now supports both IPv6 and IPv4, along with -4 and -6 options.  Perhaps your script should use ping -4.  btw, ping6 is just ping -6.
Comment 3 Mike Karels freebsd_committer freebsd_triage 2023-02-18 13:44:52 UTC
See also ip6addrctl, which shows and modifies the address selection policy; you can make IPv4 preferred.
Comment 4 Marek Zarychta 2023-02-18 14:53:11 UTC
(In reply to crypt47 from comment #0)
>ping ya.ru
>ping: UDP connect: No route to host

Incomplete IPv6 settings most likely prevent ping(8) from using legacy IP for that probe. Normally, if the host has not IPv6 connectivity enabled, ping(8) will choose the legacy IP to probe.
Comment 5 crypt47 2023-02-19 06:46:59 UTC
> Perhaps your script should use ping -4.  btw, ping6 is just ping -6.

I understand the nature of the problem, but the idea is not to change scripts because of changes in OS. (AND having two pings both of which are IPv6 capable and only one is IPv4 capable is a bit strange.)

I personally didn't introduce any ipv6 on the system. If there were any "IPv6_OFF" global switch I will pull it. And actually I did. At least I thought.

ipv6_activate_all_interfaces="NO"

If you say ip6addrctl is a new global soft switch, I'll use it, but it's not obvious (No examples in man page).

# rc.conf, to disable broken ping on F13.Х systems 
ip6addrctl_enable="YES"
ip6addrctl_policy="ipv4_prefer"
Comment 6 crypt47 2023-02-19 06:48:42 UTC
p.s.

Yes, it's not obvious to enable something IPv6 (ip6addrctl_enable="YES")
related to disable it (ip6addrctl_policy="ipv4_prefer").