On Thu, Aug 14, 2003 at 05:48:38PM -0400, John K. Sterling wrote:
> On Thursday, August 14, 2003, at 05:20 PM, Colm MacCarthaigh,,, wrote:
>
> >Can you just confirm it's listening in v6 only ? the output of
> >"netstat -an | grep LISTEN" (Darwin has netstat and grep, right?)
> >should be enough.
>
> heh. very funny:
>
> % netstat -an | grep LISTEN
> tcp46 0 0 *.80 *.*
> LISTEN
good good, patch works so :) In which I'll now cc [EMAIL PROTECTED] and include
the neccessary autoconf voodoo to fix OSX/Darwin.
--
Colm MacC�rthaigh Public Key: [EMAIL PROTECTED]
[EMAIL PROTECTED] http://www.stdlib.net/
Index: configure.in
===================================================================
RCS file: /home/cvspublic/apr/configure.in,v
retrieving revision 1.531
diff -u -r1.531 configure.in
--- configure.in 11 Aug 2003 17:40:38 -0000 1.531
+++ configure.in 14 Aug 2003 22:40:37 -0000
@@ -1778,17 +1778,6 @@
fi ],
[ user_disabled_ipv6=0 ] )
-case $host in
- *apple-darwin*)
- # It appears that Jaguar has all the right features, but
- # getnameinfo() fails to find the hostname for a mapped
- # address.
- broken_ipv6=1
- ;;
- *)
- broken_ipv6=0
-esac
-
AC_SEARCH_LIBS(getaddrinfo, socket inet6)
AC_SEARCH_LIBS(gai_strerror, socket inet6)
AC_SEARCH_LIBS(getnameinfo, socket inet6)
@@ -1803,23 +1792,19 @@
if test "$user_disabled_ipv6" = 1; then
AC_MSG_RESULT([no -- disabled by user])
else
- if test "x$broken_ipv6" = "x0"; then
- if test "x$have_sockaddr_in6" = "x1"; then
- if test "x$ac_cv_working_getaddrinfo" = "xyes"; then
- if test "x$ac_cv_working_getnameinfo" = "xyes"; then
- have_ipv6="1"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no -- no getnameinfo])
- fi
+ if test "x$have_sockaddr_in6" = "x1"; then
+ if test "x$ac_cv_working_getaddrinfo" = "xyes"; then
+ if test "x$ac_cv_working_getnameinfo" = "xyes"; then
+ have_ipv6="1"
+ AC_MSG_RESULT([yes])
else
- AC_MSG_RESULT([no -- no working getaddrinfo])
+ AC_MSG_RESULT([no -- no getnameinfo])
fi
else
- AC_MSG_RESULT([no -- no sockaddr_in6])
+ AC_MSG_RESULT([no -- no working getaddrinfo])
fi
else
- AC_MSG_RESULT([no -- the platform has problems supporting IPv6])
+ AC_MSG_RESULT([no -- no sockaddr_in6])
fi
fi
Index: network_io/unix/sockaddr.c
===================================================================
RCS file: /home/cvspublic/apr/network_io/unix/sockaddr.c,v
retrieving revision 1.41
diff -u -r1.41 sockaddr.c
--- network_io/unix/sockaddr.c 14 Aug 2003 17:36:17 -0000 1.41
+++ network_io/unix/sockaddr.c 14 Aug 2003 22:40:38 -0000
@@ -634,9 +634,28 @@
* a numeric address string if it fails to resolve the host name;
* that is *not* what we want here
*/
+#ifdef DARWIN && APR_HAVE_IPV6
+ /* Darwin's getnameinfo does not work for IPv4-mapped-IPv6 addresses,
+ * the workaround is to convert the last 32 bits of the IPv6 address
+ * to a valid sockaddr_in structure. This is extremely hacky, avoid
+ * re-use. */
+ if (sockaddr->family == AF_INET6 &&
IN6_IS_ADDR_V4MAPPED(&sockaddr->sa.sin6.sin6_addr))
+ {
+ struct apr_sockaddr_t tmpsa;
+
+ tmpsa.sa.sin.sin_family = AF_INET;
+ tmpsa.sa.sin.sin_addr.s_addr = ((uint32_t *)sockaddr->ipaddr_ptr)[3];
+
+ rc = getnameinfo((const struct sockaddr *)&tmpsa.sa, sizeof(struct
sockaddr_in),
+ tmphostname, sizeof(tmphostname), NULL, 0,
+ flags != 0 ? flags : NI_NAMEREQD);
+ }
+ else
+#endif
rc = getnameinfo((const struct sockaddr *)&sockaddr->sa, sockaddr->salen,
tmphostname, sizeof(tmphostname), NULL, 0,
flags != 0 ? flags : NI_NAMEREQD);
+
if (rc != 0) {
*hostname = NULL;