From 19a1210dcd6b9360c701197bd556cf78be3f6ff0 Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Fri, 22 Sep 2023 15:07:25 +0200 Subject: [PATCH] MINOR: cfgparse-listen: warn when use-server rules is used in wrong mode haproxy will report a warning when "use-server" keyword is used within a backend that doesn't support server rules to inform the user that rules will be ignored. To this day, only TCP and HTTP backends can make use of it. --- src/cfgparse-listen.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cfgparse-listen.c b/src/cfgparse-listen.c index e5aafa0b9..bd71111b8 100644 --- a/src/cfgparse-listen.c +++ b/src/cfgparse-listen.c @@ -1442,6 +1442,11 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL)) err_code |= ERR_WARN; + if (curproxy->mode != PR_MODE_TCP && curproxy->mode != PR_MODE_HTTP) { + err_code |= ERR_WARN; + ha_warning("parsing [%s:%d] : '%s' rules will be ignored for %s backend '%s' (unsupported mode).\n", file, linenum, args[0], proxy_mode_str(curproxy->mode), curproxy->id); + } + if (*(args[1]) == 0) { ha_alert("parsing [%s:%d] : '%s' expects a server name.\n", file, linenum, args[0]); err_code |= ERR_ALERT | ERR_FATAL;