[MEDIUM] backend: move the transparent proxy address selection to backend
authorWilly Tarreau <w@1wt.eu>
Mon, 29 Mar 2010 17:36:59 +0000 (19:36 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 30 Mar 2010 07:59:43 +0000 (09:59 +0200)
commitb1d67749db58bc956db19ed6c7dad206f7a3dfee
treeadd27e0f78593f2e67856375ea7a572f97810732
parent07a5490881a39c0bbd8c0877e5bfbfede04ddcdc
[MEDIUM] backend: move the transparent proxy address selection to backend

The transparent proxy address selection was set in the TCP connect function
which is not the most appropriate place since this function has limited
access to the amount of parameters which could produce a source address.

Instead, now we determine the source address in backend.c:connect_server(),
right after calling assign_server_address() and we assign this address in
the session and pass it to the TCP connect function. This cannot be performed
in assign_server_address() itself because in some cases (transparent mode,
dispatch mode or http_proxy mode), we assign the address somewhere else.

This change will open the ability to bind to addresses extracted from many
other criteria (eg: from a header).
include/proto/proto_tcp.h
include/types/session.h
src/backend.c
src/proto_tcp.c