Subject: getnameinfo() and AF_LINK
To: None <firstname.lastname@example.org>
From: Ben Harris <email@example.com>
Date: 09/18/2001 19:02:15
Having introduced a new link-layer type to NetBSD, I wanted to ensure that
tools like ifconfig and netstat could print its addresses properly, and
found that each of them seemed to have its own (different) code to do the
job. I'd like to fix this, and give us a standard way of displaying
Now, we have got a routine, link_aton(), which does this already, and is
used as a fallback by "route show" and "netstat -r", but I'm reluctant to
soup it up to correctly support all link types because:
* Its manual page specifies the precise format it will return results in,
and presumably has done so forever, so changing that format may break
programs using it.
* The man page suggests that it's meant to be a precise inverse of
link_addr(), which requires textual formats of link addresses to be
unambiguous, which they probably won't be.
* It uses static storage, which is Evil, Bad and Wrong.
* It provides no way to supply extra suggestions to the translation (e.g.
whether to mention the interface name).
For this reason, I'd prefer to add support for formatting AF_LINK
addresses to getnameinfo(), and to have it format addresses into a
sensible, human-readable format suitable for their ifType, and then get
"ifconfig", "route show", "netstat -i", "netstat -r", "arp" and "ndp" to
use this rather than their own hacks.
Ben Harris <firstname.lastname@example.org>
Portmaster, NetBSD/arm26 <URL:http://www.netbsd.org/Ports/arm26/>