]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: init: fix default global settings being overwritten by -G
authorFrederic Lecaille <flecaille@haproxy.com>
Thu, 2 Jul 2026 11:55:49 +0000 (13:55 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Thu, 2 Jul 2026 11:55:49 +0000 (13:55 +0200)
The default global configuration tuning settings (tune.memory.hot-size,
expose-experimental-directives, and tune.pipesize) were lost when the
-G option was used.

The bug was caused by an incorrect scope: these default settings were
nested inside the block that generates the default global header, which
is skipped/overwritten when -G is provided. Fix this by closing the
conditional block early.

This patch depends on this commit:
    "01f4e33ea MINOR: hbuf: new lightweight hbuf API"

Must be backported to 3.4.

src/haterm_init.c

index 0412a2f3c592d5c9aaf6c03d02a0ec6550cd4fdd..c0a76494b8dea78d5a940215f9640ca0ddd0206e 100644 (file)
@@ -366,15 +366,17 @@ void haproxy_init_args(int argc, char **argv)
                        ha_alert("failed to allocate a buffer.\n");
                        goto leave;
                }
+
                hbuf_appendf(&gbuf, "global\n");
-               hbuf_appendf(&gbuf, "\ttune.memory.hot-size 3145728\n");
-               if (has_ssl)
-                       hbuf_appendf(&gbuf, "\texpose-experimental-directives\n");
+       }
+
+       hbuf_appendf(&gbuf, "\ttune.memory.hot-size 3145728\n");
+       if (has_ssl)
+               hbuf_appendf(&gbuf, "\texpose-experimental-directives\n");
 #if defined(USE_LINUX_SPLICE) && defined(HA_USE_KTLS)
-               if (has_ssl)
-                       hbuf_appendf(&gbuf, "\ttune.pipesize 262144\n");
+       if (has_ssl)
+               hbuf_appendf(&gbuf, "\ttune.pipesize 262144\n");
 #endif
-       }
 
        /* "global" section */
        if (!hbuf_is_null(&gbuf))