Ping does not look up the inverse-DNS name in the "bytes received..." lines and it should. Normally the "-n" cmdline parameter suppresses this, but in netkit-base-0.10 it simply never looks it up at all. The fix is easy: search for "bytes received" in ping.c and change the next line as: 689c689 < pr_addr(from->sin_addr.s_addr), --- > inet_ntoa(*(struct in_addr *)&from->sin_addr.s_addr), This does the right thing.
Bug still present (on same line number) in i386 RHL 6.1, same fix works too
Created attachment 132 [details] Patch to allow ping to lookup names from IP addresses
Printing the ip address used rather than the reverse lookup DNS name is less ambigous on multihomed hosts. There are also far too many scripts that use ping that expect an IP address, not a hostname in the output. I can't change that output in ping.
Please reconsider. All non-Linux pings that I know of return the IP address *and* the name in their response, and this is very handy. The output "should" look like: $ ping www.yahoo.com PING www.yahoo.com (204.71.200.68): 56 data bytes 64 bytes from www3.yahoo.com (204.71.200.68): icmp_seq=0 ttl=249 time=67.4 ms ... but the current version of netkit-base (0.10) includes only the IP address: $ ping www.yahoo.com PING www.yahoo.com (204.71.200.67): 56 data bytes 64 bytes from 204.71.200.67: icmp_seq=0 ttl=249 time=111.8 ms ... The patch provided turns ping#2 into ping#1, and it also works without change on netkit-base-0.16 from the netkit maintainers. They have assigned bug [netbug 234] to this on 2000-03-05.
Reverse name lookup has been added in the Red Hat 6.2 iputils-20000121-2 ping. Good luck with netkit, and thanks for poing me!