From 5118dd42805d7fd847afb083e60c985156426be0 Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Thu, 19 Nov 2026 16:19:14 +0100 Subject: [PATCH] MINOR: ssl/quic: mark hq-interop QUIC ALPN as experimental hq-interop in ALPN corresponds to HTTP/0.9 layer. This protocol is reserved for QUIC interop testing and must not be active in production. Introduces a new global keyword 'tune.quic.interop'. It may be set to either 'fe' or 'off', anticipating a future 'be' value for backend support. The keyword parsing forces users to activate experimental directives. The second part of this patch is in ALPN keyword parsing. If hq-interop is found but 'tune.quic.interop fe' is not set, an error is reported. This parser may also run at runtime for dynamic crt-list loading. In this case, 'hq-interop' token is silently removed if present. For now, nothing is performed on the server-side. This is because QUIC backend is still incomplete and is itself experimental. --- doc/configuration.txt | 18 ++++++++++++++++-- include/haproxy/quic_tune-t.h | 1 + src/cfgparse-quic.c | 31 +++++++++++++++++++++++++++++++ src/cfgparse-ssl.c | 22 +++++++++++++++++++--- src/server.c | 4 +++- 5 files changed, 70 insertions(+), 6 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index 0a3246c31..4edb162ef 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -2033,6 +2033,7 @@ The following keywords are supported in the "global" section : - tune.quic.fe.stream.rxbuf - tune.quic.fe.tx.pacing - tune.quic.fe.tx.udp-gso + - tune.quic.interop - tune.quic.listen - tune.quic.mem.tx-max - tune.quic.sec.stateless-reset-rate @@ -5742,6 +5743,16 @@ tune.quic.fe.tx.udp-gso { on | off } be useful to disable it on developers suggestion when suspecting an issue on emission. +tune.quic.interop { off | fe } [ EXPERIMENTAL ] + Activates support for QUIC interop testing. This is mandatory to be able to + use "hq-interop" in ALPN configuration. This must never be activated for + normal usage. + + The default value "off" disables QUIC interop testing. The "fe" value is used + to run HAProxy as a server in the interop test suite. + + It requires "expose-experimental-directives" to be set. + tune.quic.listen { on | off } Disable QUIC transport protocol on the frontend side. All the QUIC listeners will still be created, but they won't listen for incoming datagrams. Hence, @@ -18159,8 +18170,11 @@ alpn bind :443 ssl crt pub.pem alpn h2 # explicitly disable HTTP/1.1 - QUIC supports only h3 and hq-interop as ALPN. h3 is for HTTP/3 and hq-interop - is used for http/0.9 and QUIC interop runner (see https://interop.seemann.io). + Only "h3" is officially supported as a QUIC ALPN for HTTP/3. The "hq-interop" + value is reserved for QUIC interop testing (see https://interop.seemann.io). + It cannot be used unless the experimental keyword "tune.quic.interop" is set + to the proper value. + Each "alpn" statement will replace a previous one. In order to remove them, use "no-alpn". diff --git a/include/haproxy/quic_tune-t.h b/include/haproxy/quic_tune-t.h index ea40ba2bb..03717298d 100644 --- a/include/haproxy/quic_tune-t.h +++ b/include/haproxy/quic_tune-t.h @@ -33,6 +33,7 @@ #define QUIC_TUNE_FB_TX_PACING 0x00000001 #define QUIC_TUNE_FB_TX_UDP_GSO 0x00000002 #define QUIC_TUNE_FB_CC_HYSTART 0x00000004 +#define QUIC_TUNE_FB_INTEROP 0x00000008 struct quic_tune { struct { diff --git a/src/cfgparse-quic.c b/src/cfgparse-quic.c index 5a005d206..159a24285 100644 --- a/src/cfgparse-quic.c +++ b/src/cfgparse-quic.c @@ -533,7 +533,38 @@ static int cfg_parse_quic_tune_on_off(char **args, int section_type, struct prox return ret; } +static int cfg_parse_quic_tune_interop(char **args, int section_type, struct proxy *curpx, + const struct proxy *defpx, const char *file, int line, + char **err) +{ + int ret = 0; + + if (too_many_args(1, args, err, NULL)) + return -1; + + if (!experimental_directives_allowed) { + memprintf(err, "'%s' is experimental, must be allowed via a global " + "'expose-experimental-directives'.", args[0]); + return -1; + } + mark_tainted(TAINTED_CONFIG_EXP_KW_DECLARED); + + if (strcmp(args[1], "fe") == 0) { + quic_tune.fe.fb_opts |= QUIC_TUNE_FB_INTEROP; + } + else if (strcmp(args[1], "off") == 0) { + quic_tune.fe.fb_opts &= ~QUIC_TUNE_FB_INTEROP; + } + else { + memprintf(err, "'%s' expects 'fe' or 'off'.", args[0]); + return -1; + } + + return ret; +} + static struct cfg_kw_list cfg_kws = {ILH, { + { CFG_GLOBAL, "tune.quic.interop", cfg_parse_quic_tune_interop }, { CFG_GLOBAL, "tune.quic.listen", cfg_parse_quic_tune_on_off }, { CFG_GLOBAL, "tune.quic.mem.tx-max", cfg_parse_quic_tune_setting }, { CFG_GLOBAL, "tune.quic.sec.stateless-reset-rate", cfg_parse_quic_tune_setting }, diff --git a/src/cfgparse-ssl.c b/src/cfgparse-ssl.c index 55a3b3df8..2e4e6770f 100644 --- a/src/cfgparse-ssl.c +++ b/src/cfgparse-ssl.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -1433,10 +1434,25 @@ static int ssl_bind_parse_alpn(char **args, int cur_arg, struct proxy *px, struc free(conf->alpn_str); ret = ssl_sock_parse_alpn(args[cur_arg + 1], &conf->alpn_str, &conf->alpn_len, err); - if (ret) + if (ret) { memprintf(err, "'%s' : %s", args[cur_arg], *err); - else if (global.tune.options2 & GTUNE2_DISABLE_H2_FE) - alpn_remove_token(conf->alpn_str, &conf->alpn_len, ist("h2"), 0); + } + else { + if (global.tune.options2 & GTUNE2_DISABLE_H2_FE) + alpn_remove_token(conf->alpn_str, &conf->alpn_len, ist("h2"), 0); + +#ifdef USE_QUIC + if (!(quic_tune.fe.fb_opts & QUIC_TUNE_FB_INTEROP)) { + if (alpn_remove_token(conf->alpn_str, &conf->alpn_len, ist("hq-interop"), 1)) { + if (!from_cli) { + memprintf(err, "'hq-interop' found in ALPN, forbidden unless QUIC interop testing is active.\n"); + ret |= ERR_ALERT | ERR_FATAL; + } + } + } +#endif /* USE_QUIC */ + } + return ret; #else memprintf(err, "'%s' : library does not support TLS ALPN extension", args[cur_arg]); diff --git a/src/server.c b/src/server.c index 5ffc112d5..86efa9c1f 100644 --- a/src/server.c +++ b/src/server.c @@ -3892,7 +3892,9 @@ static int _srv_parse_init(struct server **srv, char **args, int *cur_arg, if (srv_is_quic(newsrv)) { /* TODO QUIC is currently incompatible with dynamic * backends deletion. Please fix this before removing - * QUIC BE experimental status. + * QUIC BE experimental status. When this is done, + * ensures "hq-interop" remains gated behind the + * experimental status. */ if (!experimental_directives_allowed) { ha_alert("QUIC is experimental for server '%s'," -- 2.47.3