inet:ip/1

Serge Aleynikov <>
Wed Apr 12 23:47:23 CEST 2006


Thanks for clarification.

Something not useful, yet we have to live with it.  Saidly, it makes 
validation of IP address entries quite difficult, as one cannot use 
inet:ip like functions to distinguish shorthand notations from errors.

BTW, Windows' telnet doesn't seem to recognize this shorthand form:

c:\>telnet 1.2.3
Connecting To 1.2.3...

Serge

Per Hedeland wrote:
> Serge Aleynikov <> wrote:
> 
>>Moreover, the kernel/inet_parse.erl has the following comment for 
>>ipv4_address/1:
>>
>>%% Parse IPv4 address:
>>%%    d1.d2.d3.d4
>>%%    d1.d2.d4
>>%%    d1.d4
>>%%    d4
>>%%
>>%% Return {ok, IP} | {error, einval}
>>
>>I wonder what it was that authors were trying to accomplish.
> 
> 
> It's the standard, is what it is:
> 
> $ telnet 1.2.3
> Trying 1.2.0.3...
> ^C
> $ telnet 1.2
> Trying 1.0.0.2...
> 
> Though admittedly an old and not very useful standard... See the section
> INTERNET ADDRESSES on e.g.
> http://www.freebsd.org/cgi/man.cgi?query=inet_aton for a description of
> the logic, such as it is (feel free to ignore the part about the VAX:-).
> The above commands are from a Linux box, i.e. it's not (Free)BSD-
> specific, but of course the logic is not described in Linux man pages.
> 
> --Per Hedeland



More information about the erlang-questions mailing list