You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Joe Orton <jo...@redhat.com> on 2011/07/14 12:48:06 UTC

Re: svn commit: r1146256 - in /httpd/httpd/trunk: CHANGES server/config.c

On Wed, Jul 13, 2011 at 07:21:11PM -0000, sf@apache.org wrote:
> Author: sf
> Date: Wed Jul 13 19:21:11 2011
> New Revision: 1146256
> 
> URL: http://svn.apache.org/viewvc?rev=1146256&view=rev
> Log:
> Use APR_UNSPEC to allow startup on IP6-only systems.
> 
> PR: 50592
> Submitted by: Joe Orton, 2510 <root linkage white-void net>

Thanks, Stefan.  I was a little bit unsure about this.  For a "normal" 
dual-stack system, it does change behaviour; the default vhost will have 
host_addr with two addresses, [::] then 0.0.0.0.  (In that order, on my 
system, which is odd, since getaddrinfo() should be returning them with 
[::] last... I started investingating that but got distracted.)

But it should be correct to use AF_UNSPEC here.  We'll see if anything 
breaks, I guess ;)

Regards, Joe

Re: svn commit: r1146256 - in /httpd/httpd/trunk: CHANGES server/config.c

Posted by Joe Orton <jo...@redhat.com>.
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);
     }


Re: svn commit: r1146256 - in /httpd/httpd/trunk: CHANGES server/config.c

Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Thursday 14 July 2011, Joe Orton wrote:
> On Wed, Jul 13, 2011 at 07:21:11PM -0000, sf@apache.org wrote:
> > Author: sf
> > Date: Wed Jul 13 19:21:11 2011
> > New Revision: 1146256
> > 
> > URL: http://svn.apache.org/viewvc?rev=1146256&view=rev
> > Log:
> > Use APR_UNSPEC to allow startup on IP6-only systems.
> > 
> > PR: 50592
> > Submitted by: Joe Orton, 2510 <root linkage white-void net>
> 
> Thanks, Stefan.  I was a little bit unsure about this.  For a
> "normal" dual-stack system, it does change behaviour; the default
> vhost will have host_addr with two addresses, [::] then 0.0.0.0. 
> (In that order, on my system, which is odd, since getaddrinfo()
> should be returning them with [::] last... I started
> investingating that but got distracted.)
>
> But it should be correct to use AF_UNSPEC here.  We'll see if
> anything breaks, I guess ;)

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?