BUG/MEDIUM: cfgcheck: verify existing log-forward listeners during config check
authorEmeric Brun <ebrun@haproxy.com>
Fri, 13 Aug 2021 07:32:50 +0000 (09:32 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 13 Aug 2021 09:24:17 +0000 (11:24 +0200)
commitdce6f836723f8cb6a6e9ee54cb85bffe90442cb1
tree97dc04373e52ed67360d285431d4abc402ba9f35
parentad623171097dd18905bcf26b81581b56fe7af9b1
BUG/MEDIUM: cfgcheck: verify existing log-forward listeners during config check

User reported that the config check returns an error with the message:
"Configuration file has no error but will not start (no listener) => exit(2)."
if the configuration present only a log-forward section with bind or dgram-bind
listeners but no listen/backend nor peer sections.

The process checked if there was 'peers' section avalaible with
an internal frontend (and so a listener) or a 'listen/backend'
section not disabled with at least one configured listener (into the
global proxies_list). Since the log-forward proxies appear in a
different list, they were not checked.

This patch adds a lookup on the 'log-forward' proxies list to check
if one of them presents a listener and is not disabled. And
this is done only if there was no available listener found into
'listen/backend' sections.

I have also studied how to re-work this check considering the 'listeners'
counter used after startup/init to keep the same algo and avoid further
mistakes but currently this counter seems increased during config parsing
and if a proxy is disabled, decreased during startup/init which is done
after the current config check. So the fix still not rely on this
counter.

This patch should fix the github issue #1346

This patch should be backported as far as 2.3 (so on branches
including the "log-forward" feature)

(cherry picked from commit bc5c821cc259d343b6f1c8e457ead9518fd8198d)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 3a9c000738e90f73e5479658dc3987483d8a0f1b)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/haproxy.c