[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#2574: ping - strange behavior?



On Tue, 19 Mar 1996, Soenke Lange wrote:
> # ping 134.106.121.
> PING 134.106.121. (134.106.121.0): 56 data bytes
> 64 bytes from 134.106.121.4: icmp_seq=0 ttl=255 time=10.1 ms
> 64 bytes from 134.106.121.3: icmp_seq=0 ttl=255 time=13.2 ms (DUP!)
> 64 bytes from 134.106.121.26: icmp_seq=0 ttl=255 time=16.0 ms (DUP!)
> 64 bytes from 134.106.121.4: icmp_seq=1 ttl=255 time=1.7 ms

This isn't strange at all.  Pinging the network has the same effect as
pinging the broadcast address.  Every machine on your network will
answer, which will give you duplicate ICMP ECHO_RESPONSE packets.
ping's interpretation of '134.106.121.' as '134.106.121.0' is from
inet_aton(3) as this short program demonstrates:

femto[~]$ cat foo.c
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
main() {
  char *x = "134.106.121.";
  struct in_addr inp;
  printf ("%s\n", inet_aton(x,&inp) ? inet_ntoa(inp) : "bleah");
}
femto[~]$ gcc foo.c
femto[~]$ ./a.out
134.106.121.0

> Is this the right behavior, or should ping report an error, as fping do
> # fping 134.106.121.
> 134.106.121. error while sending ping: Permission denied

This is odd.  Perhaps fping is rolling its own inet_aton(), which is
somehow printing this error.

Try 'fping 134.106.121.0'.  If that works, the fault is with fping's
address interpretation.  If it gives the same error, fping is unable to
ping the network.  In that case, also try 'fping 134.106.121.255'.  If
that also doesn't work, it's a shortcoming in fping.

In any case, ping's behaviour is correct, while fping's is not.

Guy



Reply to: