From: William Lallemand Date: Tue, 13 Oct 2026 14:40:36 +0000 (+0000) Subject: BUG/MINOR: cfgparse-global: only warn when "localpeer" is set together with -L X-Git-Tag: v3.5-dev9~24 X-Git-Url: https://git.kaiwu.me/$%7BISSUES%7D/static/gitweb.js?a=commitdiff_plain;h=2c3ccf1b417f16e6593c2d9e9598ee588e1b556a;p=haproxy.git BUG/MINOR: cfgparse-global: only warn when "localpeer" is set together with -L Setting "localpeer" in the global section while "-L" is passed on the command line makes haproxy refuse to load its configuration: [ALERT] (447) : config : parsing [haproxy.cfg:428] : 'localpeer' ignored since it is already set by using the '-L' command line argument. [ALERT] (447) : config : Error(s) found in configuration file : haproxy.cfg [ALERT] (447) : config : Fatal errors found in configuration. The intent of this check is that "-L" wins and "localpeer" is ignored, and the documentation still advertises a warning for that case, as did 3.0. The parser introduced by commit d253f30823 ("MINOR: cfgparse-global: add cfg_parse_global_localpeer") returns -1 there, which the global keyword dispatcher turns into an alert and ERR_FATAL. Returning 1 instead makes it emit a warning and set ERR_WARN, like the other "already specified, continuing" cases of the same file (pidfile, chroot, tune.*), and the local peer name keeps being taken from "-L". Operators who share one configuration file and select the local peer with "-L" on some instances only can no longer start haproxy at all and must edit their configuration to work around it, hence the bug tag. This should be backported to 3.1 and above, where d253f30823 is present; the fix is a single return value change and applies as-is to 3.1, 3.2, 3.3 and 3.4. --- diff --git a/src/cfgparse-global.c b/src/cfgparse-global.c index 6d5dc02fc..a0ef86a78 100644 --- a/src/cfgparse-global.c +++ b/src/cfgparse-global.c @@ -1102,7 +1102,7 @@ static int cfg_parse_global_localpeer(char **args, int section_type, struct prox if (global.localpeer_cmdline != 0) { memprintf(err, "'%s' ignored since it is already set by using the '-L' " "command line argument.\n", args[0]); - return -1; + return 1; } free(localpeer);