MEDIUM: config: reject conflicts in table names

A nasty situation happens when two tables have the same name. Since it
is possible to declare a table in a frontend and another one in a backend,
this situation may happen and result in a random behaviour each time a
table is designated in a "stick" or "track" rule. Let's make sure this
is properly detected and stopped. Such a config will now report :

[ALERT] 145/104933 (31571) : parsing [prx.cfg:36] : stick-table name 't' conflicts with table declared in frontend 't' at prx.cfg:30.
[ALERT] 145/104933 (31571) : Error(s) found in configuration file : prx.cfg
[ALERT] 145/104933 (31571) : Fatal errors found in configuration.
This commit is contained in:
Willy Tarreau 2015-05-26 10:49:46 +02:00
parent 911fa2eb8e
commit e45288c0ca

View File

@ -3479,6 +3479,15 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
}
else if (!strcmp(args[0], "stick-table")) {
int myidx = 1;
struct proxy *other;
other = find_stktable(curproxy->id);
if (other) {
Alert("parsing [%s:%d] : stick-table name '%s' conflicts with table declared in %s '%s' at %s:%d.\n",
file, linenum, curproxy->id, proxy_type_str(other), other->id, other->conf.file, other->conf.line);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
curproxy->table.id = curproxy->id;
curproxy->table.type = (unsigned int)-1;