lkml.org 
[lkml]   [1996]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Possible /etc/hosts parsing bug?

On Sun, 17 Nov 1996, Mike wrote:

> In an effort to line everything up and make it look pretty I modified the
> previous lines to the following:
>
> 172.016.002.001 Atomic.shocking.com
> 172.016.002.002 Nuclear.shocking.com
> 172.016.002.003 Fusion.shocking.com
>
> Numerically, these have the same values, but when I tried to ping fusion,
> the IP that it was using was 172.14.2.3. When the extra '0's were deleted
> ping worked fine. Is this within the operating specs? Just curious,


inet_aton (the libc call that changes ascii representations of ip numbers
into actuall data) does the following:


if (*cp == '0') {
if (*++cp == 'x' || *cp == 'X')
base = 16, cp++;
else
base = 8;
}


so basically if you start one of the 'chunks' with a 0 (but no x/X) it
will try to decode it as octal (note that 016 = 1+8^1+6*8^0 = 14 decimal)

so to practice for v6 we should be doing 0xef.0.0.1 :)

oh, well, this is from my looking at the 5.4.7 tree.. i presume its been
like this for quite a while.

-- z



\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.067 / U:6.132 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site