It was warned before on this IETF draft, but it was never published: <https://www.ietf.org/archive/id/draft-main-ipaddr-text-rep-02.txt> Hugo On 13:54 25/10, Phillip Remaker wrote:
Historically, C uses a 0 to precede an octal number, 0x to precede a decimal, and 0b for binary. Leading zeroes are otherwise stripped in numerical representation.
Since 0x is not accepted, I'd call it a bug and request that the numbers always get treated as decimal, regardless of leading zeros.
There's probably some downstream library making the anachronistic assumption.
On Wed, Oct 25, 2017 at 1:45 PM, Max Grobecker < max.grobecker@ml.grobecker.info> wrote:
Hello,
is there - by standard - a definition on how to represent an IPv4 address?
I have (for example) the IP address "73.0.255.229", which can IMHO also be written as "073.000.255.229" as the leading zeroes are not giving any changes to the binary representation of this address. Am I right on this?
But: When I lookup this IP address on https://stat.ripe.net/073.000. 255.229 the first octet is internally getting swapped to "59". This can be explained, if you take "073" as an octal value and convert it to a decimal value. It is definitely a octal-to-decimal conversion thing, as for example also the value "010" is getting replaced by "8" and so on.
Now I'm puzzled: Of course, writing IPv4 octets with leading zeroes is not very common. But: Is it officially prohibited or discouraged?
This weird conversion also happens inside the "geoiplookup" tool by MaxMind and I'm not sure if I'm going to be the moron in this story or if I found the same bug inside multiple softwares at once ;-)
Thanks and greetings from Wuppertal Max