From 6dfc8fbf1d7c894eeeb0b6f0a4ffc0fa12647f4d Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Tue, 19 Nov 2024 15:38:53 +0100 Subject: [PATCH] MINOR: quic: extend quic-cc-algo optional parameters 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 | 14 +++++++++----- src/cfgparse-quic.c | 30 ++++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index 9dd465a66a..8fbd480579 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -17035,15 +17035,19 @@ proto 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 }() +quic-cc-algo { cubic | newreno | nocc }[()] 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 diff --git a/src/cfgparse-quic.c b/src/cfgparse-quic.c index 7d870625bc..c7ff2b7ca5 100644 --- a/src/cfgparse-quic.c +++ b/src/cfgparse-quic.c @@ -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()", 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;