Question:
> Dear Sun experts:
>
> The following messages that I copied from my screen
> (share:ying:/home/admin/ying> is the prompt)
> I used traceroute command to trace a couple of hosts, then I got following
results which
> I am not sure why, the one thing is quite clearly is: when you put "leading
0",such as
> 128.220.211.010, the command interpreted ip addresses as "octad" and without
"leading 0" they are
> interpreted as "decimal"...
> example:
> 128.220.211.010 output is 128.220.211.8 with "leading 0", 2
number down
> 128.220.211.10 output is 128.220.211.10 without "leading 0",
right result
> 128.220.211.020 output is 128.220.211.16 with "leading 0", 4 number down
> 128.220.211.20 output is 128.220.211.20 without "leading 0",
right result
> ...
See below
>
> could some experts explain to me why these happened and how
> to control this, as detail as possible, I will realy appreciate !!
>
>
--------------------------------------------------------------------------------
-------
> share:ying:/home/admin/ying >traceroute 128.220.211.010 <-
command
> traceroute to alivepc06 (128.220.211.8) 30 hops max, 40 byte packets
> 1 osiris (128.220.63.2) 10 ms 6 ms 5 ms
> 2 128.220.178.21 (128.220.178.21) 15 ms 14 ms 12 ms
> 3 alivepc06 (128.220.211.8) 20 ms (ttl=30!) 13 ms (ttl=30!) 14 ms
(ttl=30!)
> share:ying:/home/admin/ying >traceroute 128.220.211.10 <-
command
> traceroute to alive (128.220.211.10) 30 hops max, 40 byte packets
> 1 osiris (128.220.63.2) 7 ms 5 ms 5 ms
> 2 128.220.178.21 (128.220.178.21) 11 ms 70 ms 18 ms
> 3 alive (128.220.211.10) 17 ms * 34 ms
>
--------------------------------------------------------------------------------
---------
>
....
SUMMARY:
>From anderson@neon.mitre.org Thu Apr 11 10:13 EDT 1996
To: ying@share.sph.jhu.edu
Subject: Re: IP address interpretion
What is there to explain?? You are correct: a leading zero usually (in
UNIX, at least) indicates that the number is in octal. Also, a leading
0x indicates hexadecimal. The way to control this is to control your
little fingers!rom bleary@state.ma.us Thu Apr 11 12:20 EDT 1996
X-Priority: 3 (Normal)
To: <ying@share.sph.jhu.edu>
Subject: re: IP address interpretion
Ying,
---------------------------------------------------------------------------
It is done by convention, or, perhaps, an artifact of history. See strtol(3c)
in man pages. strtol() is used by scanf() for integer/long conversions.
Since it exists programmers use it rather than "re-inventing the wheel". It's
just the way it is done in unix.
If you don't like it, you write your own code.
-----------------------------------------------------------------------------
>From kpi@hobbes.crc.com Thu Apr 11 13:12 EDT 1996
To: ying@share.sph.jhu.edu (ying He )
Subject: Re: IP address interpretion
X-Originating-Host: seth.lsg.crc.com
Mime-Version: 1.0
As we used to say in the DEC world years ago...
This is a feature and not a bug.
It is as you described because all unix networking is written in C and
as such leading zeros are treated as octal numbers.
-----------------------------------------------------------------------------
Hi Ying,
When you put a "0" in fron of a number UNIX usually interprets that to mean that
the number is in base 8 instead of base 10. This is a holdover from many years
ago when people used to program in Octal (base 8) or Hexadecimal (base 16).
Don't use a leading 0 in your IP numbers or it will use base 8.
That's why >traceroute 128.220.211.010 ended with 128.220.211.8.
base 8 "10" = base 10 "8", 011=9, 012=10, etc.
------------------------------------------------------------------------------
>From chris@Advent.COM Wed Apr 10 19:49 EDT 1996
X-Sender: chris@mozart
To: ying He <ying@share.sph.jhu.edu>
Subject: Re: IP address interpretion
X-Javalevel: Decaf - on the wagon since 10 Sep 95!
Mime-Version: 1.0
Ying,
Good observations .... just leave the leading zeros out
unless you want the number to be interpreted as octal.
- Christopher
-----------------------------------------------------------------------------
>From chrisc@Chris.Org Thu Apr 11 06:41 EDT 1996
Subject: Re: IP address interpretion
To: ying@share.sph.jhu.edu
what is your question? The effect that you are seeing is quite normal,
where a leading zero causes that octet to be interpreted as octal and
not decimal.
>From your traceroute, I didn't see anything else strange.
-- 73 Chris Cox W0/G4JEC ------------------------------------------------------------------------------ >From bobk@codeworks.telecode.com Thu Apr 11 09:51 EDT 1996 Mime-Version: 1.0 To: ying He <ying@share.sph.jhu.edu> Subject: Re: IP address interpretion Content-Transfer-Encoding: 7bitlooks as if your system is interpreting the numbers with the leading zero as octal (010 octal = 8 decimal). Not an uncommon treatment, but I wouldn't have expected it in addressing.
Hope this helps,
Rick
Kevin
- brion
Thanks for all of you who answer my question.
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:57 CDT