mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
CLEANUP: cfgparse: lookup proxy ID using existing functions
The code used to detect proxy id conflicts uses an open-coded lookup in the ID tree which is not necessary since we already have functions for this. Let's switch to that instead.
This commit is contained in:
parent
31526f73e6
commit
a3443db2eb
@ -710,7 +710,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
}
|
||||
else if (strcmp(args[0], "id") == 0) {
|
||||
struct eb32_node *node;
|
||||
struct proxy *conflict;
|
||||
|
||||
if (curproxy->cap & PR_CAP_DEF) {
|
||||
ha_alert("parsing [%s:%d]: '%s' not allowed in 'defaults' section.\n",
|
||||
@ -740,12 +740,11 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
|
||||
node = eb32_lookup(&used_proxy_id, curproxy->uuid);
|
||||
if (node) {
|
||||
struct proxy *target = container_of(node, struct proxy, conf.id);
|
||||
conflict = proxy_find_by_id(curproxy->uuid, 0, 0);
|
||||
if (conflict) {
|
||||
ha_alert("parsing [%s:%d]: %s %s reuses same custom id as %s %s (declared at %s:%d).\n",
|
||||
file, linenum, proxy_type_str(curproxy), curproxy->id,
|
||||
proxy_type_str(target), target->id, target->conf.file, target->conf.line);
|
||||
proxy_type_str(conflict), conflict->id, conflict->conf.file, conflict->conf.line);
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user