A network programming question (because why not)
Sarah Newman <[email protected]> Fri, 12 Nov 2021 20:51:08 -0800
| Newsgroups | gmane.org.user-groups.linux.svlug |
|---|---|
| Message-ID | <[email protected]> |
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