getaddrinfo retuns ipv6 addres (::1) when resolving localhost in Solaris 10
807557Nov 3 2008 — edited Nov 3 2008hi All,
i have a problem with getaddrinfo when trying to resolve localhost and the host is not configured for ipv6 address but has ipv6 support enabled (default)
getaddrinfo called with hints set to get only INET6 address is returning ::1 even when the machine is not configured for ipv6 addresses (i.e. ::1 loopback address does not exist) and /etc/hosts file does not have an entry for ::1. When i try binding to the returned address i get a Address not available error (as the address does not exist).
Looking up getaddrinfo man page i found AI_ADDRCONFIG which returns ipv6 address only if the localhost has atlest one ipv6 address other than the loopback address. But this does not fit my requirement, in cases where a different host other than has a ipv6 address and i want to resolve it even if the local system does not have ipv6 address configured (but still supports ipv6 - i.e can understand ipv6)
thank you
Regards
rakesh