[arin-tech-discuss] zero-padded IP addresses in "startAddress" and "endAddress" values

Andy Newton andy at arin.net
Fri Mar 30 08:54:14 EDT 2012

On Mar 30, 2012, at 4:06 AM, Seth Mattinen wrote:

> I personally treat IP addresses as unsigned integers (or double/float
> for IPv6). It never occurred to me to treat an IP as a string since it's
> supposed to represent a 32-bit or 128-bit number. Integer comparisons
> are, IMO, easier.


Interpretation of IP addresses as numbers makes complete sense. But I will note that some languages do not have unsigned integers and double and float on many platforms, languages, and databases are only 64 bits. Float can be particularly troublesome as IEEE 754 interpretations of it only give 56 bits of precision.

Comparison as a numeric type is also natural, but in a database where an IP address column is indexed that difference is only important for an r-tree index which are not very common. Additionally in a database context, substring matching can be used for prefix queries, though admittedly only on octet boundaries.

Like you, my first inclination as a programmer is to treat IP addresses as numbers. And when I first encountered the usage of zero-padded IP address strings, doing so had never occurred to me. That being said, in my career ARIN is not the first place I have seen this, and in the ARIN codebases we have found this pattern many times, implemented by multiple coders in many subsystems, going back to code that well predates ARIN.

That long-winded explanation aside, we can certainly take steps to make programming against the Reg-RWS interface easier if the community desires. New elements can be added that do not have the zero-padded IP addresses. I do not recommend modifying the current elements as we may break code that counts on the zero padding. And, as David stated, we should update our documentation. Would adding new elements containing IP addresses that are not zero-padded be helpful?

Andy Newton

More information about the arin-tech-discuss mailing list