]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stick-table: cap sticky counter idx with tune.nb_stk_ctr instead of MAX_SE...
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Thu, 7 Aug 2025 09:54:58 +0000 (11:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 8 Aug 2025 03:26:30 +0000 (05:26 +0200)
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.

src/stick_table.c

index a1900f66f2a5231affdd20604ae7b8582a0e2570..cac2de202e47121718e2a1358d4d3a71f8166983 100644 (file)
@@ -3157,9 +3157,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;
                }
        }