]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: quic: split max-idle-timeout option for FE/BE usage
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 10 Sep 2025 07:53:48 +0000 (09:53 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Oct 2025 14:49:20 +0000 (16:49 +0200)
Streamline max-idle-timeout option. Rename it to use the newer cohesive
naming scheme 'tune.quic.fe|be.'.

Two different fields were already defined in global struct. These fields
are moved into quic_tune along with other QUIC settings. However, no
parser was defined for backend option, this commit fixes this.

No need to backport this.

doc/configuration.txt
include/haproxy/global-t.h
include/haproxy/quic_tp-t.h
include/haproxy/quic_tune-t.h
src/cfgparse-quic.c
src/haproxy.c
src/quic_tp.c

index 5beab05796f01ab5e97557c87c5f4576252ce0ff..2dfbf902e04aa880fc1589fa448a32ea254d8711 100644 (file)
@@ -1892,6 +1892,7 @@ The following keywords are supported in the "global" section :
    - tune.quic.be.cc.hystart
    - tune.quic.be.cc.max-frame-loss
    - tune.quic.be.cc.reorder-ratio
+   - tune.quic.be.max-idle-timeout
    - tune.quic.be.sec.glitches-threshold
    - tune.quic.be.tx.pacing
    - tune.quic.be.tx.udp-gso
@@ -1903,13 +1904,14 @@ The following keywords are supported in the "global" section :
    - tune.quic.fe.cc.hystart
    - tune.quic.fe.cc.max-frame-loss
    - tune.quic.fe.cc.reorder-ratio
+   - tune.quic.fe.max-idle-timeout
    - tune.quic.fe.sec.glitches-threshold
    - tune.quic.fe.sec.retry-threshold
    - tune.quic.fe.sock-per-conn
    - tune.quic.fe.tx.pacing
    - tune.quic.fe.tx.udp-gso
    - tune.quic.frontend.max-data-size
-   - tune.quic.frontend.max-idle-timeout
+   - tune.quic.frontend.max-idle-timeout (deprecated)
    - tune.quic.frontend.max-streams-bidi
    - tune.quic.frontend.max-tx-mem (deprecated)
    - tune.quic.frontend.stream-data-ratio
@@ -4763,6 +4765,24 @@ tune.quic.reorder-ratio <0..100, in percent> (deprecated)
   part of the streamlining process apply on QUIC configuration. If used, this
   setting will only be applied on frontend connections.
 
+tune.quic.be.max-idle-timeout <timeout>
+tune.quic.fe.max-idle-timeout <timeout>
+  Sets the QUIC max_idle_timeout transport parameters on either frontend or
+  backend side. It follows the HAProxy time format and is expressed in
+  milliseconds. This determines the period of time after which a connection is
+  silently closed if it has remained inactive during an effective period of
+  time. Both endpoints relies on the same negotiated value :
+    - the minimum of the two parameters if both are not null,
+    - the maximum if only one of them is not null,
+    - if both parameters are null, this feature is disabled.
+
+  The default value is 30s.
+
+tune.quic.frontend.max-idle-timeout <timeout> (deprecated)
+  This keyword has been deprecated in 3.3 and will be removed in 3.5. It is
+  part of the streamlining process apply on QUIC configuration. If used, this
+  setting will only be applied on frontend connections.
+
 tune.quic.be.sec.glitches-threshold <number>
 tune.quic.fe.sec.glitches-threshold <number>
   Sets the threshold for the number of glitches per connection either on
@@ -4881,17 +4901,6 @@ tune.quic.frontend.max-data-size <size>
   See also: "tune.quic.frontend.max-streams-bidi",
             "tune.quic.frontend.stream-data-ratio"
 
-tune.quic.frontend.max-idle-timeout <timeout>
-  Sets the QUIC max_idle_timeout transport parameters in milliseconds for
-  frontends which determines the period of time after which a connection silently
-  closes if it has remained inactive during an effective period of time deduced
-  from the two max_idle_timeout values announced by the two endpoints:
-    - the minimum of the two values if both are not null,
-    - the maximum if only one of them is not null,
-    - if both values are null, this feature is disabled.
-
-  The default value is 30000.
-
 tune.quic.frontend.max-streams-bidi <number>
   Sets the QUIC initial_max_streams_bidi transport parameter for frontends.
   This is the initial maximum number of bidirectional streams the remote peer
index e44cacda5ef3e3c4c703fe89bc0044fd1af0f6f1..2b0bbae213de1967e8974bbb32000510390b6be2 100644 (file)
@@ -215,8 +215,6 @@ struct global {
                uint ring_queues;   /* if >0, #ring queues, otherwise equals #thread groups */
                enum threadgroup_takeover tg_takeover; /* Policy for threadgroup takeover */
 #ifdef USE_QUIC
-               unsigned int quic_backend_max_idle_timeout;
-               unsigned int quic_frontend_max_idle_timeout;
                unsigned int quic_frontend_max_data;
                unsigned int quic_frontend_max_streams_bidi;
                size_t quic_frontend_max_window_size;
index 3c9ae384669844b704d4131fbebea48189787ae5..24c0f156021c924250a12dee0e151968df38c752 100644 (file)
@@ -41,9 +41,7 @@ struct tp_version_information {
 /* These ones are our implementation default values when not set
  * by configuration
  */
-#define QUIC_TP_DFLT_FRONT_MAX_IDLE_TIMEOUT      30000 /* milliseconds */
 #define QUIC_TP_DFLT_FRONT_MAX_STREAMS_BIDI        100
-#define QUIC_TP_DFLT_BACK_MAX_IDLE_TIMEOUT       30000 /* milliseconds */
 #define QUIC_TP_DFLT_FRONT_STREAM_DATA_RATIO        90
 
 /* Types of QUIC transport parameters */
index 0ccb8d50ef83f6dd885caef9218582ccf66dd416..42f239f944f0486ed21c27e31f68b921ca253014 100644 (file)
@@ -11,6 +11,9 @@
 #define QUIC_DFLT_CC_MAX_FRAME_LOSS       10
 /* Default ratio value applied to a dynamic Packet reorder threshold. */
 #define QUIC_DFLT_CC_REORDER_RATIO        50 /* in percent */
+/* Default max-idle-timeout advertised via TP */
+#define QUIC_DFLT_FE_MAX_IDLE_TIMEOUT   30000 /* milliseconds */
+#define QUIC_DFLT_BE_MAX_IDLE_TIMEOUT   30000 /* milliseconds */
 /* Default Retry threshold */
 #define QUIC_DFLT_SEC_RETRY_THRESHOLD     100 /* in connection openings */
 
@@ -27,6 +30,7 @@ struct quic_tune {
                uint cc_cubic_min_losses;
                uint cc_max_frame_loss;
                uint cc_reorder_ratio;
+               uint max_idle_timeout;
                uint sec_glitches_threshold;
                uint sec_retry_threshold;
                uint opts;    /* QUIC_TUNE_FE_* options specific to FE side */
@@ -37,6 +41,7 @@ struct quic_tune {
                uint cc_cubic_min_losses;
                uint cc_max_frame_loss;
                uint cc_reorder_ratio;
+               uint max_idle_timeout;
                uint sec_glitches_threshold;
                uint fb_opts; /* QUIC_TUNE_FB_* options shared by both side */
        } be;
index f16660f161b9d5aed0806f5f472a58596bd4662c..757f5ce368447b899a959d2158f79a0ad8e04c24 100644 (file)
@@ -27,6 +27,7 @@ struct quic_tune quic_tune = {
        .fe = {
                .cc_max_frame_loss = QUIC_DFLT_CC_MAX_FRAME_LOSS,
                .cc_reorder_ratio  = QUIC_DFLT_CC_REORDER_RATIO,
+               .max_idle_timeout  = QUIC_DFLT_FE_MAX_IDLE_TIMEOUT,
                .sec_retry_threshold = QUIC_DFLT_SEC_RETRY_THRESHOLD,
                .fb_opts = QUIC_TUNE_FB_TX_PACING|QUIC_TUNE_FB_TX_UDP_GSO,
                .opts = QUIC_TUNE_FE_SOCK_PER_CONN,
@@ -34,6 +35,7 @@ struct quic_tune quic_tune = {
        .be = {
                .cc_max_frame_loss = QUIC_DFLT_CC_MAX_FRAME_LOSS,
                .cc_reorder_ratio  = QUIC_DFLT_CC_REORDER_RATIO,
+               .max_idle_timeout  = QUIC_DFLT_BE_MAX_IDLE_TIMEOUT,
                .fb_opts = QUIC_TUNE_FB_TX_PACING|QUIC_TUNE_FB_TX_UDP_GSO,
        },
        .mem_tx_max = QUIC_MAX_TX_MEM,
@@ -276,9 +278,11 @@ static int cfg_parse_quic_time(char **args, int section_type,
                                const struct proxy *defpx,
                                const char *file, int line, char **err)
 {
+       int ret = 0;
        unsigned int time;
        const char *res, *name, *value;
-       int prefix_len = strlen("tune.quic.");
+       const int prefix_len = strlen("tune.quic.");
+       const char *suffix;
 
        if (too_many_args(1, args, err, NULL))
                return -1;
@@ -301,16 +305,26 @@ static int cfg_parse_quic_time(char **args, int section_type,
                return -1;
        }
 
-       if (strcmp(name + prefix_len, "frontend.max-idle-timeout") == 0)
-               global.tune.quic_frontend_max_idle_timeout = time;
-       else if (strcmp(name + prefix_len, "backend.max-idle-timeout") == 0)
-               global.tune.quic_backend_max_idle_timeout = time;
+       suffix = name + prefix_len;
+       if (strcmp(suffix, "be.max-idle-timeout") == 0 ||
+           strcmp(suffix, "fe.max-idle-timeout") == 0) {
+               uint *ptr = (suffix[0] == 'b') ? &quic_tune.be.max_idle_timeout :
+                                                &quic_tune.fe.max_idle_timeout;
+               *ptr = time;
+       }
+       /* legacy options */
+       else if (strcmp(name + prefix_len, "frontend.max-idle-timeout") == 0) {
+               memprintf(err, "'%s' is deprecated in 3.3 and will be removed in 3.5. "
+                              "Please use the newer keyword syntax 'tune.quic.fe.max-idle-timeout'.", args[0]);
+               quic_tune.fe.max_idle_timeout = time;
+               ret = 1;
+       }
        else {
                memprintf(err, "'%s' keyword not unhandled (please report this bug).", args[0]);
-               return -1;
+               ret = -1;
        }
 
-       return 0;
+       return ret;
 }
 
 /* Parse any tune.quic.* setting with strictly positive integer values.
@@ -582,7 +596,6 @@ static struct cfg_kw_list cfg_kws = {ILH, {
        { CFG_GLOBAL, "tune.quic.mem.tx-max", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.frontend.max-data-size", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.frontend.max-streams-bidi", cfg_parse_quic_tune_setting },
-       { CFG_GLOBAL, "tune.quic.frontend.max-idle-timeout", cfg_parse_quic_time },
        { CFG_GLOBAL, "tune.quic.frontend.default-max-window-size", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.frontend.stream-data-ratio", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.zero-copy-fwd-send", cfg_parse_quic_tune_on_off },
@@ -591,6 +604,7 @@ static struct cfg_kw_list cfg_kws = {ILH, {
        { CFG_GLOBAL, "tune.quic.fe.cc.hystart", cfg_parse_quic_tune_on_off },
        { CFG_GLOBAL, "tune.quic.fe.cc.max-frame-loss", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.fe.cc.reorder-ratio", cfg_parse_quic_tune_setting },
+       { CFG_GLOBAL, "tune.quic.fe.max-idle-timeout", cfg_parse_quic_time },
        { CFG_GLOBAL, "tune.quic.fe.sec.glitches-threshold", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.fe.sec.retry-threshold", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.fe.sock-per-conn", cfg_parse_quic_tune_sock_per_conn },
@@ -601,6 +615,7 @@ static struct cfg_kw_list cfg_kws = {ILH, {
        { CFG_GLOBAL, "tune.quic.be.cc.hystart", cfg_parse_quic_tune_on_off },
        { CFG_GLOBAL, "tune.quic.be.cc.max-frame-loss", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.be.cc.reorder-ratio", cfg_parse_quic_tune_setting },
+       { CFG_GLOBAL, "tune.quic.be.max-idle-timeout", cfg_parse_quic_time },
        { CFG_GLOBAL, "tune.quic.be.sec.glitches-threshold", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.be.tx.pacing", cfg_parse_quic_tune_on_off },
        { CFG_GLOBAL, "tune.quic.be.tx.udp-gso", cfg_parse_quic_tune_on_off },
@@ -611,6 +626,7 @@ static struct cfg_kw_list cfg_kws = {ILH, {
        { CFG_GLOBAL, "tune.quic.disable-tx-pacing", cfg_parse_quic_tune_setting0 },
        { CFG_GLOBAL, "tune.quic.disable-udp-gso", cfg_parse_quic_tune_setting0 },
        { CFG_GLOBAL, "tune.quic.frontend.glitches-threshold", cfg_parse_quic_tune_setting },
+       { CFG_GLOBAL, "tune.quic.frontend.max-idle-timeout", cfg_parse_quic_time },
        { CFG_GLOBAL, "tune.quic.frontend.max-tx-mem", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.max-frame-loss", cfg_parse_quic_tune_setting },
        { CFG_GLOBAL, "tune.quic.reorder-ratio", cfg_parse_quic_tune_setting },
index da4f63228e24e33c5059351696dba7d5557d2b09..87a62d9decd16e1e28cec1b68bc74541f5468bc8 100644 (file)
@@ -199,8 +199,6 @@ struct global global = {
                .nb_stk_ctr = MAX_SESS_STKCTR,
                .default_shards = -2, /* by-group */
 #ifdef USE_QUIC
-               .quic_backend_max_idle_timeout = QUIC_TP_DFLT_BACK_MAX_IDLE_TIMEOUT,
-               .quic_frontend_max_idle_timeout = QUIC_TP_DFLT_FRONT_MAX_IDLE_TIMEOUT,
                .quic_frontend_max_data = 0,
                .quic_frontend_max_streams_bidi = QUIC_TP_DFLT_FRONT_MAX_STREAMS_BIDI,
                .quic_frontend_max_window_size = QUIC_DFLT_MAX_WINDOW_SIZE,
index bc33664d495510c35749f67ceb5fcccf49b40cd0..e85705eee4de5ceabb70a8ebe4ceacfeb1ff5162 100644 (file)
@@ -58,10 +58,9 @@ void quic_transport_params_init(struct quic_transport_params *p, int server)
         * QUIC_TP_DFLT_MAX_UDP_PAYLOAD_SIZE
         */
        p->max_udp_payload_size = QUIC_MAX_UDP_PAYLOAD_SIZE;
-       if (server)
-               p->max_idle_timeout = global.tune.quic_frontend_max_idle_timeout;
-       else
-               p->max_idle_timeout = global.tune.quic_backend_max_idle_timeout;
+
+       p->max_idle_timeout = server ? quic_tune.fe.max_idle_timeout :
+                                      quic_tune.be.max_idle_timeout;
 
        /* Set limit on number of concurrently opened streams. */
        p->initial_max_streams_bidi = max_streams_bidi;