From: Amaury Denoyelle Date: Thu, 30 Jan 2025 17:01:53 +0000 (+0100) Subject: BUILD: quic: fix overflow in global tune X-Git-Tag: v3.1.7~33 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=8d7c8b79d0e881531bae0ed4220ec7d1dd949d67;p=haproxy-3.1.git BUILD: quic: fix overflow in global tune A new global option was recently introduced to disable pacing. However, the value used (1<<31) caused issue with some compiler as options field used for storage is declared as int. Move pacing deactivation flag outside into the newly defined quic_tune to fix this. This should be backported up to 3.1 after a period of observation. Note that it relied on the previous patch which defined new quic_tune type. (cherry picked from commit b849ee5fa35b7a909869db1dfd19f450f3172034) [ada: patch was manually adapted since a19d9b0486 ("MAJOR: quic: mark pacing as stable and enable it by default") was not backported] Signed-off-by: Aurelien DARRAGON --- diff --git a/include/haproxy/global-t.h b/include/haproxy/global-t.h index be4fcc9..6d4a398 100644 --- a/include/haproxy/global-t.h +++ b/include/haproxy/global-t.h @@ -87,7 +87,6 @@ #define GTUNE_LISTENER_MQ_ANY (GTUNE_LISTENER_MQ_FAIR | GTUNE_LISTENER_MQ_OPT) #define GTUNE_QUIC_CC_HYSTART (1<<29) #define GTUNE_QUIC_NO_UDP_GSO (1<<30) -#define GTUNE_QUIC_NO_PACING (1<<31) #define NO_ZERO_COPY_FWD 0x0001 /* Globally disable zero-copy FF */ #define NO_ZERO_COPY_FWD_PT 0x0002 /* disable zero-copy FF for PT (recv & send are disabled automatically) */ diff --git a/include/haproxy/quic_tune-t.h b/include/haproxy/quic_tune-t.h index 37cd741..7d083c5 100644 --- a/include/haproxy/quic_tune-t.h +++ b/include/haproxy/quic_tune-t.h @@ -6,6 +6,8 @@ #error "Must define USE_OPENSSL" #endif +#define QUIC_TUNE_NO_PACING 0x00000001 + struct quic_tune { uint options; }; diff --git a/src/cfgparse-quic.c b/src/cfgparse-quic.c index 92861cd..c74f242 100644 --- a/src/cfgparse-quic.c +++ b/src/cfgparse-quic.c @@ -411,10 +411,10 @@ static int cfg_parse_quic_tune_on_off(char **args, int section_type, struct prox "'expose-experimental-directives'\n", args[0]); return -1; } - global.tune.options &= ~GTUNE_QUIC_NO_PACING; + quic_tune.options &= ~QUIC_TUNE_NO_PACING; } else - global.tune.options |= GTUNE_QUIC_NO_PACING; + quic_tune.options |= QUIC_TUNE_NO_PACING; } return 0; diff --git a/src/cfgparse.c b/src/cfgparse.c index 47e5716..974634a 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -72,6 +72,7 @@ #include #include #include +#include #include #include #include @@ -3096,7 +3097,7 @@ init_proxies_list_stage1: bind_conf->quic_cc_algo : default_quic_cc_algo; if (!(cc_algo->flags & QUIC_CC_ALGO_FL_OPT_PACING) && - global.tune.options & GTUNE_QUIC_NO_PACING) { + quic_tune.options & QUIC_TUNE_NO_PACING) { ha_warning("Binding [%s:%d] for %s %s: using the selected congestion algorithm without pacing may cause slowdowns or high loss rates during transfers.\n", bind_conf->file, bind_conf->line, proxy_type_str(curproxy), curproxy->id); diff --git a/src/haproxy.c b/src/haproxy.c index e0aca47..1e08bb2 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -109,6 +109,7 @@ #include #include #include +#include #include #include #include @@ -1395,7 +1396,7 @@ static void init_args(int argc, char **argv) #endif #ifdef USE_QUIC global.tune.options |= GTUNE_QUIC_SOCK_PER_CONN; - global.tune.options |= GTUNE_QUIC_NO_PACING; + quic_tune.options |= QUIC_TUNE_NO_PACING; #endif global.tune.options |= GTUNE_STRICT_LIMITS; diff --git a/src/mux_quic.c b/src/mux_quic.c index e40c5c1..458da36 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -40,7 +41,7 @@ static void qmux_ctrl_room(struct qc_stream_desc *, uint64_t room); /* Returns true if pacing should be used for connection. */ static int qcc_is_pacing_active(const struct connection *conn) { - return !(global.tune.options & GTUNE_QUIC_NO_PACING); + return !(quic_tune.options & QUIC_TUNE_NO_PACING); } static void qcs_free_ncbuf(struct qcs *qcs, struct ncbuf *ncbuf)