Re: Windows + IP6 progress

From: "Chuck McDevitt" <cmcdevitt(at)greenplum(dot)com>
To: "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Windows + IP6 progress
Date: 2005-08-18 23:35:58
Message-ID: BB05A27C22288540A3A3E8F3749B45AB01500A1D@MI8NYCMAIL06.Mi8.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

IPv6 exists in a "production quality" state only in XP sp1, XP sp2, and
Windows 2003.

There was an optional prototype stack for 2000, but not production
quality and not installed by default. XP non-service-pack had IPv6,
but not production-quality.

One thing you could do is dynamically load getaddrinfo from ws2_32.dll
at run time. If the DLL doesn't exist, or getaddrinfo isn't in that
ws2_32.dll, you could then fail gracefully (somehow).

You call something like:

hWs2_32 = LoadLibraryA("ws2_32.dll");
if (hWs2_32)
{
Getaddrinfoptr = GetProcAddress(hWs2_32, "getaddrinfo");
}

The GetProcAddress will return null if getaddrinfo doesn't exist, and a
pointer to the routine if it does.

> -----Original Message-----
> From: pgsql-hackers-owner(at)postgresql(dot)org [mailto:pgsql-hackers-
> owner(at)postgresql(dot)org] On Behalf Of Andrew Dunstan
> Sent: Thursday, August 18, 2005 3:17 PM
> To: PostgreSQL-development
> Subject: [HACKERS] Windows + IP6 progress
>
>
> I have just managed to get pg server and client (cvs tip) talking IPv6
> on Windows. :-)
>
> 1. Building
> - added in library in configure.in:
> AC_CHECK_LIB(ws2_32, main)
> - faked out getaddrinfo test in resulting configure and force
answer
> to "yes"
> - added these lines to src/include/port/win32/sys/socket.h:
> #include <ws2tcpip.h>
> #define gai_strerrorA(err) "undetermined getaddrinfo error"
>
> After installation and initdb, I edited postgresql.conf to set
> listen_addresses to '127.0.0.1, ::1' just to make sure what we were
> getting.
>
> 2. Running without IPv6 driver installed.
> The build works, although it complains about IPv6 addresses. But I
> could run it with IPv4 addresses quite happily - the IPv6 addresses
just
> fail, but they don't stop us running.
>
> 3. Running with IPv6 driver installed
> Now the build does not complain about IPv6 addresses (either in
> pg_hba.conf or postgresql.conf)
> And this command works: psql -h ::1 -l
>
>
> So the remaining questions are:
> . what do we do about the getaddrinfo test? I'm almost inclined not to
> do it on windows, and assume that if we have ws2_32.dll we have it.
> . what to do about the gai_strerror mess (import our own but leave out
> our own getaddrinfo?)
> . make sure that this doesn't break less modern Windows platforms than
> mine (XP Pro SP1). How ubiquitous is ws2_32.dll?
>
> I have asked a few people to test this build. I don't want to publish
> its location openly, but if anyone wants to help they can drop me an
> email. Alternatively, some kind person could provide a site on a nice
> fat pipe for an 18Mb download.
>
>
> cheers
>
> andrew
>
> ---------------------------(end of
broadcast)---------------------------
> TIP 6: explain analyze is your friend

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2005-08-18 23:44:10 Re: Windows + IP6 progress
Previous Message Tom Lane 2005-08-18 23:18:15 Re: t_ctid chains