Friday, 23 August 2013

What address families can getaddrinfo return?

What address families can getaddrinfo return?

When I call getaddrinfo with AF_UNSPEC, it can return any address families
it likes: AF_INET, AF_INET6, maybe AppleTalk, bluetooth, datalink, netlink
addresses...
On FreeBSD, it can only return AF_INET or AF_INET6 (checked in source)
On linux, ditto (according to glibc manpage)
What about other systems? Are there platforms where we might get other
address structures?
I'm particularly suspicious of MacOS - the source seems to be missing from
opensource.apple.com/source/Libc and the manpage doesn't say. We have a
vague log file that may indicate getaddrinfo returned some other address
family. Other platforms we support are AIX, Windows, Solaris, HP-UX.
I'm aware I can just check the family in the structure returned. I can't
guess what interesting strings and hints might need to be used to get
non-AF_INET(6) results out though.

No comments:

Post a Comment