From: Justin Erenkrantz Date: Wed, 13 Aug 2003 19:17:45 +0000 (+0000) Subject: Correct failure with Listen directives on machines with IPv6 enabled by X-Git-Tag: pre_ajp_proxy~1273 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f56540ccfc2adfdd364f1526678fe4395119c95;p=apache Correct failure with Listen directives on machines with IPv6 enabled by 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 Reviewed by: Justin Erenkrantz git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100978 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index def2aacd75..eff45012d7 100644 --- 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 , 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] diff --git a/server/listen.c b/server/listen.c index 0ce1143abc..a8977d0110 100644 --- a/server/listen.c +++ b/server/listen.c @@ -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;