-
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: do a reverse lookup for numeric addresses #421
Comments
Does it mean that you need to call Lines 1650 to 1651 in 1ab5faf
Could please also post snippet of your dns server configuration which could be used for testing? Also could you check how ping from busybox and fping behaves on this? @gobenji please any opinion on this? |
Uhm, a safer alternative could be to add the opposite of
Sure, I'm using bind with this zone definition
and the content should look something like this:
(tip: to reverse the addresses you can use
I don't think busybox ping supports doing reverse lookups, fping does but strangely |
As you correctly found it was added by original author YOSHIFUJI Hideaki (who only knows in deep ICMP protocols and kernel networking internal) in f6bc8f6 (fix Since 2007 ping refuses reverse lookup on numeric address. I have no idea why, but I suppose YOSHIFUJI Hideaki had strong reason for that. You might not like it, but with this change you introduce backward incompatibility, there must be a very strong reason for changing that. |
I justed wanted to weigh in with a small comment that these commits As you can see here: Lines 296 to 309 in 3337034
If Lines 894 to 909 in 3337034
All of that already in the initial commit. |
I absolutely share @rnhmjoj’s wish for a reverse lookup, but I can see that a breaking change may be too much here. Maybe an “opposite of As for the reason behind the current behavior, I can only speculate, but I can add my two cents: I assume that the original author wanted to avoid a – potentially expensive – name lookup when the user starts out with an IP address. After all, if a user types an IP address and not a host name, we could probably assume that they are not interested in host names. Avoiding the cost of a reverse lookup (actually many reverse lookups, see below) is then a very good idea. Also, I am pretty sure I have sometimes come across a situation like this (but only rarely):
You can easily test this by adding Any behavior like that would be all the more obnoxious when I ping, say, a local IP address and don’t have and don’t want host names on the local network. Hence it might be a good idea to default to “no lookups“ when I didn’t work with host names to begin with. But then again, it has probably been very long since I experienced this. Maybe this whole line of reasoning, the idea that a name lookup is typically expensive, is just from a different era of networking. Whenever my name server is healthy, it feels very strange that |
And I found the release note of this feature. Apparently it is 22 years old (2000-09-28): iputils/Documentation/RELNOTES.old Lines 873 to 874 in 2b44aa6
Maybe @twaugh remembers the real reason why he proposed this. (We could try to email him, I don’t think this mention will work.) |
Last message from me: I also found two ten-year-old issues on Debian’s bug tracker of the https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=650479 basically asks to change this behavior or document it. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=650478 describes a fault condition that’s basically the same as the one I described, with the primary name server unavailable. |
I don't remember my reasoning for that I'm afraid. My current opinion is entirely different, ie. that the behaviour shouldn't depend on whether the destination is given as a hostname or an IP address. |
I tend to be conservative to preserve old behavior, therefore I'd agree with suggestion to add a new option for opposite behavior of
Also these reasons stated by MJochim are really valid. IMHO people expect when they pass the address, that ping works without DNS => again, I'm for a new option. Looking at other tools: doing test how
Which suggest by default there is no reverse lookup, people need to ask. |
As for other tools: |
Maybe we should follow the same approach and do reverse lookup only when asked. But |
|
@nmeyerhans @gault any opinion on this issue? |
I think ping shouldn't assume the network is in good condition by default and therefore shouldn't rely on DNS if not necessary. |
Thank you all for your input. I'm going to add People often asks for the opposite: to disable using |
Implements: iputils#421 Suggested-by: Michele Guerini Rocco Signed-off-by: Petr Vorel <pvorel@suse.cz>
Implements: iputils#421 Closes: iputils#494 Suggested-by: Michele Guerini Rocco Signed-off-by: Petr Vorel <pvorel@suse.cz>
Forcing DNS name resolution is useful for numeric destination, or -f option, which by default do not perform it. It overrides -n option. Implements: iputils#421 Closes: iputils#494 Suggested-by: Michele Guerini Rocco Signed-off-by: Petr Vorel <pvorel@suse.cz>
I tested it by pinging @rnhmjoj Can you please email me your email address or post it here, so that I can add it to Suggested-by: tag? (your credit). You can use rnhmjoj@inventati.org. Thank you! |
Forcing DNS name resolution is useful for numeric destination, or -f option, which by default do not perform it. It overrides -n option. Fixes: iputils#421 Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=650479 Closes: iputils#494 Reported-by: Vincent Lefevre <vincent@vinc17.net> Reported-by: Michele Guerini Rocco Signed-off-by: Petr Vorel <pvorel@suse.cz>
Forcing DNS name resolution is useful for numeric destination, or -f option, which by default do not perform it. It overrides -n option. Fixes: iputils#421 Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=650479 Closes: iputils#494 Reported-by: Vincent Lefevre <vincent@vinc17.net> Reported-by: Michele Guerini Rocco Signed-off-by: Petr Vorel <pvorel@suse.cz>
Forcing DNS name resolution is useful for numeric destination, or -f option, which by default do not perform it. It overrides -n option. Fixes: iputils#421 Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=650479 Closes: iputils#494 Reported-by: Vincent Lefevre <vincent@vinc17.net> Reported-by: Michele Guerini Rocco Reviewed-by: Vincent Lefevre <vincent@vinc17.net> Signed-off-by: Petr Vorel <pvorel@suse.cz>
Forcing DNS name resolution is useful for numeric destination, or -f option, which by default do not perform it. It overrides -n option. Fixes: iputils#421 Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=650479 Closes: iputils#494 Reported-by: Vincent Lefevre <vincent@vinc17.net> Reported-by: Michele Guerini Rocco Reviewed-by: Vincent Lefevre <vincent@vinc17.net> Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Guillaume Nault <guillaume.nault@wanadoo.fr> Signed-off-by: Petr Vorel <pvorel@suse.cz>
On certain network setup getaddrinfo() can return empty ai_canonname when forcing IP protocol version. Instead of printing nothing in "PING" line use the target. This fixes the output of PING line: $ ping seznam.cz -c1 -4 -v ... ai->ai_family: AF_INET6, ai->ai_canonname: 'seznam.cz' ai->ai_family: AF_INET6, ai->ai_canonname: '' ai->ai_family: AF_INET, ai->ai_canonname: '' PING (77.75.79.222) 56(84) bytes of data. 64 bytes from www.seznam.cz (77.75.79.222): icmp_seq=1 ttl=55 time=4.82 ms to $ ping seznam.cz -c1 -4 -v ... PING seznam.cz (77.75.79.222) 56(84) bytes of data. 64 bytes from www.seznam.cz (77.75.79.222): icmp_seq=1 ttl=55 time=4.88 ms Implements: iputils#421 Link: iputils#478 (comment) Reported-by: Michele Guerini Rocco <rnhmjoj@inventati.org> Reported-by: Robert Scheck <robert@fedoraproject.org> Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <pvorel@suse.cz>
On certain network setup getaddrinfo() can return empty ai_canonname when forcing IP protocol version. Instead of printing nothing in "PING" line use the target. This fixes the output of PING line: $ ping seznam.cz -c1 -4 -v ... ai->ai_family: AF_INET6, ai->ai_canonname: 'seznam.cz' ai->ai_family: AF_INET6, ai->ai_canonname: '' ai->ai_family: AF_INET, ai->ai_canonname: '' PING (77.75.79.222) 56(84) bytes of data. 64 bytes from www.seznam.cz (77.75.79.222): icmp_seq=1 ttl=55 time=4.82 ms to $ ping seznam.cz -c1 -4 -v ... PING seznam.cz (77.75.79.222) 56(84) bytes of data. 64 bytes from www.seznam.cz (77.75.79.222): icmp_seq=1 ttl=55 time=4.88 ms Implements: iputils#421 Link: iputils#478 (comment) Reported-by: Michele Guerini Rocco <rnhmjoj@inventati.org> Reported-by: Robert Scheck <robert@fedoraproject.org> Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <pvorel@suse.cz>
Forcing DNS name resolution is useful for numeric destination, or -f option, which by default do not perform it. It overrides -n option. Fixes: iputils#421 Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=650479 Closes: iputils#494 Reported-by: Vincent Lefevre <vincent@vinc17.net> Reported-by: Michele Guerini Rocco Reviewed-by: Vincent Lefevre <vincent@vinc17.net> Reviewed-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Guillaume Nault <guillaume.nault@wanadoo.fr> Signed-off-by: Petr Vorel <pvorel@suse.cz>
It seems that if you specify a "literal" IP address ping won't do a reverse name lookup. I think this would be good to have in general and it's particularly nice for IPv6: if you have set up a reverse zone for the link local you can then do
and get a nice scan of your network.
It's enough to remove this check to get this behavior, not sure if there are other side effects.
The text was updated successfully, but these errors were encountered: