> [EMAIL PROTECTED] wrote:
> > > Like someone already noted, it is supposed to be dotted !DECIMAL!
> > > notation.
> >
> >         Assuming my memory works at all, I think this is a feature
> >         of atoi() but I'd want to play with it first.
>
> I dug around a wee bit.
> The problem appears to be the inet_aton/inet_addr function,
> and it's not a bug, it's a problem of conflicting specifications.
> ("the good thing about standards is that there are so many to choose from")
>
> The SUS explicitly states:
>   All numbers supplied as parts in dot notation may be decimal,
>   octal, or hexadecimal, as specified in the ISO C standard (that
>   is, a leading 0x or 0X implies hexadecimal; otherwise, a leading
>   0 implies octal; otherwise, the number is interpreted as decimal).
>
> (this is in line with the original BSD implementation, which even
>  contained an explicit comment to state that it worked this way...)
>
> But RFC 1123 (STD 3) "Requirements for Internet Hosts --
> Application and Support" says
>    2.1  Host Names and Numbers
> ...
>       Whenever a user inputs the identity of an Internet host, it SHOULD
>       be possible to enter either (1) a host domain name or (2) an IP
>       address in dotted-decimal ("#.#.#.#") form.  The host SHOULD check
>       the string syntactically for a dotted-decimal number before
>       looking it up in the Domain Name System.
>
> Though this does not provide a formal definition of the format,
> it seems obvious that the numbers are intended to be decimal,
> not octal or hexadecimal...
> (and other RFCs contain examples that confirm this)
>
>
> I suppose the UNIX standard take precedence here...  ;-(

RFC 1325
   dot address (dotted address notation)
           Dot address refers to the common notation for Internet
           addresses of the form A.B.C.D; where each letter represents,
           in decimal, one byte of the four byte IP address.

0x0d isn't decimal to my mind.

RFC 820
   One commonly used notation for internet host addresses divides the
   32-bit address into four 8-bit fields and specifies the value of each
   field as a decimal number with the fields separated by periods.  This
   is called the "dotted decimal" notation.  For example, the internet
   address of ISIF in dotted decimal is 010.002.000.052, or 10.2.0.52.

I dont think Jon contemplated 010 as being read as an octal number.

This comes from RFC 943 (and several others). It's impossible to construe all of these 
as octal - 019 for example.

        001.rrr.rrr.rrr-003.rrr.rrr.rrr Unassigned                 [JBP]
        005.rrr.rrr.rrr                 Unassigned                 [JBP]
        009.rrr.rrr.rrr                 Unassigned                 [JBP]
        013.rrr.rrr.rrr                 Unassigned                 [JBP]
        015.rrr.rrr.rrr-017.rrr.rrr.rrr Unassigned                 [JBP]
        019.rrr.rrr.rrr-020.rrr.rrr.rrr Unassigned                 [JBP]
        031.rrr.rrr.rrr                 Unassigned                 [JBP]
        033.rrr.rrr.rrr-035.rrr.rrr.rrr Unassigned                 [JBP]
        037.rrr.rrr.rrr-038.rrr.rrr.rrr Unassigned                 [JBP]
        040.rrr.rrr.rrr                 Unassigned                 [JBP]
        042.rrr.rrr.rrr-043.rrr.rrr.rrr Unassigned                 [JBP]
        045.rrr.rrr.rrr-126.rrr.rrr.rrr Unassigned                 [JBP]
        127.rrr.rrr.rrr                 Reserved                   [JBP]

--
Cheers
John Summerfield

Microsoft's most solid OS: http://www.geocities.com/rcwoolley/

Note: mail delivered to me is deemed to be intended for me, for my disposition.

==============================
If you don't like being told you're wrong,
        be right!

Reply via email to