From 9b6812d7812170c645783d69ea1afbb7c67f1644 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Thu, 21 Sep 2023 15:44:17 +0200 Subject: [PATCH] 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. --- src/proto_reverse_connect.c | 1 + 1 file changed, 1 insertion(+) 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;