httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r240092 - /httpd/httpd/trunk/server/listen.c
Date Thu, 25 Aug 2005 15:37:41 GMT
Author: jorton
Date: Thu Aug 25 08:37:39 2005
New Revision: 240092

URL: http://svn.apache.org/viewcvs?rev=240092&view=rev
Log:
* server/listen.c (IS_INADDR_ANY, IS_IN6ADDR_ANY): New macros.
(open_listeners): Simplify using the new macros; no functional change.

Modified:
    httpd/httpd/trunk/server/listen.c

Modified: httpd/httpd/trunk/server/listen.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/listen.c?rev=240092&r1=240091&r2=240092&view=diff
==============================================================================
--- httpd/httpd/trunk/server/listen.c (original)
+++ httpd/httpd/trunk/server/listen.c Thu Aug 25 08:37:39 2005
@@ -339,6 +339,15 @@
 
     return NULL;
 }
+/* Evaluates to true if the (apr_sockaddr_t *) addr argument is the
+ * IPv4 match-any-address, 0.0.0.0. */
+#define IS_INADDR_ANY(addr) ((addr)->family == APR_INET \
+                             && (addr)->sa.sin.sin_addr.s_addr == INADDR_ANY)
+
+/* Evaluates to true if the (apr_sockaddr_t *) addr argument is the
+ * IPv6 match-any-address, [::]. */
+#define IS_IN6ADDR_ANY(addr) ((addr)->family == APR_INET6 \
+                              && IN6_IS_ADDR_UNSPECIFIED(&(addr)->sa.sin6.sin6_addr))
 
 /**
  * Create, open, listen, and bind all sockets.
@@ -373,16 +382,13 @@
              * listen (which would generate an error). IPv4 will be handled
              * on the established IPv6 socket.
              */
-            if (previous != NULL &&
-                lr->bind_addr->family == APR_INET &&
-                lr->bind_addr->sa.sin.sin_addr.s_addr == INADDR_ANY &&
-                lr->bind_addr->port == previous->bind_addr->port &&
-                previous->bind_addr->family == APR_INET6 &&
-                IN6_IS_ADDR_UNSPECIFIED(
-                    &previous->bind_addr->sa.sin6.sin6_addr) &&
-                apr_socket_opt_get(previous->sd, APR_IPV6_V6ONLY,
-                                   &v6only_setting) == APR_SUCCESS &&
-                v6only_setting == 0) {
+            if (previous != NULL
+                && IS_INADDR_ANY(lr->bind_addr)
+                && lr->bind_addr->port == previous->bind_addr->port
+                && IS_IN6ADDR_ANY(previous->bind_addr)
+                && apr_socket_opt_get(previous->sd, APR_IPV6_V6ONLY,
+                                      &v6only_setting) == APR_SUCCESS
+                && v6only_setting == 0) {
 
                 /* Remove the current listener from the list */
                 previous->next = lr->next;
@@ -400,12 +406,10 @@
                  * error. The user will still get a warning from make_sock
                  * though.
                  */
-                if (lr->next != NULL && lr->bind_addr->family == APR_INET6
&&
-                    IN6_IS_ADDR_UNSPECIFIED(
-                        &lr->bind_addr->sa.sin6.sin6_addr) &&
-                    lr->bind_addr->port == lr->next->bind_addr->port &&
-                    lr->next->bind_addr->family == APR_INET && 
-                    lr->next->bind_addr->sa.sin.sin_addr.s_addr == INADDR_ANY) {
+                if (lr->next != NULL
+                    && IS_IN6ADDR_ANY(lr->bind_addr)
+                    && lr->bind_addr->port == lr->next->bind_addr->port
+                    && IS_INADDR_ANY(lr->next->bind_addr)) {
 
                     /* Remove the current listener from the list */
                     if (previous) {



Mime
View raw message