httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 44806] Set the IP address+port used for backend proxy requests.
Date Mon, 02 Jun 2008 22:06:44 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=44806





--- Comment #11 from D. Stussy <apache+bugreports@kd6lvw.ampr.org>  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: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message