]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: don't use a wrong port when connecting to a server with mapped ports
authorWilly Tarreau <w@1wt.eu>
Fri, 23 Sep 2011 08:27:12 +0000 (10:27 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 23 Sep 2011 08:27:12 +0000 (10:27 +0200)
Nick Chalk reported that a connection to a server which has no port specified
used twice the port number. The reason is that the port number was taken from
the wrong part of the address, the client's destination address was used as the
base port instead of the server's configured address.

Thanks to Nick for his helpful diagnostic.

src/backend.c

index d850ebf403492aec1998b0cdc5d0cd7e627128f3..0fa28f073ec457214d9c5dc48c0d5dd0aab0df13 100644 (file)
@@ -703,7 +703,7 @@ int assign_server_address(struct session *s)
                        base_port = get_host_port(&s->req->prod->addr.c.to);
 
                        /* Second, assign the outgoing connection's port */
-                       base_port += get_host_port(&s->req->prod->addr.s.to);
+                       base_port += get_host_port(&s->req->cons->addr.s.to);
                        set_host_port(&s->req->cons->addr.s.to, base_port);
                }
        }