From: Frederic Lecaille Date: Thu, 25 Jan 2024 06:30:40 +0000 (+0100) Subject: BUG/MINOR: quic: newreno QUIC congestion control algorithm no more available X-Git-Tag: v3.0-dev2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9a163e7e1ded0dc9cda78a9da652f14f424605a;p=thirdparty%2Fhaproxy.git BUG/MINOR: quic: newreno QUIC congestion control algorithm no more available There is a typo in the statement to initialize this variable when selecting newreno as cc algo: const char *newreno = "newrno"; This would have happened if #defines had be used in place of several const char * variables harcoded values. Take the opportunity of this patch to use #defines for all the available cc algorithms. Must be backported to 2.9. --- diff --git a/src/cfgparse-quic.c b/src/cfgparse-quic.c index ec2dedacfd..e3917c8a3d 100644 --- a/src/cfgparse-quic.c +++ b/src/cfgparse-quic.c @@ -10,6 +10,10 @@ #include #include +#define QUIC_CC_NEWRENO_STR "newreno" +#define QUIC_CC_CUBIC_STR "cubic" +#define QUIC_CC_NO_CC_STR "nocc" + static int bind_parse_quic_force_retry(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err) { conf->options |= BC_O_QUIC_FORCE_RETRY; @@ -21,9 +25,6 @@ static int bind_parse_quic_cc_algo(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err) { struct quic_cc_algo *cc_algo; - const char *newreno = "newrno"; - const char *cubic = "cubic"; - const char *nocc = "nocc"; const char *algo = NULL; char *arg; @@ -33,19 +34,19 @@ static int bind_parse_quic_cc_algo(char **args, int cur_arg, struct proxy *px, } arg = args[cur_arg + 1]; - if (strncmp(arg, newreno, strlen(newreno)) == 0) { + if (strncmp(arg, QUIC_CC_NEWRENO_STR, strlen(QUIC_CC_NEWRENO_STR)) == 0) { /* newreno */ - algo = newreno; + algo = QUIC_CC_NEWRENO_STR; cc_algo = &quic_cc_algo_nr; - arg += strlen(newreno); + arg += strlen(QUIC_CC_NEWRENO_STR); } - else if (strncmp(arg, cubic, strlen(cubic)) == 0) { + else if (strncmp(arg, QUIC_CC_CUBIC_STR, strlen(QUIC_CC_CUBIC_STR)) == 0) { /* cubic */ - algo = cubic; + algo = QUIC_CC_CUBIC_STR; cc_algo = &quic_cc_algo_cubic; - arg += strlen(cubic); + arg += strlen(QUIC_CC_CUBIC_STR); } - else if (strncmp(arg, nocc, strlen(nocc)) == 0) { + else if (strncmp(arg, QUIC_CC_NO_CC_STR, strlen(QUIC_CC_NO_CC_STR)) == 0) { /* nocc */ if (!experimental_directives_allowed) { ha_alert("'%s' algo is experimental, must be allowed via a global " @@ -53,9 +54,9 @@ static int bind_parse_quic_cc_algo(char **args, int cur_arg, struct proxy *px, goto fail; } - algo = nocc; + algo = QUIC_CC_NO_CC_STR; cc_algo = &quic_cc_algo_nocc; - arg += strlen(nocc); + arg += strlen(QUIC_CC_NO_CC_STR); } else { memprintf(err, "'%s' : unknown control congestion algorithm", args[cur_arg + 1]);