[lkml]   [1996]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
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:
> Numerically, these have the same values, but when I tried to ping fusion,
> the IP that it was using was 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++;
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.062 / U:21.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site