On Thu, Aug 25, 2005 at 03:33:59PM +0100, Colm MacCarthaigh wrote:
> > O.k., does this fix it;
> 
> Eh, it doesn't, never mind.

This on the other hand, might ;

Index: server/listen.c
===================================================================
--- server/listen.c     (revision 239742)
+++ server/listen.c     (working copy)
@@ -361,6 +361,26 @@
     num_open = 0;
     previous = NULL;
     for (lr = ap_listeners; lr; previous = lr, lr = lr->next) {
+        /* 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, but never the other way around.
+         */
+        if(lr->next && lr->bind_addr->family == APR_INET &&
+           lr->bind_addr->sa.sin.sin_addr.s_addr == INADDR_ANY &&
+           lr->next->bind_addr->family == APR_INET6 &&
+           IN6_IS_ADDR_UNSPECIFIED(&lr->next->bind_addr->sa.sin6.sin6_addr)) {
+            ap_listen_rec * spare, * pivot;
+
+            /* Standard link-list swap */
+            spare = lr->next->next;
+            pivot = lr->next;
+            lr->next->next = lr;
+            lr->next = spare;
+            lr = pivot;
+        }
+
         if (lr->active) {
             ++num_open;
         }
-- 
Colm MacCárthaigh                        Public Key: [EMAIL PROTECTED]

Reply via email to