]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: backend: fix target address retrieval in transparent mode
authorWilly Tarreau <w@1wt.eu>
Sun, 1 Dec 2013 20:46:24 +0000 (21:46 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 1 Dec 2013 20:46:24 +0000 (21:46 +0100)
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.

src/backend.c

index 7689cea6748bf4de9a497bc53a02d76df93cbb1b..c2e286a768fe3b6a307d162655833967ffa7a5e3 100644 (file)
@@ -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);