Re: Vista/IPv6

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Dave Page <dpage(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Vista/IPv6
Date: 2007-04-11 15:06:54
Message-ID: 461CF98E.9050903@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut wrote:
> Am Mittwoch, 11. April 2007 16:46 schrieb Magnus Hagander:
>
>> Point being - if you build on a ipv6 enabled machine, will that binary then
>> work at all on a non-ipv6 machine? Consider binaries distributed by the
>> installer... Might as well think up the proper fix before we just band-aid
>> it for the regression tests..
>>
>
> The check is done by initdb (not on the build machine) and it checks if
> getaddrinfo("::1", ...) works. If that doesn't work then you don't have IPv6
> for all practical purposes. So everything seems to be set up all right.
>
>
There is a configure time and a runtime check. The code is below - note
the first #ifdef.

cheers

andrew

#ifdef HAVE_IPV6

/*
* Probe to see if there is really any platform support for IPv6, and
* comment out the relevant pg_hba line if not. This avoids runtime
* warnings if getaddrinfo doesn't actually cope with IPv6.
Particularly
* useful on Windows, where executables built on a machine with IPv6 may
* have to run on a machine without.
*/
{
struct addrinfo *gai_result;
struct addrinfo hints;
int err = 0;

#ifdef WIN32
/* need to call WSAStartup before calling getaddrinfo */
WSADATA wsaData;

err = WSAStartup(MAKEWORD(2, 2), &wsaData);
#endif

/* for best results, this code should match parse_hba() */
hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = 0;
hints.ai_protocol = 0;
hints.ai_addrlen = 0;
hints.ai_canonname = NULL;
hints.ai_addr = NULL;
hints.ai_next = NULL;

if (err != 0 ||
getaddrinfo("::1", NULL, &hints, &gai_result) != 0)
conflines = replace_token(conflines,
"host all all ::1",
"#host all all
::1");
}
#else /* !HAVE_IPV6 */
/* If we didn't compile IPV6 support at all, always comment it out */
conflines = replace_token(conflines,
"host all all ::1",
"#host all all ::1");
#endif /* HAVE_IPV6 */

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-04-11 15:21:12 Re: UUID generation functions
Previous Message Tom Lane 2007-04-11 14:58:08 Re: Why need XLogReadBuffer have the paramter "init"?