3729 getifaddrs must learn to stop worrying and love the other address families

Review Request #318 - Created Jan. 4, 2017 and updated - Latest diff uploaded

Sebastian Wiedenroth

Presently getifaddrs enumerates network interface addresses only from AF_INET and AF_INET6.
This is contrary to the expectations of a small set of software (e.g. dhcpcd, olsrd) which expects this function to deal also in AF_LINK.

With this change getifaddrs() also returns AF_LINK entries, supplying the MAC address in 'ifa_addr' and a reasonably filled 'if_data_t' in 'ifa_data'.
This should be sufficient for most applications that are interested in things like the MAC address or the MTU.

Booted OI with this change, ran a small tool that prints the getifaddrs() details.
Ran the test tool with and without the environment variable GETIFADDRS_MAY_RETURN_AF_LINK=1 set.
Rebuild the test tool and retried.

Ran with libumem and ::findleaks on the test tool (that also calls freeifaddrs()) in all four combinations.