ping doing LOTS of useless dns request

Bug #82720 reported by john smith
10
Affects Status Importance Assigned to Milestone
iputils (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

Description:
When the user is doing "ping -f myhostname.tld", ping does a ipaddr->hostname request at EACH packet. Which is quite a lot when used with a -f option.
Moreover it is quite useless as when used with -f, ping doesnt display the result of the ipaddr->hostname, but only a single dot per packet.

- I discovered this when implementing a nss plugin (/etc/nsswitch.conf kindof stuff).
- I dunno the actual impact of this, just seems like very inefficient.
  - But if the nss plugin doesn't have an request cache, this will become quite a
    denial of service for this service

-gjarboni's addition--

Actually, this can be a lot worse in certain cases. For example, try pinging dnstest.bigjar.com. You can't reproduce this in text but what happens is:

Pinging machine sends out ICMP echo request
Pinging machine sends out in-addr.arpa DNS query (ip address -> DNS name)
Pinging machine receives NXDOMAIN (no such record) from DNS server
 ------ 5 to 10 seconds pass ------
Pinging machine prints:
64 bytes from 12.173.97.1: icmp_seq=1 ttl=252 time=20.9 ms

This happens for every packet. If you interrupt ping during the 5 to 10 second period it will print the "64 bytes from ..." bit before returning to the shell prompt.

I shudder to imagine someone trying to walk a user through testing connectivity with this bug. It also occurs in Debian 4.0.

I have packet traces and a much more detailed write up if anyone is interested. This bug doesn't happen with all IP addresses that don't have a hostname associated with them, just certain ones, but it appears to specific to certain name servers.

Revision history for this message
john smith (nonymity) wrote :

i just wrote a patch (as suggested on #ubuntu-bugs).
with this patch, ping/ping6 will no more try to gethostbyaddr at every packet, but ONLY if "-f" is set

Áron Sisak (asisak)
Changed in iputils:
importance: Undecided → Low
status: Unconfirmed → Confirmed
gjarboni (jmitchel)
description: updated
Revision history for this message
gjarboni (jmitchel) wrote :

The importance on this needs to be raised. ping is essentially broken with certain IP addresses, DNS servers, and negative responses. Maybe the problem isn't in ping but is in the resolver library? I can't do the code myself, and it's not a problem for me to remember to do "ping -n". However, this would seriously confuse a user and probably cause them to think a machine is down, when it is in fact up.

Revision history for this message
David Heidelberg (okias) wrote :

Can someone confirm these days - 2016 - 2017 ?

Best with https://github.com/iputils/iputils

Thank you!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.