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.
This commit is contained in:
Aurelien DARRAGON 2023-09-22 15:07:25 +02:00 committed by Christopher Faulet
parent 3934901e51
commit 19a1210dcd
1 changed files with 5 additions and 0 deletions

View File

@ -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;