From: Willy Tarreau Date: Tue, 15 Sep 2026 14:37:58 +0000 (+0200) Subject: BUG/MINOR: cfgparse-listen: don't lose the errors reported while creating a proxy X-Git-Tag: v3.5-dev9~160 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=37e580199be819d966d172c051505fdc14fc36ca;p=haproxy.git BUG/MINOR: cfgparse-listen: don't lose the errors reported while creating a proxy When a proxy inherits from its defaults section, the return value of proxy_ref_defaults() was assigned to err_code instead of being ORed into it, wiping all the errors collected earlier for that line. As a result an invalid character in a proxy's name was reported but the process started anyway: $ cat inv.cfg defaults mode http frontend inv@lid bind :8080 $ ./haproxy -c -f inv.cfg [ALERT] : parsing [inv.cfg:3] : character '@' is not permitted in 'frontend' name 'inv@lid'. $ echo 0 0 The same applies to the duplicate name and ambiguous defaults reference diagnostics emitted before the proxy is created. Configurations which were mistakenly accepted until will now be rejected, though they were already emitting an alert. The issue was only introduced in 3.4 with commit 87ea407cce ("MINOR: proxy: refactor proxy inheritance of a defaults section"), so it's fairly unlikely that a bogus configuration was introduced only there, thus a backport would be preferable, or maybe only the err_code should be turned to ERR_WARN to remain tolerant for existing versions. --- diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index e51d193dd..be1eb29de 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -509,9 +509,11 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) curproxy->conf.line_prev = line_prev; if (curr_defproxy) { - err_code = proxy_ref_defaults(curproxy, curr_defproxy, &errmsg); - if (err_code) + int ret = proxy_ref_defaults(curproxy, curr_defproxy, &errmsg); + + if (ret) ha_alert("parsing [%s:%d]: %s.\n", file, linenum, errmsg); + err_code |= ret; } if (rc & PR_CAP_DEF) {