From: Valentine Krasnobaeva Date: Tue, 15 Oct 2024 13:21:47 +0000 (+0200) Subject: MINOR: cfgparse: fix *thread keywords sensitive to global section position X-Git-Tag: v3.1-dev10~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=223caab96fb02d2169f8ed7fa16a54167873c0d8;p=thirdparty%2Fhaproxy.git MINOR: cfgparse: fix *thread keywords sensitive to global section position *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. --- diff --git a/src/haproxy.c b/src/haproxy.c index 0ecf42a21d..31fb7fe5cb 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -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);