]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: extend quic-cc-algo optional parameters
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 19 Nov 2024 14:38:53 +0000 (15:38 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 19 Nov 2024 15:20:52 +0000 (16:20 +0100)
Modify quic-cc-algo for better extensability of optional parameters
parsing. This will be useful to support a new parameter for maximum
allowed pacing burst size.

Take this opportunity to refine quic-cc-algo documentation. Optional
parameters are now presented as a list which would be soon extended.

doc/configuration.txt
src/cfgparse-quic.c

index 9dd465a66a30e9d78743cb1f036e596f3ff35834..8fbd480579f17ac6ab65ff6292f09357df8f0639 100644 (file)
@@ -17035,15 +17035,19 @@ proto <name>
   instance, it is possible to force the http/2 on clear TCP by specifying "proto
   h2" on the bind line.
 
-quic-cc-algo { cubic | newreno | nocc }
-quic-cc-algo { cubic | newreno | nocc }(<max_window>)
+quic-cc-algo { cubic | newreno | nocc }[(<args,...>)]
   This is a QUIC specific setting to select the congestion control algorithm
   for any connection attempts to the configured QUIC listeners. They are similar
-  to those used by TCP. An optional value in bytes may be used to specify the
-  maximum window size. It must be greater than 10k and smaller than 4g.
+  to those used by TCP.
 
   Default value: cubic
-  Default window value: "tune.quic.frontend.default-max-window-size"
+
+  For further customization, a list of parameters can be specified after the
+  algorithm token. It must be written between parenthesis, separated by a comma
+  operator. Each argument is optional and can be empty if needed. Here is the
+  mandatory order of each parameters :
+  - maximum window size in bytes. It must be greater than 10k and smaller than
+    4g. By default "tune.quic.frontend.default-max-window-size" value is used.
 
   Example:
       # newreno congestion control algorithm
index 7d870625bc67a51cd5856e7eba7ddc635d53a306..c7ff2b7ca53c682dad90117f278c73820d1db5aa 100644 (file)
@@ -119,21 +119,35 @@ static int bind_parse_quic_cc_algo(char **args, int cur_arg, struct proxy *px,
        }
 
        if (*arg++ == '(') {
-               unsigned long cwnd;
                char *end_opt;
 
-               cwnd = parse_window_size(args[cur_arg], arg, &end_opt, err);
-               if (!cwnd)
-                       goto fail;
+               if (*arg == ')')
+                       goto out;
 
-               if (*end_opt != ')') {
-                       memprintf(err, "'%s' : expects %s(<max window>)", args[cur_arg + 1], algo);
-                       goto fail;
+               if (*arg != ',') {
+                       unsigned long cwnd = parse_window_size(args[cur_arg], arg, &end_opt, err);
+                       if (!cwnd)
+                               goto fail;
+
+                       conf->max_cwnd = cwnd;
+
+                       if (*end_opt == ')') {
+                               goto out;
+                       }
+                       else if (*end_opt != ',') {
+                               memprintf(err, "'%s' : cannot parse max-window argument for '%s' algorithm", args[cur_arg], algo);
+                               goto fail;
+                       }
+                       arg = end_opt;
                }
 
-               conf->max_cwnd = cwnd;
+               if (*++arg != ')') {
+                       memprintf(err, "'%s' : too many argument for '%s' algorithm", args[cur_arg], algo);
+                       goto fail;
+               }
        }
 
+ out:
        conf->quic_cc_algo = cc_algo;
        return 0;