]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: Forbid server definitions in frontend sections
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 13 Jan 2021 12:14:13 +0000 (13:14 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 13 Jan 2021 16:45:34 +0000 (17:45 +0100)
An fatal error is now reported if a server is defined in a frontend
section. til now, a warning was just emitted and the server was ignored. The
warning was added in the 1.3.4 when the frontend/backend keywords were
introduced to allow a smooth transition and to not break existing
configs. It is old enough now to emit an fatal error in this case.

This patch is related to the issue #1043. It may be backported at least as
far as 2.2, and possibly to older versions. It relies on the previous commit
("MINOR: config: Add failifnotcap() to emit an alert on proxy capabilities").

src/server.c

index 1c4ad7aaf21edf28bc052600cc4c6ee6697dde65..95082099b0b6a1913ae794e5c2b940ea0379d5a2 100644 (file)
@@ -1961,8 +1961,10 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
                        err_code |= ERR_ALERT | ERR_FATAL;
                        goto out;
                }
-               else if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL))
-                       err_code |= ERR_WARN;
+               else if (failifnotcap(curproxy, PR_CAP_BE, file, linenum, args[0], NULL)) {
+                       err_code |= ERR_ALERT | ERR_FATAL;
+                       goto out;
+               }
 
                /* There is no mandatory first arguments for default server. */
                if (srv && parse_addr) {