]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: check: do not use QUIC if any connection setting specified
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 30 Oct 2025 16:29:47 +0000 (17:29 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 30 Oct 2025 16:35:07 +0000 (17:35 +0100)
When performing server checks, by default connection settings from the
server are reused. This is also performed for QUIC servers, which allow
to execute QUIC health checks.

This patch adjusts health checks on QUIC servers when at least one check
connection setting is specified, for example the check port. In this
case, consider that the user does not want to use QUIC and fallback to
the TCP transport layer.

This solution is the easiest way to have a consitent behavior for QUIC
servers with checks. Without it, it is possible to encounter process
crashes. It may evolve in the future to be able to perform QUIC checks
with different connection settings.

src/tcpcheck.c

index 15fdd000457fa57cc57e5d5e96710cb88cb9cc0d..b4c8fe5fe3e54777fbaff774a1f20c3492029bef 100644 (file)
@@ -1405,9 +1405,27 @@ enum tcpcheck_eval_ret tcpcheck_eval_connect(struct check *check, struct tcpchec
        *conn->dst = (is_addr(&connect->addr)
                      ? connect->addr
                      : (is_addr(&check->addr) ? check->addr : s->addr));
-       proto = s ?
-         protocol_lookup(conn->dst->ss_family, s->addr_type.proto_type, s->alt_proto) :
-         protocol_lookup(conn->dst->ss_family, PROTO_TYPE_STREAM, 0);
+
+       if (s && srv_is_quic(s)) {
+               /* For QUIC servers, checks are performed using QUIC only if no
+                * check connection parameters is specified. Fallback to TCP in
+                * this case.
+                */
+               if (tcpcheck_use_nondefault_connect(check, connect)) {
+                       proto = protocol_lookup(conn->dst->ss_family, PROTO_TYPE_STREAM, 0);
+                       /* Also reset MUX protocol if set to QUIC. */
+                       if (check->mux_proto == s->mux_proto)
+                               check->mux_proto = NULL;
+               }
+               else {
+                       proto = protocol_lookup(conn->dst->ss_family, s->addr_type.proto_type, s->alt_proto);
+               }
+       }
+       else {
+               proto = s ?
+                 protocol_lookup(conn->dst->ss_family, s->addr_type.proto_type, s->alt_proto) :
+                 protocol_lookup(conn->dst->ss_family, PROTO_TYPE_STREAM, 0);
+       }
 
        port = 0;
        if (connect->port)