Re: bindv6only again
Florian Weimer, le Tue 27 Apr 2010 09:15:12 +0200, a écrit :
> * Julien Cristau:
>
> > +#if defined(ENABLE_IPV6) && defined(IPV6_V6ONLY)
> > + if (ai->ai_family == AF_INET6) {
> > + int zero = 0;
> > + if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &zero, sizeof(zero)) < 0)
> > + g_warning("setsockopt(IPV6_V6ONLY): %s", g_strerror(errno));
> > + }
> > +#endif
> > +
>
> Isn't it a bug in getaddrinfo that it doesn't do that on its own?
How could it? getaddrinfo doesn't deal with sockets, only with
addresses.
> Or does it return multiple sockets in this case?
It doesn't return sockets, it returns addresses. If a hostname has both
an IPv4 and an IPv6 record, getaddrinfo will return both an AF_INET
address and an AF_INET6 address.
Samuel
Reply to: