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 */


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to