httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: svn commit: r1146256 - in /httpd/httpd/trunk: CHANGES server/config.c
Date Fri, 15 Jul 2011 10:29:59 GMT
On Thu, Jul 14, 2011 at 11:28:13PM +0200, Stefan Fritsch wrote:
> I think AF_UNSPEC should be more correct. But there are so many 
> plattforms with different behaviour that it is impossible to say if it 
> will break something. Simply trying this out in a beta is not the 
> worst thing to do, IMHO. Or would you prefer using the retry-with-
> APR_INET6 solution?

I agree we should try it with AF_UNSPEC only, in beta.

Looks like there are some IPv4-isms in vhost.c as well.  I'll commit 
this too unless there are any objections:

Index: server/vhost.c
===================================================================
--- server/vhost.c	(revision 1147072)
+++ server/vhost.c	(working copy)
@@ -189,9 +189,9 @@
     }
 
     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 @@
     return wild_match;
 }
 
+#ifdef 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 @@
     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);
     }


Mime
View raw message