inet:ip/1

David Hopwood <>
Thu Apr 13 04:11:37 CEST 2006


James Cloos wrote:
>>>>>>"Serge" == Serge Aleynikov <> writes:
> 
> Serge> While playing with the inet:ip/1 function I noticed that it can take
> Serge> an argument containing less than four octets.  What's the meaning of
> Serge> such a strange conversion like inet:ip("1.2.3")?
> 
> The RFC for ipv4 defines all of:
> 
>     a.b.c.d
>     a.b.e
>     a.f
>     g
> 
> as identical, where e=256c+d, f=256b+e and g=256a+f.

That's not correct. Don't confuse the (long obsolete) RFC 950 class A/B/C
subnetting with the strings accepted by inet_aton. RFC 791 doesn't define or
use any string notation for IP addresses (it defines them as sequences of
four 8-bit bytes), and RFC 1020 uses a notation which is not consistent with
inet_aton.

-- 
David Hopwood <>





More information about the erlang-questions mailing list