]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stktable: report the current proxy name in error messages
authorWilly Tarreau <w@1wt.eu>
Fri, 24 Jan 2020 06:19:34 +0000 (07:19 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 24 Jan 2020 06:19:34 +0000 (07:19 +0100)
Since commit 1b8e68e89a ("MEDIUM: stick-table: Stop handling stick-tables
as proxies."), a rule referencing the current proxy with no table leads
to the following error :

  [ALERT] 023/071924 (16479) : Proxy 'px': unable to find stick-table '(null)'.
  [ALERT] 023/071914 (16479) : Fatal errors found in configuration.

for a config like this one:

  backend px
        stick on src

This patch fixes it and should be backported as far as 2.0.

src/cfgparse.c

index 3d72af9ad490abe14e66641c011f86a9978a7fac..91ca63d6a1b83ca6c89e23bdc6e9936bed9d489d 100644 (file)
@@ -2728,7 +2728,7 @@ int check_config_validity()
 
                        if (!target) {
                                ha_alert("Proxy '%s': unable to find stick-table '%s'.\n",
-                                        curproxy->id, mrule->table.name);
+                                        curproxy->id, mrule->table.name ? mrule->table.name : curproxy->id);
                                cfgerr++;
                        }
                        else if (!stktable_compatible_sample(mrule->expr,  target->type)) {
@@ -2766,7 +2766,7 @@ int check_config_validity()
 
                        if (!target) {
                                ha_alert("Proxy '%s': unable to find store table '%s'.\n",
-                                        curproxy->id, mrule->table.name);
+                                        curproxy->id, mrule->table.name ? mrule->table.name : curproxy->id);
                                cfgerr++;
                        }
                        else if (!stktable_compatible_sample(mrule->expr, target->type)) {