]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: fix check reuse-pool in srv_settings_cpy()
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 29 Jul 2026 08:42:37 +0000 (10:42 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 29 Jul 2026 13:21:35 +0000 (15:21 +0200)
<reuse_pool> may be set on check to instruct that connection reuse may
be performed for server health checks.

As expected, this field is duplicated in srv_settings_cpy(). However,
there is an exception for rHTTP servers as in this case check-reuse-pool
must be forcefully activated, as performed in srv_settings_init(). Thus,
the value was not copied to avoid changing it to 0.

This causes a configuration issue with rHTTP on server-template though.
In this case, check-reuse-pool is not set for duplicated server
instances as srv_settings_init() is not called for them. This causes
checks to always fail for such entries.

Fix this by forcing check-reuse-pool for rHTTP in srv_settings_cpy(),
and duplicate the values for other servers.

This must be backported up to 3.2.

src/server.c

index 76c8a25cc3ce4e2e9919b4402fd0f0c7468451c4..ad7734c008208da995feea31344ec57d6f14046f 100644 (file)
@@ -3000,8 +3000,12 @@ void srv_settings_cpy(struct server *srv, const struct server *src, int srv_tmpl
                        srv->check.tcpcheck = tcpcheck;
        }
 
-       if (!(srv->flags & SRV_F_RHTTP))
-               srv->check.reuse_pool = src->check.reuse_pool;
+       /* For rHTTP check-reuse-pool is forcefully set. Duplicate the source
+        * value in other cases as expected.
+        */
+       srv->check.reuse_pool = srv->flags & SRV_F_RHTTP ?
+                               1 : src->check.reuse_pool;
+
        if (src->check.pool_conn_name)
                srv->check.pool_conn_name = strdup(src->check.pool_conn_name);
        /* Note: 'flags' field has potentially been already initialized. */