aboutsummaryrefslogtreecommitdiff
path: root/net/haproxy/patches/047-BUG-MINOR-stktable-report-the-current-proxy-name-in-error-messages.patch
blob: d0efb4380b37572ef4fe39a05085e46dbff474b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
commit e66ed8abc963ec689e2ba672e1be90249ab2612c
Author: Willy Tarreau <w@1wt.eu>
Date:   Fri Jan 24 07:19:34 2020 +0100

    BUG/MINOR: stktable: report the current proxy name in error messages
    
    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.
    
    (cherry picked from commit 508d232a06cf082ff2cc694d3f1c03b10a07e719)
    Signed-off-by: Willy Tarreau <w@1wt.eu>

diff --git a/src/cfgparse.c b/src/cfgparse.c
index 2e200e885..7f884df7c 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -2722,7 +2722,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)) {
@@ -2760,7 +2760,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)) {