-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ping: socket: Address family not supported by protocol #293
Comments
|
Thanks for your report. The commit is correct. But is there a regression? I don't thing so, but code could be improved.
Lines 523 to 533 in 4fd276c
Then obviously correct socket is used. Ideally code would know which socket needs to use before trying to create it. I'll have to look more deeply into the code how big rewrite it will be (and I'd prefer to have some ping tests written before changing it unless the change is trivial). And at least the warning could print whether the error is on IPv4 or on IPv6 to be at least a less confusing. |
|
I would guess that the desired outcome is to run It is unlikely that a user who has disabled IPv6 support in the kernel would care that |
|
...and keep in mind that github.com doesn't return any |
|
This broke nagios on me, since nagios expects no warnings sent to stderr. Here's a quick patch. |
|
This is absolutely a regression. If a user pings a destination on an IPv4 only host, they should not suddenly be seeing a new warning just because This is the commit that first introduced this behavior based on a bisect: Presumably what happened here is that once the right variable was used this warning started being emitted in cases where AF_INET6 is not supported and nobody caught this because either the committers or build infrastructure is entirely dual-stack? However, it seems like the change above is merely a red herring and merely made the check start working correctly. IMO, the real issue started back in 9fd870a once the conditional itself was changed. |
|
@lekto @clayne Could you please share your environment? I'm able to reproduce the problem with |
|
Both my PC and my router: Gentoo ~amd64 (unstable), kernel: gentoo-sources-5.10.12 configured from scratch by me and iputils-20210202. In attachment there is a build log from iputils. |
|
|
Thanks a lot for a reproducer. I tried to disable with |
|
Hello! my kernel is 5.4.97-gentoo-x86_64 Thanks! UPD: recompiling kernel with CONFIG_IPV6=y removes that warn message, i suppose that kernel return something other than EAFNOSUPPORT when CONFIG_IPV6 is not set... |
|
So, to avoid the warning, any system with ipv6 disabled (for security reasons, for example) will have patch and recompile all systems that previously used ping for monitoring. my nagios blew up. |
|
looks like the nagios piece does ignore the -4 flag as well. |
|
I'm sorry, I have it on my TODO list, but have no idea when I get time for it. |
|
In my use case, it's fine, nagios users are better suited to be using
check_icmp rather than the check_ping (wrapper) script. There may be
something that can be done on the nagios side, to force the -4 flag, but
i'm unsure how that would work with backwards compatibility and some other
things.
…On Tue, Apr 27, 2021 at 9:33 AM Petr Vorel ***@***.***> wrote:
I'm sorry, I have it on my TODO list, but have no idea when I get time for
it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#293 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADTNVLQM4S24DOGBX2CLJTTK3DNFANCNFSM4QTUWWJQ>
.
|
According to parameters in check_ping doc is implemented in C: check_ping.c. The official C implementation detects supported command, in my case => no |
|
I am having the same issue as @lekto with |
|
The command has no effect if ipv6 is disabled in the kernel:
|
|
Having issues in Debian 11/amd64, as @redtux , IPv6 disabled via kernel parameter: |
|
Same here on debian 11. root@smokeping:~# cat /proc/cmdline root@smokeping:~# cat /etc/gai.conf root@smokeping:~# ping 8.8.8.8 -c 1 root@smokeping:~# dpkg -l |grep iputils-ping Besr Regards |
|
Just had a look at this (needed to boot with ipv6.disable=1 to reproduce the issue) and I arrived at the same patch by @klynastor
You need to make requisite part of the first half of the logic, so that other than if verbose is set we only print the socket error if we failed on IPv6 and failed on IPv4. Or we are only trying and failed on IPv6. |
Regression was introduced in d141cb6 as introduced condition if ((errno == EAFNOSUPPORT && socktype == AF_INET6) || options & F_VERBOSE || requisite) was wrong, it should have been: if ((errno == EAFNOSUPPORT && family == AF_INET6 && requisite) || options & F_VERBOSE) but bug was hidden as `family == AF_INET6' was always false until otherwise correct fix 904cdb6 ("ping: AF_INET6 is address family not socket type [lgtm scan]") propagated the error. Fixes: d141cb6 ("ping: work with older kernels that don't support ping sockets") Closes: iputils#293 Reported-by: lekto <lekto@o2.pl> Suggested-by: klynastor Signed-off-by: Petr Vorel <pvorel@suse.cz>
|
Fix is ready, anybody feel free to test and put your |
Regression was introduced in d141cb6 as introduced condition if ((errno == EAFNOSUPPORT && socktype == AF_INET6) || options & F_VERBOSE || requisite) was wrong, it should have been: if ((errno == EAFNOSUPPORT && family == AF_INET6 && requisite) || options & F_VERBOSE) but bug was hidden as `family == AF_INET6' was always false until otherwise correct fix 904cdb6 ("ping: AF_INET6 is address family not socket type [lgtm scan]") propagated the error. Tested on kernel booted with ipv6.disable=1 (disabling via sysctl, i.e. sysctl -w net.ipv6.conf.all.disable_ipv6=1; sysctl -w net.ipv6.conf.default.disable_ipv6=1 does not trigger the issue as it exit with "socket: Address family not supported by protocol" - errno EADDRNOTAVAIL). Fixes: d141cb6 ("ping: work with older kernels that don't support ping sockets") Closes: iputils#293 Reported-by: lekto <lekto@o2.pl> Suggested-by: klynastor Signed-off-by: Petr Vorel <pvorel@suse.cz>
Regression was introduced in d141cb6 as introduced condition if ((errno == EAFNOSUPPORT && socktype == AF_INET6) || options & F_VERBOSE || requisite) was wrong, it should have been: if ((errno == EAFNOSUPPORT && family == AF_INET6 && requisite) || options & F_VERBOSE) but bug was hidden as `family == AF_INET6' was always false until otherwise correct fix 904cdb6 ("ping: AF_INET6 is address family not socket type [lgtm scan]") propagated the error. Tested on kernel booted with ipv6.disable=1 (disabling via sysctl, i.e. sysctl -w net.ipv6.conf.all.disable_ipv6=1; sysctl -w net.ipv6.conf.default.disable_ipv6=1 does not trigger the issue as it exit with "socket: Address family not supported by protocol" - errno EADDRNOTAVAIL). Fixes: d141cb6 ("ping: work with older kernels that don't support ping sockets") Closes: iputils#293 Reported-by: lekto <lekto@o2.pl> Suggested-by: klynastor Reviewed-by: Andrew Clayton <andrew@digital-domain.net> Signed-off-by: Petr Vorel <pvorel@suse.cz>
|
I'm sorry, is this commit already in master branch? Can i just clone it, compile and test or should i choose some side branch? Work with git unfortunately not among my virtues ... |
|
If you already have this repository checked out, you can simply pull this change over with |
Regression was introduced in d141cb6 as introduced condition if ((errno == EAFNOSUPPORT && socktype == AF_INET6) || options & F_VERBOSE || requisite) was wrong, it should have been: if ((errno == EAFNOSUPPORT && family == AF_INET6 && requisite) || options & F_VERBOSE) but bug was hidden as `family == AF_INET6' was always false until otherwise correct fix 904cdb6 ("ping: AF_INET6 is address family not socket type [lgtm scan]") propagated the error. Tested on kernel booted with ipv6.disable=1 (disabling via sysctl, i.e. sysctl -w net.ipv6.conf.all.disable_ipv6=1; sysctl -w net.ipv6.conf.default.disable_ipv6=1 does not trigger the issue as it exit with "socket: Address family not supported by protocol" - errno EADDRNOTAVAIL). Fixes: d141cb6 ("ping: work with older kernels that don't support ping sockets") Closes: iputils#293 Reported-by: lekto <lekto@o2.pl> Reviewed-by: Andrew Clayton <andrew@digital-domain.net> Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Byron Stanoszek <gandalf@winds.org> [ pvorel: create commit from Byron's patch on the issue, do analysis and wrote commit message ] Signed-off-by: Petr Vorel <pvorel@suse.cz>
|
@imThief FYI fix merged. |
Hi, I got message "ping: socket: Address family not supported by protocol" when using ping without "-4" after update to s20200821.
I did git bisect and it's showing me that this commit is causing this:
I'm using kernel without IPv6 support.
The text was updated successfully, but these errors were encountered: