]> granicus.if.org Git - apache/commitdiff
* server/vhost.c (get_addresses): For '*' and '_default_', return
authorJoe Orton <jorton@apache.org>
Mon, 18 Jul 2011 10:47:49 +0000 (10:47 +0000)
committerJoe Orton <jorton@apache.org>
Mon, 18 Jul 2011 10:47:49 +0000 (10:47 +0000)
  address(es) for any address family, not IPv4 only.
  (dump_a_vhost): Use '*' for v4 or v6 wildcard address.

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

CHANGES
server/vhost.c

diff --git a/CHANGES b/CHANGES
index 00ea760bdbe35e390844948c62ed19aac42a63b6..b756f43f96036d53ac0d602de064a36d8e079b28 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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]
index b067f2096014a36ca71c5c6a23488eabebec71f3..e3a201a4ddbfa8e20d2070bdcb8ae9e28fd83f27 100644 (file)
@@ -189,9 +189,9 @@ static const char *get_addresses(apr_pool_t *p, const char *w_,
     }
 
     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(apr_port_t port)
     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, ipaddr_chain *ic)
     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);
     }