From d6b5245f9db8ef2616c0655dfb3f7becdf612eb3 Mon Sep 17 00:00:00 2001 From: Valentine Krasnobaeva Date: Thu, 7 Aug 2025 11:54:58 +0200 Subject: [PATCH] BUG/MINOR: stick-table: cap sticky counter idx with tune.nb_stk_ctr instead of MAX_SESS_STKCTR Cap sticky counter index with tune.nb_stk_ctr instead of MAX_SESS_STKCTR for sc-add-gpc. Same logic is already implemented for sc-inc-gpc and sc-set-gpt keywords. So, it seems missed for sc-add-gpc. This fixes the issue #3061 reported at GitHub. Thanks to @ma311 for reporting their analysis of the issue. This should be backported in all versions until 2.8, included 2.8. (cherry picked from commit 21d5f43aa6e9513d11dff2d80a2a332d92c0a857) Signed-off-by: Amaury Denoyelle (cherry picked from commit 4b71a4c528876a37fee996ac1326b03622c90bc7) Signed-off-by: Christopher Faulet (cherry picked from commit 6ff65b14cc06550b10560d3bf6fc8d7eee9a4868) Signed-off-by: Christopher Faulet --- src/stick_table.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stick_table.c b/src/stick_table.c index 282df4e..81b71f4 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -3503,9 +3503,9 @@ static enum act_parse_ret parse_add_gpc(const char **args, int *arg, struct prox return ACT_RET_PRS_ERR; } - if (rule->arg.gpc.sc >= MAX_SESS_STKCTR) { - memprintf(err, "invalid stick table track ID '%s' for '%s'. The max allowed ID is %d", - cmd_name, args[*arg-1], MAX_SESS_STKCTR-1); + if (rule->arg.gpc.sc >= global.tune.nb_stk_ctr) { + memprintf(err, "invalid stick table track ID '%s'. The max allowed ID is %d (tune.stick-counters)", + args[*arg-1], global.tune.nb_stk_ctr - 1); return ACT_RET_PRS_ERR; } } -- 1.7.10.4