]> git.99rst.org Git - openwrt-packages.git/blob
ea755453a9e8dbe18e46784d0cfee00e590034c3
[openwrt-packages.git] /
1 commit be17bb8fc37db4e12ea24c9480ff6442017ff656
2 Author: Christopher Faulet <cfaulet@haproxy.com>
3 Date: Fri Sep 13 15:15:56 2019 +0200
4
5 BUG/MEDIUM: stick-table: Properly handle "show table" with a data type argument
6
7 Since the commit 1b8e68e8 ("MEDIUM: stick-table: Stop handling stick-tables as
8 proxies."), the target field into the table context of the CLI applet was not
9 anymore a pointer to a proxy. It was replaced by a pointer to a stktable. But,
10 some parts of the code was not updated accordingly. the function
11 table_prepare_data_request() still tries to cast it to a pointer to a proxy. The
12 result is totally undefined. With a bit of luck, when the "show table" command
13 is used with a data type, we failed to find a table and the error "Data type not
14 stored in this table" is returned. But crashes may also be experienced.
15
16 This patch fixes the issue #262. It must be backported to 2.0.
17
18 (cherry picked from commit 4e9a83349a9b523830f79f9632ef777ab0bfcc9d)
19 Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
20
21 diff --git a/src/stick_table.c b/src/stick_table.c
22 index 4b04f18c..8528baa0 100644
23 --- a/src/stick_table.c
24 +++ b/src/stick_table.c
25 @@ -3601,8 +3601,7 @@ static int table_prepare_data_request(struct appctx *appctx, char **args)
26 return 1;
27 }
28
29 - if (!((struct proxy *)appctx->ctx.table.target)->table ||
30 - !((struct proxy *)appctx->ctx.table.target)->table->data_ofs[appctx->ctx.table.data_type]) {
31 + if (!((struct stktable *)appctx->ctx.table.target)->data_ofs[appctx->ctx.table.data_type]) {
32 appctx->ctx.cli.severity = LOG_ERR;
33 appctx->ctx.cli.msg = "Data type not stored in this table\n";
34 appctx->st0 = CLI_ST_PRINT;
git clone https://git.99rst.org/PROJECT