You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2011/07/18 12:47:50 UTC
svn commit: r1147806 - in /httpd/httpd/trunk: CHANGES server/vhost.c
Author: jorton
Date: Mon Jul 18 10:47:49 2011
New Revision: 1147806
URL: http://svn.apache.org/viewvc?rev=1147806&view=rev
Log:
* server/vhost.c (get_addresses): For '*' and '_default_', return
address(es) for any address family, not IPv4 only.
(dump_a_vhost): Use '*' for v4 or v6 wildcard address.
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/server/vhost.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1147806&r1=1147805&r2=1147806&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Mon Jul 18 10:47:49 2011
@@ -2,6 +2,9 @@
Changes with Apache 2.3.14
+ *) core: For '*' or '_default_' vhosts, use a wildcard address of any
+ address family, rather than IPv4 only. [Joe Orton]
+
*) core, mod_rewrite, mod_ssl, mod_nw_ssl: Make the SERVER_NAME variable
include [ ] for literal IPv6 addresses, as mandated by RFC 3875.
PR 26005. [Stefan Fritsch]
Modified: httpd/httpd/trunk/server/vhost.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/vhost.c?rev=1147806&r1=1147805&r2=1147806&view=diff
==============================================================================
--- httpd/httpd/trunk/server/vhost.c (original)
+++ httpd/httpd/trunk/server/vhost.c Mon Jul 18 10:47:49 2011
@@ -189,9 +189,9 @@ static const char *get_addresses(apr_poo
}
if (strcmp(host, "*") == 0 || strcasecmp(host, "_default_") == 0) {
- rv = apr_sockaddr_info_get(&my_addr, "0.0.0.0", APR_INET, port, 0, p);
+ rv = apr_sockaddr_info_get(&my_addr, NULL, APR_UNSPEC, port, 0, p);
if (rv) {
- return "Could not resolve address '0.0.0.0' -- "
+ return "Could not determine a wildcard address ('0.0.0.0') -- "
"check resolver configuration.";
}
}
@@ -422,6 +422,13 @@ static ipaddr_chain *find_default_server
return wild_match;
}
+#if APR_HAVE_IPV6
+#define IS_IN6_ANYADDR(ad) ((ad)->family == APR_INET6 \
+ && IN6_IS_ADDR_UNSPECIFIED(&(ad)->sa.sin6.sin6_addr))
+#else
+#define IS_IN6_ANYADDR(ad) (0)
+#endif
+
static void dump_a_vhost(apr_file_t *f, ipaddr_chain *ic)
{
name_chain *nc;
@@ -429,8 +436,8 @@ static void dump_a_vhost(apr_file_t *f,
char buf[MAX_STRING_LEN];
apr_sockaddr_t *ha = ic->sar->host_addr;
- if (ha->family == APR_INET &&
- ha->sa.sin.sin_addr.s_addr == INADDR_ANY) {
+ if ((ha->family == APR_INET && ha->sa.sin.sin_addr.s_addr == INADDR_ANY)
+ || IS_IN6_ANYADDR(ha)) {
len = apr_snprintf(buf, sizeof(buf), "*:%u",
ic->sar->host_port);
}