On 6/20/19 12:59 AM, William Dauchy wrote:
Hello,

Hello William,

We are using "rate limiting" config such as the one mentioned below:

backend foo
     stick-table type ip size 200k expire 30s store conn_rate(60s)
     tcp-request content track-sc1 src
     http-request deny deny_status 429 if { src_conn_rate ge 42000 }

While giving a try to v2.0 we are getting "missing table name in arg 1 of
ACL keyword 'src_conn_rate' in"
Did I missed something in the breaking changes of 2.0?

No.

In fact it seems I have broken something and missed this case.
Here is a patch which should fix this issue.

Fred.
>From 1575a4bcdb52bbb8604521b6673557c178431deb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= <[email protected]>
Date: Thu, 20 Jun 2019 09:31:04 +0200
Subject: [PATCH] BUG/MAJOR: sample: Wrong stick-table name parsing in
 "if/unless" ACL condition.

This bug was introduced by 1b8e68e commit which supposed the stick-table was always
stored in struct arg at parsing time. This is never the case with the usage of
"if/unless" conditions in stick-table declared as backends. In this case, this is
the name of the proxy which must be considered as the stick-table name.
---
 src/sample.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/sample.c b/src/sample.c
index 96102504b..94c605f92 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -1245,15 +1245,11 @@ int smp_resolve_args(struct proxy *p)
 			break;
 
 		case ARGT_TAB:
-			if (!arg->data.str.data) {
-				ha_alert("parsing [%s:%d] : missing table name in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
-					 cur->file, cur->line,
-					 cur->arg_pos + 1, conv_pre, conv_ctx, conv_pos, ctx, cur->kw, where, p->id);
-				cfgerr++;
-				continue;
-			}
+			if (arg->data.str.data)
+				stktname = arg->data.str.area;
+			else
+				stktname = px->id;
 
-			stktname = arg->data.str.area;
 			t = stktable_find_by_name(stktname);
 			if (!t) {
 				ha_alert("parsing [%s:%d] : unable to find table '%s' referenced in arg %d of %s%s%s%s '%s' %s proxy '%s'.\n",
-- 
2.11.0

Reply via email to