BUG/MINOR: backend: fix target address retrieval in transparent mode

A very old bug resulting from some code refactoring causes
assign_server_address() to refrain from retrieving the destination
address from the client-side connection when transparent mode is
enabled and we're connecting to a server which has address 0.0.0.0.

The impact is low since such configurations are unlikely to ever
be encountered. The fix should be backported to older branches.
This commit is contained in:
Willy Tarreau 2013-12-01 21:46:24 +01:00
parent 830bf61815
commit 1903acdf3a
1 changed files with 2 additions and 4 deletions

View File

@ -725,8 +725,7 @@ int assign_server_address(struct session *s)
* the client asked, which is handy for remapping ports * the client asked, which is handy for remapping ports
* locally on multiple addresses at once. * locally on multiple addresses at once.
*/ */
if (!(s->be->options & PR_O_TRANSP)) conn_get_to_addr(s->req->prod->conn);
conn_get_to_addr(s->req->prod->conn);
if (s->req->prod->conn->addr.to.ss_family == AF_INET) { if (s->req->prod->conn->addr.to.ss_family == AF_INET) {
((struct sockaddr_in *)&s->req->cons->conn->addr.to)->sin_addr = ((struct sockaddr_in *)&s->req->prod->conn->addr.to)->sin_addr; ((struct sockaddr_in *)&s->req->cons->conn->addr.to)->sin_addr = ((struct sockaddr_in *)&s->req->prod->conn->addr.to)->sin_addr;
@ -740,8 +739,7 @@ int assign_server_address(struct session *s)
if (objt_server(s->target)->state & SRV_MAPPORTS) { if (objt_server(s->target)->state & SRV_MAPPORTS) {
int base_port; int base_port;
if (!(s->be->options & PR_O_TRANSP)) conn_get_to_addr(s->req->prod->conn);
conn_get_to_addr(s->req->prod->conn);
/* First, retrieve the port from the incoming connection */ /* First, retrieve the port from the incoming connection */
base_port = get_host_port(&s->req->prod->conn->addr.to); base_port = get_host_port(&s->req->prod->conn->addr.to);