问题
My application needs to list all network interafaces on a machine and their IPs, IPv4 and IPv6.
I can get all interfaces with IPv4 IPs using ioctl(SIOCGIFCONF), but I need the IPv6 IPs, too.
On Linux, those can get gotten from /proc/net/if_inet6, but where would I get them on FreeBSD ?
回答1:
getifaddrs(3) provides portable way to get network addresses and interface names.
来源:https://stackoverflow.com/questions/7629164/enumerate-all-network-interfaces-with-ips-on-freebsd