Inconsistent octal madness

$ ping 010
PING 010 (0.0.0.8) 56(84) bytes of data.
$ ping 010.1.1.1
PING 010.1.1.1 (8.1.1.1) 56(84) bytes of data.
$ ping 018
ping: 018: Name or service not known
$ ping 18
PING 18 (0.0.0.18) 56(84) bytes of data.
$ ping 018.1.1.1
PING 018.1.1.1 (18.1.1.1) 56(84) bytes of data.
$ ping 18.1.1.1
PING 18.1.1.1 (18.1.1.1) 56(84) bytes of data.

ok sorry, embarrassingly enough it was misdiagnosed by me. It is my silly DNS server that "helpfully" resolves these names for me!

@bagder I'm not sure it's DNS, it could be earlier in the local functions to handle IP addresses in different notations (I am not going to embarrass myself by naming these functions to you).

That will make things like

$ ping 0x7f000001
PING 0x7f000001 (127.0.0.1) 56(84) bytes of data.

$ ping 0177.0.0.1
PING 0177.0.0.1 (127.0.0.1) 56(84) bytes of data.

work without ever hitting the resolver.

@KHoos I am sure it is the DNS. Using ltrace I could see how 018.1.1.1 gets a 0 back from the getaddrinfo() call. I can also reproduce it with dig directly.

The precise point was to use 018 as the first number, as that is 0-prefixed but not a valid octal.