]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mworker: section ignored in discovery after a post_section_parser
authorWilliam Lallemand <wlallemand@haproxy.com>
Wed, 12 Feb 2025 11:09:05 +0000 (12:09 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Wed, 12 Feb 2025 11:18:17 +0000 (12:18 +0100)
When a new section is discovered, the post_section_parser of the
previous section is called. However in the new master-worker mode the
discovery mode will skip the post_section_parser. But instead of
trying to parse the current section keyword after that, it would skip
completely the current line.

This is a minor bug since there isn't a lot of section with
post_section_parser, and not a lot of section to parse in discovery
mode.

But this could be reproduced like this:

global
        expose-deprecated-directives

resolvers res
parse-resolv-conf

program foo
        command sleep 10

program bar
       command sleep 10

Ths 'resolvers' section has a post_section_parser which will be ignored
in discovery mode with the consequence of ignoring the first program
section.

This must be backported in 3.1.

src/cfgparse.c

index 216c8dcfebd2e67e063e3e04c58ecdde6c975e43..9b9718258fe8f696477dc289414d6137c4f1e081 100644 (file)
@@ -2578,7 +2578,7 @@ next_line:
 
                        /* don't call post_section_parser in MODE_DISCOVERY, except program section */
                        if ((global.mode & MODE_DISCOVERY) && (strcmp(pcs->section_name, "program") != 0))
-                               continue;
+                               goto section_parser;
 
                        status = pcs->post_section_parser();
                        err_code |= status;
@@ -2590,6 +2590,7 @@ next_line:
                }
                pcs = NULL;
 
+section_parser:
                if (!cs) {
                        /* ignore unknown section names during the first read in MODE_DISCOVERY */
                        if (global.mode & MODE_DISCOVERY)