mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-29 23:01:03 +01:00
BUG/MEDIUM: lua: Fix dumping of stick table entries for STD_T_DICT
The issue can easily be reproduced with "stick on" statement
backend BE_NAME
stick-table type ip size 1k
stick on src
and calling dump() method on BE_NAME stick table from Lua
Before the fix, HAProxy would return 500 and log something like
the following:
runtime error: attempt to index a string value from [C] method 'dump'
Where one would expect a Lua table like this:
{
["IP_ADDR"] = {
["server_id"] = 1,
["server_name"] = "srv1"
}
}
This patch needs to backported to 1.9 and later releases.
This commit is contained in:
parent
083eff3734
commit
ad9f9ed3f4
@ -588,6 +588,12 @@ static void hlua_stktable_entry(lua_State *L, struct stktable *t, struct stksess
|
|||||||
lua_pushinteger(L, read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
|
lua_pushinteger(L, read_freq_ctr_period(&stktable_data_cast(ptr, std_t_frqp),
|
||||||
t->data_arg[dt].u));
|
t->data_arg[dt].u));
|
||||||
break;
|
break;
|
||||||
|
case STD_T_DICT: {
|
||||||
|
struct dict_entry *de;
|
||||||
|
de = stktable_data_cast(ptr, std_t_dict);
|
||||||
|
lua_pushstring(L, de ? (char *)de->value.key : "-");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_settable(L, -3);
|
lua_settable(L, -3);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user