ddf9d1697592b8057168b25279f7087115b7ed72
[openwrt-packages.git] /
1 commit 1781e3834bb4a0b74d88d467bddc11e8fb811f17
2 Author: Christopher Faulet <cfaulet@haproxy.com>
3 Date:   Wed Dec 18 10:25:46 2019 +0100
4
5     BUG/MINOR: stick-table: Use MAX_SESS_STKCTR as the max track ID during parsing
6     
7     During the parsing of the sc-inc-gpc0, sc-inc-gpc1 and sc-inc-gpt1 actions, the
8     maximum stick table track ID allowed is tested against ACT_ACTION_TRK_SCMAX. It
9     is the action number and not the maximum number of stick counters. Instead,
10     MAX_SESS_STKCTR must be used.
11     
12     This patch must be backported to all stable versions.
13     
14     (cherry picked from commit 28436e23d313d5986ddb97c9b4a5a0e5e78b2a42)
15     Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
16
17 diff --git a/src/stick_table.c b/src/stick_table.c
18 index 1b70b468e..7b648475b 100644
19 --- a/src/stick_table.c
20 +++ b/src/stick_table.c
21 @@ -1916,9 +1916,9 @@ static enum act_parse_ret parse_inc_gpc0(const char **args, int *arg, struct pro
22                         return ACT_RET_PRS_ERR;
23                 }
24  
25 -               if (rule->arg.gpc.sc >= ACT_ACTION_TRK_SCMAX) {
26 +               if (rule->arg.gpc.sc >= MAX_SESS_STKCTR) {
27                         memprintf(err, "invalid stick table track ID. The max allowed ID is %d",
28 -                                 ACT_ACTION_TRK_SCMAX-1);
29 +                                 MAX_SESS_STKCTR-1);
30                         return ACT_RET_PRS_ERR;
31                 }
32         }
33 @@ -1998,9 +1998,9 @@ static enum act_parse_ret parse_inc_gpc1(const char **args, int *arg, struct pro
34                         return ACT_RET_PRS_ERR;
35                 }
36  
37 -               if (rule->arg.gpc.sc >= ACT_ACTION_TRK_SCMAX) {
38 +               if (rule->arg.gpc.sc >= MAX_SESS_STKCTR) {
39                         memprintf(err, "invalid stick table track ID. The max allowed ID is %d",
40 -                                 ACT_ACTION_TRK_SCMAX-1);
41 +                                 MAX_SESS_STKCTR-1);
42                         return ACT_RET_PRS_ERR;
43                 }
44         }
45 @@ -2107,9 +2107,9 @@ static enum act_parse_ret parse_set_gpt0(const char **args, int *arg, struct pro
46                         return ACT_RET_PRS_ERR;
47                 }
48  
49 -               if (rule->arg.gpt.sc >= ACT_ACTION_TRK_SCMAX) {
50 +               if (rule->arg.gpt.sc >= MAX_SESS_STKCTR) {
51                         memprintf(err, "invalid stick table track ID '%s'. The max allowed ID is %d",
52 -                                 args[*arg-1], ACT_ACTION_TRK_SCMAX-1);
53 +                                 args[*arg-1], MAX_SESS_STKCTR-1);
54                         return ACT_RET_PRS_ERR;
55                 }
56         }
git clone https://git.99rst.org/PROJECT