]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: servers: use proper source of pool_conn_name in srv_settings_cpy()
authorWilly Tarreau <w@1wt.eu>
Fri, 15 May 2026 05:20:48 +0000 (05:20 +0000)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 May 2026 15:39:25 +0000 (17:39 +0200)
The condition 'if (srv->pool_conn_name)' was checking the destination
instead of the source 'src->pool_conn_name', meaning the strdup() would
never fire (since newly calloc'd servers start with NULL pool_conn_name),
and the pool_conn_name setting from default-server was silently ignored.

Introduced in 3.2 with commit f0f1816f1 ("MINOR: check: implement
check-pool-conn-name srv keyword") when pool_conn_name support was added
to srv_settings_cpy(). The bug caused any 'pool-conn-name' setting in a
'default-server' line to be lost for all servers inheriting from it.

Note that it's not the first time this function induces such a bug due
to the poor choice of "srv" vs "src" that should be renamed to avoid
keyboard mistakes and visual confusion.

This needs to be backported to 3.2.

src/server.c

index ff2ebcfb5c431854d5449a8a62892a7ab7fda0f1..df87e747627cba527e02f977a5a93ce329290792 100644 (file)
@@ -3055,8 +3055,8 @@ void srv_settings_cpy(struct server *srv, const struct server *src, int srv_tmpl
        srv->tcp_ut = src->tcp_ut;
 #endif
        srv->mux_proto = src->mux_proto;
-       if (srv->pool_conn_name)
-               srv->pool_conn_name = strdup(srv->pool_conn_name);
+       if (src->pool_conn_name)
+               srv->pool_conn_name = strdup(src->pool_conn_name);
        srv->pool_purge_delay = src->pool_purge_delay;
        srv->low_idle_conns = src->low_idle_conns;
        srv->max_idle_conns = src->max_idle_conns;