Python and ipaddr.py
Posted Jun 18, 2009 2:26 UTC (Thu) by
gdt (subscriber, #6284)
Parent article:
Python and ipaddr.py
I am a network engineer. The conflation of IP addresses; IP routing prefixes; IP access lists masks; inverse masks; 32-bit numbers which are convenient to print in dotted-quad format (eg, OSPF areas) really annoys me. Tools which do this encourage sloppy thinking, leading to routing prefixes without lengths or firewall rules which can't ignore just part of an address (such as the subnet component of a EUI-64 address).
To see what I mean, consider a function is_multicast(). Handing that a bitmask or a 32-bit number (as opposed to an address or a routing prefix) should result in an error. But that's exactly the API bug which prevents OSPF areas starting with 224. on a certain make of router.
Similarly, a function ipv4_to_ipv4_mapped_ipv6() should only accept IPv4 addresses; not routing prefixes, OSPF areas, or bitmasks.
Another good example is Wireshark. It conflates all of these things. Which makes it difficult to add code like is_iana_allocated() to check all routing prefixes and indicate those which should not be seen in the wild. Every printing of an IP address needs to be examined, rather than updating a generic route prefix printing function.
(
Log in to post comments)