Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] PostgreSQL 8.0.3 and Ipv6

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Petr Jelinek <pjmodos(at)seznam(dot)cz>,Magnus Hagander <mha(at)sollentuna(dot)net>, voss(at)arnet(dot)com(dot)br,Chuck McDevitt <cmcdevitt(at)greenplum(dot)com>,"Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] PostgreSQL 8.0.3 and Ipv6
Date: 2005-08-22 16:30:13
Message-ID: 16773.1124728213@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> Try this instead if you prefer.

I thought this was a little bit too trusting about there being a
getaddrinfo to probe, so I tightened it up as per the attached
applied patch.

Where are we at this point on the Windows/IPv6 issue --- are there
more fixes to come, or is it done?

			regards, tom lane


*** src/bin/initdb/initdb.c.orig	Tue Aug  2 11:16:27 2005
--- src/bin/initdb/initdb.c	Mon Aug 22 12:24:42 2005
***************
*** 54,66 ****
  #include <unistd.h>
  #include <locale.h>
  #include <signal.h>
- #include <errno.h>
  #ifdef HAVE_LANGINFO_H
  #include <langinfo.h>
  #endif
  
  #include "libpq/pqsignal.h"
  #include "mb/pg_wchar.h"
  #include "getopt_long.h"
  
  #ifndef HAVE_INT_OPTRESET
--- 54,66 ----
  #include <unistd.h>
  #include <locale.h>
  #include <signal.h>
  #ifdef HAVE_LANGINFO_H
  #include <langinfo.h>
  #endif
  
  #include "libpq/pqsignal.h"
  #include "mb/pg_wchar.h"
+ #include "getaddrinfo.h"
  #include "getopt_long.h"
  
  #ifndef HAVE_INT_OPTRESET
***************
*** 1210,1220 ****
  	conflines = replace_token(conflines,"@remove-line-for-nolocal@","");
  #endif
  
! #ifndef HAVE_IPV6
  	conflines = replace_token(conflines,
  							  "host    all         all         ::1",
  							  "#host    all         all         ::1");
! #endif
  
  	/* Replace default authentication methods */
  	conflines = replace_token(conflines,
--- 1210,1251 ----
  	conflines = replace_token(conflines,"@remove-line-for-nolocal@","");
  #endif
  
! #if defined(HAVE_IPV6) && defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO)
! 	/* 
! 	 * 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.
! 	 *
! 	 * We don't bother with testing if we aren't using the system version
! 	 * of getaddrinfo, since we know our own version doesn't do IPv6.
! 	 */
! 	{
! 		struct addrinfo *gai_result;
! 		struct addrinfo hints;
! 
! 		/* 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 (getaddrinfo("::1", NULL, &hints, &gai_result) != 0)
! 			conflines = replace_token(conflines,
! 									  "host    all         all         ::1",
! 									  "#host    all         all         ::1");
! 	}
! #else /* !HAVE_IPV6 etc */
! 	/* 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 etc */
  
  	/* Replace default authentication methods */
  	conflines = replace_token(conflines,

In response to

Responses

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2005-08-22 16:30:43
Subject: Re: Sleep functions
Previous:From: Hannu KrosingDate: 2005-08-22 15:55:31
Subject: Re: Missing CONCURRENT VACUUM (Was: Release notes for

pgsql-patches by date

Next:From: Andrew DunstanDate: 2005-08-22 17:24:44
Subject: Re: [HACKERS] PostgreSQL 8.0.3 and Ipv6
Previous:From: Palle GirgensohnDate: 2005-08-22 14:19:00
Subject: Re: Win32 unicode vs ICU

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group