]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: config: reject invalid config with name duplicates
authorWilly Tarreau <w@1wt.eu>
Tue, 26 May 2015 08:35:50 +0000 (10:35 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 26 May 2015 08:48:17 +0000 (10:48 +0200)
commit911fa2eb8ea9565931864a0a67c9c2d72800eb61
tree9001649ad3977feb09756d037d13ffc22b366594
parent1f673c72c11d011bbd24e309d3155384eddf7a46
MEDIUM: config: reject invalid config with name duplicates

Since 1.4 we used to emit a warning when two frontends or two backends
had the same name. In 1.5 we added the same warning for two peers sections.
In 1.6 we added the same warning for two mailers sections. It's about time
to reject such invalid configurations, the impact they have on the code
complexity is huge and it is becoming a real obstacle to some improvements
such as restoring servers check status across reloads.

Now these errors are reported as fatal errors and will need to be fixed.
Anyway, till now there was no guarantee that what was written was working
as expected since the behaviour is not defined (eg: use_backend with a
name used by two backends leads to undefined behaviour).

Example of output :

[ALERT] 145/104759 (31564) : Parsing [prx.cfg:12]: mailers section 'm' has the same name as another mailers section declared at prx.cfg:10.
[ALERT] 145/104759 (31564) : Parsing [prx.cfg:16]: peers section 'p' has the same name as another peers section declared at prx.cfg:14.
[ALERT] 145/104759 (31564) : Parsing [prx.cfg:21]: frontend 'f' has the same name as another frontend declared at prx.cfg:18.
[ALERT] 145/104759 (31564) : Parsing [prx.cfg:27]: backend 'b' has the same name as another backend declared at prx.cfg:24.
[ALERT] 145/104759 (31564) : Error(s) found in configuration file : prx.cfg
[ALERT] 145/104759 (31564) : Fatal errors found in configuration.
src/cfgparse.c