From: Willy Tarreau Date: Fri, 23 Sep 2011 08:27:12 +0000 (+0200) Subject: BUG/MINOR: don't use a wrong port when connecting to a server with mapped ports X-Git-Tag: v1.5-dev8~92 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dd164d0240b0fc1030044d7b1bfad93401959eea;p=thirdparty%2Fhaproxy.git BUG/MINOR: don't use a wrong port when connecting to a server with mapped ports 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. --- diff --git a/src/backend.c b/src/backend.c index d850ebf403..0fa28f073e 100644 --- a/src/backend.c +++ b/src/backend.c @@ -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); } }