]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cfgparse: add support for program section
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Wed, 9 Oct 2024 21:11:07 +0000 (23:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
This patch is a part of series to reintroduce the program support in the new
master-worker architecture.

Programs are launched by master, thus only the master process needs its
configuration. Therefore, program section parser should be called only in
discovery mode, when master parses its configuration.

Program section has a post section parser. It should be called only in
discovery mode as well.

src/cfgparse.c

index c53e48def520690b8227c29ee741478ed07236b5..af414972027c55bed01eadbd438dbf5aeb1db002 100644 (file)
@@ -2565,8 +2565,8 @@ next_line:
                if (pcs && pcs->post_section_parser) {
                        int status;
 
-                       /* for the moment don't call post_section_parser in MODE_DISCOVERY */
-                       if (global.mode & MODE_DISCOVERY)
+                       /* don't call post_section_parser in MODE_DISCOVERY, except program section */
+                       if ((global.mode & MODE_DISCOVERY) && (strcmp(pcs->section_name, "program") != 0))
                                continue;
 
                        status = pcs->post_section_parser();
@@ -2589,8 +2589,9 @@ next_line:
                } else {
                        int status;
 
-                       /* for the moment read only the "global" section in MODE_DISCOVERY */
-                       if ((global.mode & MODE_DISCOVERY) && (strcmp(cs->section_name, "global") != 0))
+                       /* read only the "global" and "program" sections in MODE_DISCOVERY */
+                       if (((global.mode & MODE_DISCOVERY) && (strcmp(cs->section_name, "global") != 0)
+                            && (strcmp(cs->section_name, "program") != 0)))
                                continue;
 
                        status = cs->section_parser(file, linenum, args, kwm);