[TUHS] conventions around zero padding in ip4

Ralph Corderoy ralph at inputplus.co.uk
Sun May 8 20:28:46 AEST 2022


Hi Bakul,

> On FreeBSD:
> ping 10.2 tries to ping 10.0.0.2 and
> ping 192.168.300 tries to ping 192.168.1.44 (1*2^8+44 == 300)
> ping 10.2.300 tries to ping 10.2.1.44
> ping 192.1000000 tries to ping 192.15.66.64 (15*2^15+66*2^8+64 == 1000000)
> ping 1000000001 tries to ping 59.154.202.1 (59*2^24+154*2^16+202*2^8+1)

Ditto here on Linux with GNU libc.

> ping 300.300 tries to ping 23.217.138.110 (I haven't worked this out! Prob. a bug)

It doesn't parse as a numeric address.  Given it's a.bcd, based on the
notation in my other email, the first 300 is ‘a’ but is bigger than one
byte so is invalid. Yes, a bug.

    $ ping 300.300
    ping: 300.300: Name or service not known
    $

-- 
Cheers, Ralph.


More information about the TUHS mailing list