getifaddrs: use if_nameindex to enumerate interfaces