From: Amaury Denoyelle Date: Thu, 21 Sep 2023 13:44:17 +0000 (+0200) Subject: BUG/MINOR: proto_reverse_connect: fix preconnect with startup name resolution X-Git-Tag: v2.9-dev6~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b6812d7812170c645783d69ea1afbb7c67f1644;p=thirdparty%2Fhaproxy.git BUG/MINOR: proto_reverse_connect: fix preconnect with startup name resolution addr member of server structure is not set consistently depending on the server address type. When using notation, its port is properly set. However, when using , only IP address is set after startup name resolution but its port is left to 0. This behavior causes preconnect to not be functional when using server with hostname for startup name resolution. Indeed, only srv.addr is used as connect argument through function new_reverse_conn(). To fix this, rely on srv.svc_port : this member is always set for servers using IP or hostname. This is similar to connect_server() on the backend side. This does not need to be backported. --- diff --git a/src/proto_reverse_connect.c b/src/proto_reverse_connect.c index 66bcb8ba0f..efaf81507d 100644 --- a/src/proto_reverse_connect.c +++ b/src/proto_reverse_connect.c @@ -62,6 +62,7 @@ static struct connection *new_reverse_conn(struct listener *l, struct server *sr if (!conn->dst) goto err; *conn->dst = srv->addr; + set_host_port(conn->dst, srv->svc_port); if (conn_prepare(conn, protocol_lookup(conn->dst->ss_family, PROTO_TYPE_STREAM, 0), srv->xprt)) goto err;