]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: quic: fix overflow in global tune
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 30 Jan 2025 17:01:53 +0000 (18:01 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 30 Jan 2025 17:12:53 +0000 (18:12 +0100)
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.

include/haproxy/global-t.h
include/haproxy/quic_tune-t.h
src/cfgparse-quic.c
src/cfgparse.c
src/mux_quic.c

index be4fcc922036cd0fcd9f00508d8a1a4f1e097b02..6d4a3986c9ef43eb7882629e8642bd23f76554a4 100644 (file)
@@ -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) */
index 37cd741064acadeed23f9bc8a2138506cfb90fcc..7d083c5899d791747037a0a6a8385aaaa4a9f88b 100644 (file)
@@ -6,6 +6,8 @@
 #error "Must define USE_OPENSSL"
 #endif
 
+#define QUIC_TUNE_NO_PACING     0x00000001
+
 struct quic_tune {
        uint options;
 };
index 53c385a742021a27e0122cee7aff7cc44925ee89..a1621967c96578c64da72f1f56c860622aba5409 100644 (file)
@@ -354,7 +354,7 @@ static int cfg_parse_quic_tune_setting0(char **args, int section_type,
 
        suffix = args[0] + prefix_len;
        if (strcmp(suffix, "disable-tx-pacing") == 0) {
-               global.tune.options |= GTUNE_QUIC_NO_PACING;
+               quic_tune.options |= QUIC_TUNE_NO_PACING;
        }
        else if (strcmp(suffix, "disable-udp-gso") == 0) {
                global.tune.options |= GTUNE_QUIC_NO_UDP_GSO;
index b36be44eaf969937896841cea9f00aa5df5a23ec..c2d0ca5c358be6f22b2a474c0b008ed822ceb838 100644 (file)
@@ -72,6 +72,7 @@
 #include <haproxy/namespace.h>
 #include <haproxy/quic_cc-t.h>
 #include <haproxy/quic_sock.h>
+#include <haproxy/quic_tune.h>
 #include <haproxy/obj_type-t.h>
 #include <haproxy/openssl-compat.h>
 #include <haproxy/peers-t.h>
@@ -3059,7 +3060,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);
index d8b43a913c848a712c5f97a0a602dcf75ba250cd..ebe37fe1090fcdf57398695c4c9cb5175e2d8f0d 100644 (file)
@@ -23,6 +23,7 @@
 #include <haproxy/quic_sock.h>
 #include <haproxy/quic_stream.h>
 #include <haproxy/quic_tp-t.h>
+#include <haproxy/quic_tune.h>
 #include <haproxy/quic_tx.h>
 #include <haproxy/session.h>
 #include <haproxy/ssl_sock-t.h>
@@ -40,7 +41,7 @@ static void qmux_ctrl_room(struct qc_stream_desc *, uint64_t room);
 /* Returns true if pacing should be used for <conn> 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)