BUG/MINOR: check: fix reuse-pool if MUX inherited from server

Check reuse is only performed if no specific check connect options are
specified on the configuration. This ensures that reuse won't be
performed if intending to use different connection parameters from the
default traffic.

This relies on tcpcheck_use_nondefault_connect() which indicates if the
check has any specific connection parameters. One of them if check
<mux_proto> field. However, this field may be automatically set during
init_srv_check() in some specific conditions without any explicit
configuration, most notably when using http-check rulesets on an HTTP
backend. Thus, it prevents connection reuse for these checks.

This commit fixes this by adjuting tcpcheck_use_nondefault_connect().
Beside checking check <mux_proto> field, it also detects if it is
different from the server configuration. This is sufficient to know if
the value is derived from the configuration or automatically calculated
in init_srv_check().

Note that this patch introduces a small behavior change. Prior to it,
check reuse were never performed if "check-proto" is explicitely
configured. Now, check reuse will be performed if the configured value
is identical to the server MUX protocol. This is considered as
acceptable as connection reuse is safe when using a similar MUX
protocol.

This must be backported up to 3.2.
This commit is contained in:
Amaury Denoyelle 2025-10-29 18:25:55 +01:00
parent 5d021c028e
commit 52a7d4ec39

View File

@ -1213,7 +1213,14 @@ enum tcpcheck_eval_ret tcpcheck_agent_expect_reply(struct check *check, struct t
static inline int tcpcheck_use_nondefault_connect(const struct check *check,
const struct tcpcheck_connect *connect)
{
return check->mux_proto || connect->mux_proto ||
/* special rule for check-proto: if explicitely set but identical to
* the server configuration, consider that the check does not relies on
* a specific option. This is necessary as check <mux_proto> may be
* automatically set via init_srv_check() despite no explicit user
* configuration.
*/
return (check->mux_proto && check->mux_proto != check->server->mux_proto) ||
connect->mux_proto ||
is_addr(&check->addr) || is_addr(&connect->addr) ||
check->port || connect->port || connect->port_expr ||
check->use_ssl || check->alpn_len || connect->alpn_len ||