[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bindv6only again



On Mon, Apr 26, 2010 at 07:54:53PM +0200, Julien Cristau wrote:
> On Mon, Apr 26, 2010 at 19:30:14 +0200, Josselin Mouette wrote:
> > Good. Now if you or one of those who advocate this "broken by default"
> > behavior could provide patches for gdm3, this would be more productive.
> > 
> Not that I advocate the broken current default, but here's a
> not-even-build-tested patch against master.

[...]

> +#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
> +
>          if (bind (sock, ai->ai_addr, ai->ai_addrlen) < 0) {
>                  g_warning ("bind: %s", g_strerror (errno));
>                  close (sock);

I didn't look at the source, but if it's already using
getaddrinfo() and going over all the addresses it returned,
I don't see why it should be broken with either value of
the option.

So I can only assume that it doesn't go over all the
addresses returned by getaddrinfo(), and that that is 
the real issue.

I also think that applications should set it to 1, so I would
disagree with that patch.  And it would still have a problem
on an OS that doesn't allow you to set that to 0.


Kurt


Reply to: