That was  my initial guess... a parsing shortcut.

But it appears to predate that, significantly.

From: [email protected] [mailto:[email protected]] On 
Behalf Of Crawford, Scott
Sent: Wednesday, September 17, 2014 5:38 PM
To: [email protected]
Subject: [NTSysADM] RE: Pinging with less than 3 octets

Cool. Thanks for the info. I guess if its documented, it'll prolly work for a 
while...at least til we're all v6. :)

I wonder if it had similar origins to the IPv6 double-colon shortcut.

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Michael B. Smith
Sent: Wednesday, September 17, 2014 4:15 PM
To: [email protected]<mailto:[email protected]>
Subject: [NTSysADM] RE: Pinging with less than 3 octets

Very nice.

The behavior is documented on Windows:

http://msdn.microsoft.com/en-us/library/system.net.ipaddress.parse(v=vs.110).aspx

It's used for building "class-full" IP addresses. Which are obsolete. And it is 
also present in BSD-Unix and in Darwin. I sure as heck don't remember it from 
my Unix days though.

http://en.verysource.com/code/15332_1/inet_addr.c.html
http://www.opensource.apple.com/source/Libinfo/Libinfo-330/dns.subproj/inet_addr.c


From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Crawford, Scott
Sent: Wednesday, September 17, 2014 4:19 PM
To: [email protected]<mailto:[email protected]>
Subject: [NTSysADM] Pinging with less than 3 octets

When pinging, you can leave out the 3rd octet and windows will pad the address 
to fill the missing 3rd octet with 0. This also works if you leave out the 2nd 
and 3rd. Heck, it even works without the 1st :)

I've noticed this for quite a while, but have never seen it discussed. Can 
anyone tell me why this works? Is it in a spec? Or, just an interesting 
anomaly? I use it as a shortcut pretty often and just never bothered to 
research it much.

C:\>ping 10.1.1
Pinging 10.1.0.1 with 32 bytes of data:

C:\>ping 10.1
Pinging 10.0.0.1 with 32 bytes of data:

C:\>ping 10
Pinging 0.0.0.10 with 32 bytes of data:

Reply via email to