summaryrefslogtreecommitdiff
path: root/ext/sockets
diff options
context:
space:
mode:
authorFelipe Pena <felipensp@gmail.com>2013-11-30 11:40:42 -0200
committerFelipe Pena <felipensp@gmail.com>2013-11-30 11:40:42 -0200
commita2f478cd945eb3344c0d2acbcdbbd10e97c1f2c3 (patch)
treedb83d7b5df4ea00521a47c81497e04d8396649a3 /ext/sockets
parent2e6d8305907feec5fd971fd62d982112f5151ce2 (diff)
parent78f69a2b4f368058e9798c7ef1f733e783bfd220 (diff)
downloadphp-git-a2f478cd945eb3344c0d2acbcdbbd10e97c1f2c3.tar.gz
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: - Fixed bug #65923 (ext/socket assumes AI_V4MAPPED is defined)
Diffstat (limited to 'ext/sockets')
-rw-r--r--ext/sockets/config.m421
-rw-r--r--ext/sockets/sockaddr_conv.c4
2 files changed, 21 insertions, 4 deletions
diff --git a/ext/sockets/config.m4 b/ext/sockets/config.m4
index 9c75249646..a5a63dfb61 100644
--- a/ext/sockets/config.m4
+++ b/ext/sockets/config.m4
@@ -16,10 +16,10 @@ if test "$PHP_SOCKETS" != "no"; then
if test "$ac_cv_cmsghdr" = yes; then
AC_DEFINE(HAVE_CMSGHDR,1,[Whether you have struct cmsghdr])
- fi
+ fi
AC_CHECK_FUNCS([hstrerror socketpair if_nametoindex if_indextoname])
- AC_CHECK_HEADERS([netdb.h netinet/tcp.h sys/un.h sys/sockio.h errno.h])
+ AC_CHECK_HEADERS([netdb.h netinet/tcp.h sys/un.h sys/sockio.h errno.h])
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
@@ -27,7 +27,7 @@ if test "$PHP_SOCKETS" != "no"; then
[AC_DEFINE(MISSING_MSGHDR_MSGFLAGS, 1, [ ])]
)
AC_DEFINE([HAVE_SOCKETS], 1, [ ])
-
+
dnl Check for fied ss_family in sockaddr_storage (missing in AIX until 5.3)
AC_CACHE_CHECK([for field ss_family in struct sockaddr_storage], ac_cv_ss_family,
[
@@ -38,11 +38,24 @@ if test "$PHP_SOCKETS" != "no"; then
], [struct sockaddr_storage sa_store; sa_store.ss_family = AF_INET6;],
ac_cv_ss_family=yes, ac_cv_ss_family=no)
])
-
+
if test "$ac_cv_ss_family" = yes; then
AC_DEFINE(HAVE_SA_SS_FAMILY,1,[Whether you have sockaddr_storage.ss_family])
fi
+ dnl Check for AI_V4MAPPED flag
+ AC_CACHE_CHECK([if getaddrinfo supports AI_V4MAPPED],[ac_cv_gai_ai_v4mapped],
+ [
+ AC_TRY_COMPILE([
+#include <netdb.h>
+ ], [int flag = AI_V4MAPPED;],
+ ac_cv_gai_ai_v4mapped=yes, ac_cv_gai_ai_v4mapped=no)
+ ])
+
+ if test "$ac_cv_gai_ai_v4mapped" = yes; then
+ AC_DEFINE(HAVE_AI_V4MAPPED,1,[Whether you have AI_V4MAPPED])
+ fi
+
PHP_NEW_EXTENSION([sockets], [sockets.c multicast.c conversions.c sockaddr_conv.c sendrecvmsg.c], [$ext_shared])
PHP_INSTALL_HEADERS([ext/sockets/], [php_sockets.h])
fi
diff --git a/ext/sockets/sockaddr_conv.c b/ext/sockets/sockaddr_conv.c
index 64523c3191..bc1131a734 100644
--- a/ext/sockets/sockaddr_conv.c
+++ b/ext/sockets/sockaddr_conv.c
@@ -27,7 +27,11 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_INET6;
+#if HAVE_AI_V4MAPPED
hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG;
+#else
+ hints.ai_flags = AI_ADDRCONFIG;
+#endif
getaddrinfo(string, NULL, &hints, &addrinfo);
if (!addrinfo) {
#ifdef PHP_WIN32