-
-/* Resolve HOST to get an address for use with bind(2). Do *not* use
- this for sockets to be used with connect(2).
-
- This is a function separate from lookup_host because the results it
- returns are different -- it uses the AI_PASSIVE flag to
- getaddrinfo. Because of this distinction, it doesn't store the
- results in the cache. It prints nothing and implements no timeouts
- because it should normally only be used with local addresses
- (typically "localhost" or numeric addresses of different local
- interfaces.)
-
- Without IPv6, this function just calls lookup_host. */
-
-struct address_list *
-lookup_host_passive (const char *host)
-{
-#ifdef ENABLE_IPV6
- struct address_list *al = NULL;
- int err;
- struct addrinfo hints, *res;
-
- xzero (hints);
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_family = AF_UNSPEC; /* #### should look at opt.ipv4_only
- and opt.ipv6_only */
- hints.ai_flags = AI_PASSIVE;
-
- err = getaddrinfo (host, NULL, &hints, &res);
- if (err != 0 || res == NULL)
- return NULL;
- al = address_list_from_addrinfo (res);
- freeaddrinfo (res);
- return al;
-#else
- return lookup_host (host, 1);
-#endif
-}