httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 44806] Set the IP address+port used for backend proxy requests.
Date Wed, 04 Jun 2008 22:54:51 GMT

D. Stussy <> changed:

           What    |Removed                     |Added
  Attachment #22068|0                           |1
        is obsolete|                            |

--- Comment #22 from D. Stussy <>  2008-06-04 15:54:49
PST ---
Created an attachment (id=22074)
 --> (
PARTIAL patch - used during debugging.

RE:  Patch at comment #21

Parser:  Boundary condition.  If we're defining PORT_MAX_PORTS as 65536
(0x00010000), then "(ports+r) >= ..." on line 1741 is the error condition we
need to check for.  Add an equals sign.

@@ -2349,6 +2373,20 @@  Non-critical issue (cosmetic):
Note:  In your design, you're reporting the error of a failure to bind for the
first address only when all fail, while in my version in comment #17, moving
the ap_log_error() call inside the loop (and after the break) will report EACH
address that fails, even if some address succeeds.  We also don't need to keep
the status in "rv" as "addr" will be set on success and NULL on failure. 

Your version:  Reports the error only if all addresses & ports fail.
My version:  Reports an error for each address where all ports fail.

This issue does not affect the operation of the function, but depending on what
the admin is doing (production vs. testing a configuration), it may be useful
to have a log entry for each address failing as opposed to merely reporting the

If you want to keep the error message outside of the loop (as the inner
function "bind_to_addr()" has sufficient debug statements, perhaps the message
should read:

+                ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, "proxy: %s: All
addresses and ports in range specified failed to bind",
+                        proxy_function, NULL);
As adjusted, I attempted to install the patch and run it.  I found the
following problems when patching against a stock version 2.2.8:

+++ modules/proxy/mod_proxy.c   (working copy)
@@ -35,6 +35,12 @@
Patch was rejected.  I manually inserted it.  Trailing text did not match.

All other items did install, but some had different line offsets.

Compilation errors:
My C compiler did not like the declarations inside the for() loops
modules/proxy/proxy_util.c: 2275:  "int i"
modules/proxy/proxy_util.c: 2378:  "apr_sockaddr_t *addr"
Moving those declarations outside of the loops onto their own line worked.

With those two changes, all compiles without error and without warnings.

ProxyBindAddress allowed in main server configuration.
ProxyBindAddress allowed inside VirtualHost configuration.
ProxyBindAddress allowed inside <IfModule mod_proxy.c> configuration.
ProxyBindAddress NOT allowed inside <Proxy "*"> configuration - acceptable, but

Configured it with a hostname only resolving to one IPv4 and one IPv6 address.
Did NOT see any binding attempts in logs.
Saw ONLY "[error] proxy: HTTP: All addresses and ports in range specified
failed to bind"
Removed address-family comparison; added AF to debug string; recompiled.

Still saw it.  Inserted a debug-log entry and found conf->bind_addr is NULL. 
Set port options in the config file - different options for the main
configuration and a virtual host that has proxy service, but found that at the
time of the call, port+range = "0+0" - NOT the same as set.

Are we certain that the configuration pointer value used when proxying is the
same configuration pointer value that was used during configuration - i.e. same
memory address?

Live log file:
[Wed Jun 04 22:31:30 2008] [debug] mod_proxy.c(855): Running scheme http
handler (attempt 0)
[Wed Jun 04 22:31:30 2008] [debug] mod_proxy_http.c(1822): proxy: HTTP: serving
[Wed Jun 04 22:31:30 2008] [debug] proxy_util.c(1855): proxy: HTTP: has
acquired connection for (*)
[Wed Jun 04 22:31:30 2008] [debug] proxy_util.c(1916): proxy: connecting to
[Wed Jun 04 22:31:31 2008] [debug] proxy_util.c(2015): proxy: connected
/robots.txt to
[Wed Jun 04 22:31:31 2008] [debug] proxy_util.c(2197): proxy: HTTP: fam 2
socket created to connect to *
[Wed Jun 04 22:31:31 2008] [debug] proxy_util.c(2204): ProxyBindAddress:
conf->bind_addr is NULL, port=0, range=0 (0825BCD8)
[Wed Jun 04 22:31:31 2008] [error] proxy: HTTP: All addresses and ports in
range specified failed to bind

Just in case I made any accidental changes, I've included my differences,
complete with DEBUGGING statements that should be removed before the final
version is released and incorporated into the mainstream program.

File:  modules/proxy/mod_proxy.h - patch same as proposed, and therefore

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message