]> granicus.if.org Git - apache/commitdiff
Correct failure with Listen directives on machines with IPv6 enabled by
authorJustin Erenkrantz <jerenkrantz@apache.org>
Wed, 13 Aug 2003 19:17:45 +0000 (19:17 +0000)
committerJustin Erenkrantz <jerenkrantz@apache.org>
Wed, 13 Aug 2003 19:17:45 +0000 (19:17 +0000)
removing find_default_family() and letting APR determine what should be done
without a hostname.

This patch requires the corollary APR patch to properly call getaddrinfo().

(Justin modified Colm's patch to always walk the old listeners even when
we have an address.  That part of the patch wasn't really relevant.)

Submitted by: Colm MacC�rthaigh <colm@stdlib.net>
Reviewed by: Justin Erenkrantz

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100978 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
server/listen.c

diff --git a/CHANGES b/CHANGES
index def2aacd7588c418365da066b54f236f165b578f..eff45012d7de0180eea3377c449033cf6e9db92f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) Correct failure with Listen directives on machines with IPv6 enabled.
+     [Colm MacCárthaigh <colm@stdlib.net>, Justin Erenkrantz]
+  
   *) Fix a link failure in mod_ssl when the OpenSSL libraries contain
      the ENGINE functions but the engine header files are missing.
      [Cliff Woolley]
index 0ce1143abc864497ba6c2a9b879b156fd1644bdd..a8977d0110fa0494d439846494e98c248b55e892 100644 (file)
@@ -235,38 +235,6 @@ static apr_status_t close_listeners_on_exec(void *v)
 }
 
 
-static void find_default_family(apr_pool_t *p)
-{
-#if APR_HAVE_IPV6
-    /* We know the platform supports IPv6, but this particular
-     * system may not have IPv6 enabled.  See if we can get an
-     * AF_INET6 socket and bind to an ephemeral port.  (On most
-     * systems, getting an AF_INET6 socket is a sufficient test.
-     * On certain levels of OpenUNIX, getting the socket is
-     * successful but bind always returns ENETUNREACH.)
-     */
-    if (default_family == APR_UNSPEC) {
-        apr_status_t sock_rv;
-        apr_socket_t *tmp_sock;
-        apr_sockaddr_t *sa;
-
-        if ((sock_rv = apr_socket_create(&tmp_sock, APR_INET6, SOCK_STREAM, p)) 
-            == APR_SUCCESS &&
-            apr_sockaddr_info_get(&sa, NULL, APR_INET6, 0, 0, p) == APR_SUCCESS &&
-            apr_bind(tmp_sock, sa) == APR_SUCCESS) { 
-            default_family = APR_INET6;
-        }
-        else {
-            default_family = APR_INET;
-        }
-        if (sock_rv == APR_SUCCESS) {
-            apr_socket_close(tmp_sock);
-        }
-    }
-#endif
-}
-
-
 static const char *alloc_listener(process_rec *process, char *addr, apr_port_t port)
 {
     ap_listen_rec **walk;
@@ -275,24 +243,6 @@ static const char *alloc_listener(process_rec *process, char *addr, apr_port_t p
     apr_port_t oldport;
     apr_sockaddr_t *sa;
 
-    if (!addr) { /* don't bind to specific interface */
-        find_default_family(process->pool);
-        switch(default_family) {
-        case APR_INET:
-            addr = "0.0.0.0";
-            break;
-
-#if APR_HAVE_IPV6
-        case APR_INET6:
-            addr = "::";
-            break;
-#endif
-
-        default:
-            ap_assert(1 != 1); /* should not occur */
-        }
-    }
-
     /* see if we've got an old listener for this address:port */
     for (walk = &old_listeners; *walk; walk = &(*walk)->next) {
         sa = (*walk)->bind_addr;