apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Pryor <ppryo...@gmail.com>
Subject [PATCH] AIX's broken IN6_IS_ADDR_V4MAPPED macro
Date Fri, 19 Jun 2009 21:22:48 GMT
Here's the patch to work around AIX's broken IN6_IS_ADDR_V4MAPPED
which caused regression test to fail.

diff -Nuar apr-1.3.5.orig/network_io/unix/sockaddr.c
apr-1.3.5/network_io/unix/sockaddr.c
--- apr-1.3.5.orig/network_io/unix/sockaddr.c   2009-02-19
21:31:27.000000000 -0500
+++ apr-1.3.5/network_io/unix/sockaddr.c        2009-06-19
14:51:50.000000000 -0400
@@ -68,6 +68,15 @@
 }
 #endif

+/* work around broken AIX implementation */
+#ifdef _AIX
+#undef IN6_IS_ADDR_V4MAPPED
+#define IN6_IS_ADDR_V4MAPPED(a) \
+        ((((a)->s6_addr32)[0] == 0) && \
+         (((a)->s6_addr32)[1] == 0) && \
+         (((a)->s6_addr32)[2] == 0x0000ffff))
+#endif
+
 static apr_status_t get_local_addr(apr_socket_t *sock)
 {
     sock->local_addr->salen = sizeof(sock->local_addr->sa);


The actual macro used by AIX is as follows:

#define IS_IPV4ADDR6(a) \
        (((a).s6_addr32[0] == 0) && \
         ((a).s6_addr32[1] == 0) && \
         ((a).s6_addr32[2] == 0x0000ffff) && \
         ((a).s6_addr32[3] != 0))

We do not need the last test which checks to make sure IPV4 is not
zero. It does not matter what IPV4 is set to, as long as we know it
has been prefixed with IPV6.

Mime
View raw message