]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: cfgparse: add KWF_DISCOVERY keyword flag
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Fri, 9 Aug 2024 16:46:20 +0000 (18:46 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
This commit is a part of the series to add a support of discovery mode in the
configuration parser and in initialization sequence.

So, let's add here KWF_DISCOVERY flag to distinguish the keywords,
which should be parsed in "discovery" mode and which are needed for master
process, from all others. Keywords, that should be parsed in "discovery" mode
have its dedicated parser funtions. Let's tag these functions with
KWF_DISCOVERY flag in keywords list. Like this, only these keyword parsers
might be called during the first configuration read in discovery mode.

include/haproxy/cfgparse.h
src/cfgparse-global.c
src/mworker.c

index 8b760cdaef9acb3a067bc92dab131d797f1ec986..03e891ccfc6e2a76f7cdba6bc4b6970f9c3a1c2b 100644 (file)
@@ -49,6 +49,7 @@ enum kw_mod {
 enum cfg_keyword_flags {
        KWF_EXPERIMENTAL = 0x1,
        KWF_MATCH_PREFIX = 0x2,
+       KWF_DISCOVERY = 0x4,
 };
 
 struct cfg_keyword {
index 5be150f5fa8a041d164fbca5328ca2523117a500..825bc4c9341d5cb0810ec9ebbcc31f27246b3531 100644 (file)
@@ -1521,15 +1521,15 @@ static struct cfg_kw_list cfg_kws = {ILH, {
        { CFG_GLOBAL, "force-cfg-parser-pause", cfg_parse_global_parser_pause, KWF_EXPERIMENTAL },
        { CFG_GLOBAL, "harden.reject-privileged-ports.tcp",  cfg_parse_reject_privileged_ports },
        { CFG_GLOBAL, "harden.reject-privileged-ports.quic", cfg_parse_reject_privileged_ports },
-       { CFG_GLOBAL, "master-worker", cfg_parse_global_master_worker },
-       { CFG_GLOBAL, "daemon", cfg_parse_global_mode } ,
-       { CFG_GLOBAL, "quiet", cfg_parse_global_mode },
-       { CFG_GLOBAL, "zero-warning", cfg_parse_global_mode },
-       { CFG_GLOBAL, "noepoll", cfg_parse_global_disable_poller },
-       { CFG_GLOBAL, "nokqueue", cfg_parse_global_disable_poller },
-       { CFG_GLOBAL, "noevports", cfg_parse_global_disable_poller },
-       { CFG_GLOBAL, "nopoll", cfg_parse_global_disable_poller },
-       { CFG_GLOBAL, "pidfile", cfg_parse_global_pidfile },
+       { CFG_GLOBAL, "master-worker", cfg_parse_global_master_worker, KWF_DISCOVERY },
+       { CFG_GLOBAL, "daemon", cfg_parse_global_mode, KWF_DISCOVERY } ,
+       { CFG_GLOBAL, "quiet", cfg_parse_global_mode, KWF_DISCOVERY },
+       { CFG_GLOBAL, "zero-warning", cfg_parse_global_mode, KWF_DISCOVERY },
+       { CFG_GLOBAL, "noepoll", cfg_parse_global_disable_poller, KWF_DISCOVERY },
+       { CFG_GLOBAL, "nokqueue", cfg_parse_global_disable_poller, KWF_DISCOVERY },
+       { CFG_GLOBAL, "noevports", cfg_parse_global_disable_poller, KWF_DISCOVERY },
+       { CFG_GLOBAL, "nopoll", cfg_parse_global_disable_poller, KWF_DISCOVERY },
+       { CFG_GLOBAL, "pidfile", cfg_parse_global_pidfile, KWF_DISCOVERY },
        { CFG_GLOBAL, "expose-deprecated-directives", cfg_parse_global_non_std_directives },
        { CFG_GLOBAL, "expose-experimental-directives", cfg_parse_global_non_std_directives },
        { CFG_GLOBAL, "tune.runqueue-depth", cfg_parse_global_tune_opts },
index a5b55d24d15c21aaf3b8c0c25927023b16797b86..90caed279a17e9413050ce9a57abc61ab61ea026 100644 (file)
@@ -843,7 +843,7 @@ void mworker_create_master_cli(void)
 }
 
 static struct cfg_kw_list mworker_kws = {{ }, {
-       { CFG_GLOBAL, "mworker-max-reloads", mworker_parse_global_max_reloads },
+       { CFG_GLOBAL, "mworker-max-reloads", mworker_parse_global_max_reloads, KWF_DISCOVERY },
        { 0, NULL, NULL },
 }};