From: Joe Orton Date: Wed, 31 Aug 2005 09:46:17 +0000 (+0000) Subject: Merge r239381, r240092, r240096, r240349 from trunk: X-Git-Tag: 2.1.8~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6cab4e12f28241c8f8cdf427925e5586068544b;p=thirdparty%2Fapache%2Fhttpd.git Merge r239381, r240092, r240096, r240349 from trunk: * support/htcacheclean.c: Update htcacheclean defines to match mod_disk_cache.c. * server/listen.c (IS_INADDR_ANY, IS_IN6ADDR_ANY): New macros. (open_listeners): Simplify using the new macros; no functional change. * server/listen.c (open_listeners): If 0.0.0.0 is found before [::] for the same port, switch them so that the bind to [::] is attempted first. * build/rpm/httpd.spec.in: Fix the RPM spec file: XML versions of the doc files are no longer removed. Added httxt2dbm to the sbin directory. Submitted by: colm, jorton, minfrin Reviewed by: colm, jorton, trawick, jerenkrantz git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@264990 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/build/rpm/httpd.spec.in b/build/rpm/httpd.spec.in index 834ae6fb3d9..6bf56045d6c 100644 --- a/build/rpm/httpd.spec.in +++ b/build/rpm/httpd.spec.in @@ -203,7 +203,6 @@ echo %{mmn} > $RPM_BUILD_ROOT%{_includedir}/httpd/.mmn # docroot mkdir $RPM_BUILD_ROOT%{contentdir}/html rm -r $RPM_BUILD_ROOT%{contentdir}/manual/style -rm $RPM_BUILD_ROOT%{contentdir}/manual/*/*.xml # logs rmdir $RPM_BUILD_ROOT%{_sysconfdir}/httpd/logs @@ -324,6 +323,7 @@ rm -rf $RPM_BUILD_ROOT %{_sbindir}/logresolve %{_sbindir}/httpd %{_sbindir}/httpd.worker +%{_sbindir}/httxt2dbm %{_sbindir}/apachectl %{_sbindir}/rotatelogs %attr(4510,root,%{suexec_caller}) %{_sbindir}/suexec @@ -397,6 +397,10 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/httpd/build/mkdir.sh %changelog +* Fri Aug 26 2005 Graham Leggett 2.1.7 +- Deleting the xml doc files is no longer necessary. +- Add httxt2dbm to the sbin directory + * Sat Jul 2 2005 Graham Leggett 2.1.7-dev - Fixed complaints about unpackaged files with new config file changes. diff --git a/server/listen.c b/server/listen.c index 6a3ee9e7bf9..ab4e7de3d9c 100644 --- a/server/listen.c +++ b/server/listen.c @@ -346,6 +346,15 @@ static const char *alloc_listener(process_rec *process, char *addr, return NULL; } +/* Evaluates to true if the (apr_sockaddr_t *) addr argument is the + * IPv4 match-any-address, 0.0.0.0. */ +#define IS_INADDR_ANY(addr) ((addr)->family == APR_INET \ + && (addr)->sa.sin.sin_addr.s_addr == INADDR_ANY) + +/* Evaluates to true if the (apr_sockaddr_t *) addr argument is the + * IPv6 match-any-address, [::]. */ +#define IS_IN6ADDR_ANY(addr) ((addr)->family == APR_INET6 \ + && IN6_IS_ADDR_UNSPECIFIED(&(addr)->sa.sin6.sin6_addr)) /** * Create, open, listen, and bind all sockets. @@ -374,22 +383,43 @@ static int open_listeners(apr_pool_t *pool) else { #if APR_HAVE_IPV6 int v6only_setting; + + /* If we have the unspecified IPv4 address (0.0.0.0) and + * the unspecified IPv6 address (::) is next, we need to + * swap the order of these in the list. We always try to + * bind to IPv6 first, then IPv4, since an IPv6 socket + * might be able to receive IPv4 packets if V6ONLY is not + * enabled, but never the other way around. */ + if (lr->next != NULL + && IS_INADDR_ANY(lr->bind_addr) + && lr->bind_addr->port == lr->next->bind_addr->port + && IS_IN6ADDR_ANY(lr->next->bind_addr)) { + /* Exchange lr and lr->next */ + ap_listen_rec *next = lr->next; + lr->next = next->next; + next->next = lr; + if (previous) { + previous->next = next; + } + else { + ap_listeners = next; + } + lr = next; + } + /* If we are trying to bind to 0.0.0.0 and the previous listener * was :: on the same port and in turn that socket does not have * the IPV6_V6ONLY flag set; we must skip the current attempt to * listen (which would generate an error). IPv4 will be handled * on the established IPv6 socket. */ - if (previous != NULL && - lr->bind_addr->family == APR_INET && - lr->bind_addr->sa.sin.sin_addr.s_addr == INADDR_ANY && - lr->bind_addr->port == previous->bind_addr->port && - previous->bind_addr->family == APR_INET6 && - IN6_IS_ADDR_UNSPECIFIED( - &previous->bind_addr->sa.sin6.sin6_addr) && - apr_socket_opt_get(previous->sd, APR_IPV6_V6ONLY, - &v6only_setting) == APR_SUCCESS && - v6only_setting == 0) { + if (previous != NULL + && IS_INADDR_ANY(lr->bind_addr) + && lr->bind_addr->port == previous->bind_addr->port + && IS_IN6ADDR_ANY(previous->bind_addr) + && apr_socket_opt_get(previous->sd, APR_IPV6_V6ONLY, + &v6only_setting) == APR_SUCCESS + && v6only_setting == 0) { /* Remove the current listener from the list */ previous->next = lr->next; @@ -407,12 +437,10 @@ static int open_listeners(apr_pool_t *pool) * error. The user will still get a warning from make_sock * though. */ - if (lr->next != NULL && lr->bind_addr->family == APR_INET6 && - IN6_IS_ADDR_UNSPECIFIED( - &lr->bind_addr->sa.sin6.sin6_addr) && - lr->bind_addr->port == lr->next->bind_addr->port && - lr->next->bind_addr->family == APR_INET && - lr->next->bind_addr->sa.sin.sin_addr.s_addr == INADDR_ANY) { + if (lr->next != NULL + && IS_IN6ADDR_ANY(lr->bind_addr) + && lr->bind_addr->port == lr->next->bind_addr->port + && IS_INADDR_ANY(lr->next->bind_addr)) { /* Remove the current listener from the list */ if (previous) { diff --git a/support/htcacheclean.c b/support/htcacheclean.c index 83b0b3affbd..6fa1842ca49 100644 --- a/support/htcacheclean.c +++ b/support/htcacheclean.c @@ -44,8 +44,8 @@ /* mod_disk_cache.c extract start */ -#define VARY_FORMAT_VERSION 1 -#define DISK_FORMAT_VERSION 2 +#define VARY_FORMAT_VERSION 3 +#define DISK_FORMAT_VERSION 4 typedef struct { /* Indicates the format of the header struct stored on-disk. */