]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: cfgparse-global: only warn when "localpeer" is set together with -L
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 13 Oct 2026 14:40:36 +0000 (14:40 +0000)
committerWilliam Lallemand <wlallemand@haproxy.com>
Tue, 13 Oct 2026 14:40:36 +0000 (14:40 +0000)
commit2c3ccf1b417f16e6593c2d9e9598ee588e1b556a
treec0334d60753808eacfdbf0d27b8d9467371b802b
parent64ae758ac629138d49af955878845393b0beec2d
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.
src/cfgparse-global.c