Re: back branches vs. VS 2008

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: back branches vs. VS 2008
Date: 2011-01-04 03:49:01
Message-ID: 4D2298AD.1000005@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 01/03/2011 12:15 PM, I wrote:
>
> The following patch allows me to build the 8.3 and 8.4 branches using
> Visual Studio 2008, once the build system is patched. But I don't
> really know why. HEAD and 9.0 build fine without it. But those
> branches branches fail with a complaint about IPPROTO_IPV6 being
> undefined.
>
> The patch seems harmless enough. But I'd like to know why it's
> happening. Does anyone have a clue?
>
>
> -#ifdef IPV6_V6ONLY
> +#if defined(IPV6_V6ONLY) && defined(IPPROTO_IPV6)
> if (addr->ai_family == AF_INET6)
> {
> if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY,

OK, what's going here is that, in the newer SDK, IPV6_V6ONLY is defined
unconditionally, but IPPROTO_IPV6 is only defined if _WIN32_WINNT is set
to 0x0501 or higher. We defined _WIN32_WINNT as 0x0500 until 9.0, when
we changed it specifically to allow use of the right IPV6 settings.

This seems to me like a clear error in the MS headers. I don't think it
makes any sense to define the settings constant but not the context
constant. The fix I have suggested above doesn't seem unreasonable or
terribly unsafe in these circumstances. The code clearly contemplates
the setsockopt() call in question not having been run, as shown in this
comment:

/*
* Note: This might fail on some OS's, like Linux older than
* 2.4.21-pre3, that don't have the IPV6_V6ONLY socket option,
and map
* ipv4 addresses to ipv6. It will show ::ffff:ipv4 for all ipv4
* connections.
*/

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-01-04 04:13:04 Re: Re: [COMMITTERS] pgsql: Reduce spurious Hot Standby conflicts from never-visible records
Previous Message Dave Page 2011-01-04 03:26:01 Re: back branches vs. VS 2008