From: Willy Tarreau Date: Sun, 1 Dec 2013 20:46:24 +0000 (+0100) Subject: BUG/MINOR: backend: fix target address retrieval in transparent mode X-Git-Tag: v1.5-dev20~202 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1903acdf3ad70228b7760505c666b754bf86db47;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/backend.c b/src/backend.c index 7689cea674..c2e286a768 100644 --- a/src/backend.c +++ b/src/backend.c @@ -725,8 +725,7 @@ int assign_server_address(struct session *s) * the client asked, which is handy for remapping ports * 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) { ((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) { 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 */ base_port = get_host_port(&s->req->prod->conn->addr.to);