[svlug] A network programming question (because why not)
Sarah Newman
sarah.newman at computer.org
Fri Nov 12 20:51:08 PST 2021
Is there a better way than getaddrinfo to find out if there is usable IPv6 on Linux that doesn't involve checking /proc or /sys ? Is the only option
to try to actually create a socket of domain AF_INET6?
With getaddrinfo and AI_ADDRCONFIG set, the library will not return IPv6 results without an IPv6 address, but it also won't resolve a host if only
localhost is up and not an actual routable interface.
Without AI_ADDRCONFIG, if the libraries will resolve IPv6, getaddrinfo returns IPv6 results, even if IPv6 is disabled in the kernel and can't actually
be used.
--Sarah
More information about the svlug
mailing list