-static char *get_ipv6_addr() {
- struct addrinfo hints;
- struct addrinfo *result, *resp;
- static struct addrinfo *cached = NULL;
-
- /* To save dns lookups (if they are not cached locally) and creating
- * sockets, we save the fd and keep it open. */
- if (cached != NULL)
- return get_sockname(cached);
-
- memset(&hints, 0, sizeof(struct addrinfo));
- hints.ai_family = AF_INET6;
-
- /* We resolve the K root server to get a public IPv6 address. You can
- * replace this with any other host which has an AAAA record, but the
- * K root server is a pretty safe bet. */
- if (getaddrinfo("k.root-servers.net", "domain", &hints, &result) != 0) {
- /* We don’t display the error here because most
- * likely, there just is no connectivity.
- * Thus, don’t spam the user’s console. */
- return NULL;
- }
+static char *get_ipv6_addr(void) {
+ struct addrinfo hints;
+ struct addrinfo *result, *resp;
+ static struct addrinfo *cached = NULL;