]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: tcp: set the ADDR_TO_SET flag on outgoing connections
authorWilly Tarreau <w@1wt.eu>
Sat, 8 Dec 2012 17:53:44 +0000 (18:53 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 8 Dec 2012 17:53:44 +0000 (18:53 +0100)
commitfc8f1f03828358b97b250532bedbaaa67379dd7a
treea2453d7c79ba50a30268c948e51f24a0bfec7d49
parent55e4ecd9283ad7444b1bff83cec655ba91b43a4c
BUG/MINOR: tcp: set the ADDR_TO_SET flag on outgoing connections

tcp_connect_server() resets all of the connection's flags. This means
that an outgoing connection does not have the ADDR_TO_SET flag
eventhough the address is set.

The first impact is that logging the outgoing address or displaying
it on the CLI while dumping sessions will result in an extra call to
getpeername().

But there is a nastier impact. If such a lookup happens *after* the
first connect() attempt and this one fails, the destination address
is corrupted by the call to getsockname(), and subsequent connection
retries will fail with socket errors.

For now we fix this by making tcp_connect_server() set the flag. But
we'll soon need a function to initialize an outgoing connection with
appropriate address and flags before calling the connect() function.
src/proto_tcp.c