Resolver doesn't like 1.2.3.04 in /etc/hosts
Paul T. Root
ptroot at iaces.com
Thu Oct 27 05:23:48 PDT 2005
man inet_addr
and you'll find:
All numbers supplied as ``parts'' in a `.' notation may be decimal,
octal, or hexadecimal, as specified in the C language (i.e., a leading
0x or 0X implies hexadecimal; otherwise, a leading 0 implies octal;
otherwise, the number is interpreted as decimal).
So a leading zero means hex. Stop trying to make it look pretty.
Standards are a good thing and need to be followed.
Jan Grant wrote:
> ***********************
> This message has been scanned by the InterScan for CSC-SSM and found to be free of known security risks.
> ***********-***********
>
>
> On Thu, 27 Oct 2005, Mark Andrews wrote:
>
>
>>>On 2005-10-26, Mark Andrews wrote:
>>>
>>>> Leading zeros are ambigious. Some platforms treat them as octal
>>>> others treat them as decimal.
>>>
>>>There is nothing ambiguous about the example provided. (Perhaps
>>>it wasn't a good example, but it's always a bug if '04' is not
>>>correctly decoded, regardless of the numeric base in use.)
>>
>> You want a ambigious example?
>>
>> 192.168.222.012
>
>
> It amazed me that no RFC ever appears to have standardised this format
> (although it is alluded to in passing as being decimal in various other
> places). Eg, 1035 has:
>
> [[[
> The RDATA section of
> an A line in a master file is an Internet address expressed as four
> decimal numbers separated by dots without any imbedded spaces (e.g.,
> "10.2.0.52" or "192.0.5.6").
> ]]]
>
> (although that's DNS zone file format, not /etc/hosts.)
>
>
>> It's much easier to just reject octal and hexadecimal than
>> to work out when and when not it is ambigious. It is also
>> better to demand all 4 octets. It also generates less
>> support complaints.
>
>
> I'm happy to reject octal and hex too! Anyway, count this as one (minor)
> support gripe :-)
>
> Thanks for your time,
> jan
>
>
--
______ Paul T. Root
/ _ \ 1977 MGB
/ /|| \\
||\/ || _ |
|| || ||
\ ||__//
\______/
More information about the freebsd-stable
mailing list