[TUHS] conventions around zero padding in ip4

Warner Losh imp at bsdimp.com
Sun May 8 09:49:46 AEST 2022


On Sat, May 7, 2022, 5:19 PM Bakul Shah <bakul at iitbombay.org> wrote:

> On May 7, 2022, at 12:14 PM, Warner Losh <imp at bsdimp.com> wrote:
> >
> > 10.2 is ambiguous. In a network context, it means, typically,
> 10.2.0.0/16 (though your mileage may vary).
> > In a host context, it means 10.0.0.2. It's this confusion that has lead
> to many efforts
> > to outright kill this notation.
>
> 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)
> ping 300.300 tries to ping 23.217.138.110 (I haven't worked this out!
> Prob. a bug)
> So the last number is treated as the host number on a given net.
> This may have some sense in the classful network world but is
> very confusing in the CIDR world.
>


We just know the dotted quad world. In the early days of sparse addresses
and crappy name service (or out of date host files) these shortcuts were a
lifesaver.

Warner

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20220507/3b38cf80/attachment.htm>


More information about the TUHS mailing list