SV: Ping - error?

Brian Schau (bsc@fleggaard.dk)
Fri, 12 Jun 1998 15:12:44 +0200


Hi Matei,

You're right. But is it really desirable? If, for some reason, you
need to ping an address generated by a program which outputs the address
in 4 triplets, you get a surprise.

Might it not be a better idea to stress that octal values and
hexadecimal values should be escaped, ie. \OOO (for octal) and \xXX (for
hex)?

Best regards,

Brian

> -----Oprindelig meddelelse-----
> Fra: Matei Conovici [SMTP:cmatei@lbi.ro]
> Sendt: 12. juni 1998 15:08
> Til: bsc@fleggaard.dk
> Cc: linux-kernel@vger.rutgers.edu
> Emne: Re: Ping - error?
>
>
>
> > rlis6:/root # ping 192.168.33.036
> > PING 192.168.33.036 (192.168.33.30): 56 data bytes
> > ^^^^^^^^^^^^^
> > 64 bytes from 192.168.33.30: icmp_seq=0 ttl=60 time=2.6 ms
> > 64 bytes from 192.168.33.30: icmp_seq=1 ttl=60 time=1.5 ms
>
>
> > It's the same on a Windows and a HP-UX box. I guess it's libc or
> the
> > shell which is to blame, but why does it incorrectly parse 036 as
> 30?
> > I know that 036 in octal is 30, but I didn't specify a backslash.
>
> It is parsed just as you suspect ...
>
> > Is there something I should know?
>
> Yes :-) You should know how to atoi() :-)
>
> Watch:
>
> [root@waiting]:/usr/home/cmatei # ping 0x8d.0x55.130.16
> PING 0x8d.0x55.130.16 (141.85.130.16): 56 data bytes
> 64 bytes from 141.85.130.16: icmp_seq=0 ttl=64 time=6.8 ms
> 64 bytes from 141.85.130.16: icmp_seq=1 ttl=64 time=1.6 ms
>
>
> BTW, same happens if you put zero-padded (or 0x-padded) numbers in
> /etc/hosts for example ...
>
> > Best regards,
> > Brian
>
> Matei

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu