Is there any documentation for omitting zeroes in dot-decimal notation of IPv4 addresses?

StackOverflow https://stackoverflow.com/questions/10133820

  •  31-05-2021
  •  | 
  •  

Question

I’ve noticed that Linux and *BSD systems allow user to skip octets when using dot-decimal notation.

Here are some examples:

$ ping 10.1
PING 10.1 (10.0.0.1) 56(84) bytes of data.

$ ping 10.15.1
PING 10.15.1 (10.15.0.1) 56(84) bytes of data.

Note that this isn’t limited to the ping command.

I’ve found document defining textual representations of IPv4, but it doesn’t seem to cover that feature: Textual Representation of IPv4 and IPv6 Addresses.

Is there any other document defining this behavior? Is there a specific name for this behavior?

Was it helpful?

Solution

See inet_aton() man page. The last part is the numerical value representing the contents of the remaining bits in the address, i.e., a 24-bit y in x.y, and a 16-bit z in x.y.z.

OTHER TIPS

Abbreviated prefixes.

https://tools.ietf.org/html/rfc3779

prefix - a bit string that consists of some number of initial bits of an address, written as an address followed by a "/", and the number of initial bits. 10.5.0.0/16 and 2001:0:200:3:0:0:0:0/64 (or 2001:0:200:3::/64) are examples of prefixes. A prefix is often abbreviated by omitting the less-significant zero fields, but there should be enough fields to contain the indicated number of initial bits. 10.5/16 and 2001:0:200:3/64 are examples of abbreviated prefixes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top