mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-18 18:44:06 +08:00
Fix IPv6 detection and IPv6 to 4 conversion to use only standard
interfaces.
This commit is contained in:
parent
2e98da5246
commit
9df2c44032
34
configure
vendored
34
configure
vendored
@ -10027,16 +10027,16 @@ fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_func_getaddrinfo" >&5
|
||||
echo "${ECHO_T}$ac_cv_func_getaddrinfo" >&6
|
||||
if test $ac_cv_func_getaddrinfo = yes; then
|
||||
echo "$as_me:$LINENO: checking for struct sockaddr_in6.sin6_len" >&5
|
||||
echo $ECHO_N "checking for struct sockaddr_in6.sin6_len... $ECHO_C" >&6
|
||||
if test "${ac_cv_member_struct_sockaddr_in6_sin6_len+set}" = set; then
|
||||
echo "$as_me:$LINENO: checking for struct sockaddr_in6" >&5
|
||||
echo $ECHO_N "checking for struct sockaddr_in6... $ECHO_C" >&6
|
||||
if test "${ac_cv_type_struct_sockaddr_in6+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
$ac_includes_default
|
||||
#include <netinet/in.h>
|
||||
|
||||
#ifdef F77_DUMMY_MAIN
|
||||
# ifdef __cplusplus
|
||||
@ -10047,9 +10047,10 @@ else
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static struct sockaddr_in6 ac_aggr;
|
||||
if (ac_aggr.sin6_len)
|
||||
return 0;
|
||||
if ((struct sockaddr_in6 *) 0)
|
||||
return 0;
|
||||
if (sizeof (struct sockaddr_in6))
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@ -10066,23 +10067,18 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_member_struct_sockaddr_in6_sin6_len=yes
|
||||
ac_cv_type_struct_sockaddr_in6=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_cv_member_struct_sockaddr_in6_sin6_len=no
|
||||
ac_cv_type_struct_sockaddr_in6=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_member_struct_sockaddr_in6_sin6_len" >&5
|
||||
echo "${ECHO_T}$ac_cv_member_struct_sockaddr_in6_sin6_len" >&6
|
||||
if test $ac_cv_member_struct_sockaddr_in6_sin6_len = yes; then
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN 1
|
||||
_ACEOF
|
||||
|
||||
HAVE_IPV6="yes"; cat >>confdefs.h <<\_ACEOF
|
||||
echo "$as_me:$LINENO: result: $ac_cv_type_struct_sockaddr_in6" >&5
|
||||
echo "${ECHO_T}$ac_cv_type_struct_sockaddr_in6" >&6
|
||||
if test $ac_cv_type_struct_sockaddr_in6 = yes; then
|
||||
HAVE_IPV6="yes"; cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_IPV6 1
|
||||
_ACEOF
|
||||
|
||||
|
12
configure.in
12
configure.in
@ -1,5 +1,5 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl $Header: /cvsroot/pgsql/configure.in,v 1.230 2003/01/07 06:43:20 momjian Exp $
|
||||
dnl $Header: /cvsroot/pgsql/configure.in,v 1.231 2003/01/09 14:34:53 petere Exp $
|
||||
dnl
|
||||
dnl Developers, please strive to achieve this order:
|
||||
dnl
|
||||
@ -788,11 +788,11 @@ AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
|
||||
|
||||
# This exports HAVE_IPV6 to both C files and Makefiles
|
||||
AC_CHECK_FUNC(getaddrinfo,
|
||||
[AC_CHECK_MEMBERS(struct sockaddr_in6.sin6_len,
|
||||
[HAVE_IPV6="yes"; AC_DEFINE(HAVE_IPV6, 1, [])], [],
|
||||
[#include <sys/socket.h>
|
||||
#include <netdb.h>])],
|
||||
[])
|
||||
[AC_CHECK_TYPE(struct sockaddr_in6,
|
||||
[HAVE_IPV6="yes"; AC_DEFINE(HAVE_IPV6, 1)],
|
||||
[],
|
||||
[$ac_includes_default
|
||||
#include <netinet/in.h>])])
|
||||
AC_SUBST(HAVE_IPV6)
|
||||
|
||||
AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/ip.c,v 1.1 2003/01/06 03:18:26 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/ip.c,v 1.2 2003/01/09 14:35:03 petere Exp $
|
||||
*
|
||||
* This file and the IPV6 implementation were initially provided by
|
||||
* Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
|
||||
@ -365,7 +365,11 @@ convSockAddr6to4(const SockAddr *src, SockAddr *dst)
|
||||
dst->in.sin_family = AF_INET;
|
||||
dst->in.sin_port = src->in6.sin6_port;
|
||||
|
||||
dst->in.sin_addr.s_addr = src->in6.sin6_addr.s6_addr32[3];
|
||||
dst->in.sin_addr.s_addr =
|
||||
(src->in6.sin6_addr.s6_addr[15])
|
||||
+ (src->in6.sin6_addr.s6_addr[14] << 8)
|
||||
+ (src->in6.sin6_addr.s6_addr[13] << 16)
|
||||
+ (src->in6.sin6_addr.s6_addr[12] << 24);
|
||||
SockAddr_ntop(src, addr_str, INET6_ADDRSTRLEN, 0);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user