]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cfgparse: fix *thread keywords sensitive to global section position
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Tue, 15 Oct 2024 13:21:47 +0000 (15:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
*thread keywords parsers are sensitive to global section position. If they are
present there, the global section must be the first section in the
configuration. *thread parsers logic is based on non_global_section_parsed
counter. So, we need to reset it explicitly before the second configuration
read done by worker or in a standalone mode.

src/haproxy.c

index 0ecf42a21d4529055fe863ec6366130efcd26483..31fb7fe5cb067d2c16110aa96b847687965bc6a8 100644 (file)
@@ -2214,6 +2214,13 @@ static void init(int argc, char **argv)
 
        /* worker, daemon, foreground mode reads the rest of the config */
        if (!(global.mode & MODE_MWORKER)) {
+               /* nbthread and *thread keywords parsers are sensible to global
+                * section position, it should be placed as the first in
+                * the configuration, if these keywords are inside. So, let's
+                * reset non_global_section_parsed counter for the second
+                * configuration reading
+                */
+               non_global_section_parsed = 0;
                if (read_cfg(progname) < 0) {
                        list_for_each_entry_safe(cfg, cfg_tmp, &cfg_cfgfiles, list) {
                                ha_free(&cfg->content);