]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: xprt_quic: remove dead callbacks prepare_srv/destroy_srv flx04/master
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 28 Jul 2026 17:08:39 +0000 (19:08 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 4 Aug 2026 07:42:25 +0000 (09:42 +0200)
QUIC xprt defines prepare_srv callback. The main objective of this
callback is to setup server XPRT to QUIC.

This should be called once the server is fully configured, with related
code blocks in proxy_finalize() and cli_parse_add_server(). However,
this is in fact dead code as prepare_srv is in fact called through
XPRT_SSL. This is still functional though because SSL and QUIC share the
same prepare_srv, so this issue is not visible. This is the same
situation for destroy_srv callback.

This patch removes the dead code to ensure there is no ambiguity here.
There is still a design issue which should be fixed later as it's not
expected for QUIC code to rely on XPRT_SSL layer.

src/proxy.c
src/server.c
src/xprt_quic.c

index f9a9f51495af78935c94b58dd447de84415be782..0f9d099d6762ba1a6a60235553c58fb3db85d55d 100644 (file)
@@ -2564,10 +2564,9 @@ int proxy_finalize(struct proxy *px, int *err_code)
                if (newsrv->use_ssl == 1 || newsrv->check.use_ssl == 1 ||
                    (newsrv->check.tcpcheck->flags & TCPCHK_FL_USE_SSL) ||
                    ((newsrv->flags & SRV_F_DEFSRV_USE_SSL) && newsrv->use_ssl != 1)) {
+                       /* QUIC servers are also updated here. */
                        if (xprt_get(XPRT_SSL) && xprt_get(XPRT_SSL)->prepare_srv)
                                cfgerr += xprt_get(XPRT_SSL)->prepare_srv(newsrv);
-                       else if (xprt_get(XPRT_QUIC) && xprt_get(XPRT_QUIC)->prepare_srv)
-                               cfgerr += xprt_get(XPRT_QUIC)->prepare_srv(newsrv);
                }
 
                /* In HTTP only, if the SNI is not set and we can rely on the
index bca44ec03dcc0da7095eee9b12d31f930ab45020..5826711cc5e855c6c663b61215caa2b5dcef015e 100644 (file)
@@ -3234,10 +3234,9 @@ void srv_free_params(struct server *srv)
        }
        free(srv->tmpl_info.prefix);
 
+       /* QUIC servers are also updated here. */
        if (xprt_get(XPRT_SSL) && xprt_get(XPRT_SSL)->destroy_srv)
                xprt_get(XPRT_SSL)->destroy_srv(srv);
-       else if (xprt_get(XPRT_QUIC) && xprt_get(XPRT_QUIC)->destroy_srv)
-               xprt_get(XPRT_QUIC)->destroy_srv(srv);
 
        while (!LIST_ISEMPTY(&srv->pp_tlvs)) {
                srv_tlv = LIST_ELEM(srv->pp_tlvs.n, struct srv_pp_tlv_list *, list);
@@ -6692,14 +6691,11 @@ static int cli_parse_add_server(char **args, char *payload, struct appctx *appct
 
        if (srv->use_ssl == 1 || (srv->check.tcpcheck->flags & TCPCHK_FL_USE_SSL) ||
            srv->check.use_ssl == 1) {
+               /* QUIC servers are also updated here. */
                if (xprt_get(XPRT_SSL) && xprt_get(XPRT_SSL)->prepare_srv) {
                        if (xprt_get(XPRT_SSL)->prepare_srv(srv))
                                goto out;
                }
-               else if (xprt_get(XPRT_QUIC) && xprt_get(XPRT_QUIC)->prepare_srv) {
-                       if (xprt_get(XPRT_QUIC)->prepare_srv(srv))
-                               goto out;
-               }
        }
 
        /* Define default SNI from host header if needed. */
index 5dee96850142d2dbde3c1e927debfa146f563854..c2519fe8e77533a03764a0d317f50926938466a0 100644 (file)
@@ -265,8 +265,11 @@ static struct xprt_ops ssl_quic = {
        .start    = qc_xprt_start,
        .prepare_bind_conf = ssl_sock_prepare_bind_conf,
        .destroy_bind_conf = ssl_sock_destroy_bind_conf,
-       .prepare_srv = ssl_sock_prepare_srv_ctx,
-       .destroy_srv = ssl_sock_free_srv_ctx,
+
+       /* These callbacks are only called through XPRT_SSL even for QUIC servers. */
+       .prepare_srv = NULL,
+       .destroy_srv = NULL,
+
        .get_alpn = qc_get_alpn,
        .get_ssl_sock_ctx = qc_get_ssl_sock_ctx,
        .dump_info = qc_xprt_dump_info,