https://issues.apache.org/bugzilla/show_bug.cgi?id=44806





--- Comment #11 from D. Stussy <[EMAIL PROTECTED]>  2008-06-02 15:06:44 PST ---
Fix the multiple address & address family match issue:

modules/proxy/proxy_util.c      (working copy)
+        if (conf->bindopt_set) {
+            const int idx = conf->bind_idx;
+            const int range = conf->bind_range;
+            const int start = conf->bind_port;
+            for(int i = 0; i < range; ++i) { /* loop until we can bind
correctly*/
+                int port = start + ((idx + i) % range);
+                ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "proxy: %s: trying
to bind to %s:%u",
+                        proxy_function, conf->bind_addr,port, NULL);
+
++               for (local_addr = conf->bind_addr; local_addr ; local_addr =
local_addr->next) {
+
++                   if (local_addr->family != backend_addr->family) continue;
+
+                    local_addr->sa.sin.sin_port = htons(port);
+                    local_addr->port = port;
+
+                    if ((rv = apr_socket_bind(newsock, local_addr)) ==
APR_SUCCESS) {
+                        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "proxy:
%s: bound to %s:%u",
+                                proxy_function, conf->bind_addr,
local_addr->port, NULL);
+                        conf->bind_idx = i + 1;
++                       goto escape;   /* break from TWO loops */
++                   } 
+                    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "proxy: %s:
not bound to %s%u",
+                            proxy_function, conf->bind_addr, local_addr->port,
NULL);
+                }
+            }
+            if (rv != APR_SUCCESS) {
+                ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "proxy: %s: can not
bind to %s:%u+%u",
+                        proxy_function,conf->bind_addr, conf->bind_port,
conf->bind_range, NULL);
+                return DECLINED;
+            }
+        }
++escape:

Instead of the goto, one could add "&& (rv != APR_SUCCESS)" to the conditional
of both loops.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to