From: Valentine Krasnobaeva Date: Wed, 9 Oct 2024 21:11:07 +0000 (+0200) Subject: MINOR: cfgparse: add support for program section X-Git-Tag: v3.1-dev10~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a2fac5a3a19c5f0edc76f1afd2ac237d864cae2b;p=thirdparty%2Fhaproxy.git MINOR: cfgparse: add support for program section 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. --- diff --git a/src/cfgparse.c b/src/cfgparse.c index c53e48def5..af41497202 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -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);