diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-03-29 17:47:28 +0300 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-03-29 17:47:28 +0300 |
| commit | 9aa2174c3990169e46b23b6e07cd87c145e364ed (patch) | |
| tree | 0da113a6e29d02af63b09fcdded5e2a8f1be4cfc /bgpd/bgp_script.c | |
| parent | 93b2d38aedcf6d42e63d50b353927134a832e57a (diff) | |
bgpd: Make sure we pop the table from the stack when decoding struct attr
```
bgpd[81718]: bgpd/bgp_routemap.c:382: route_match_script(): assertion (lua_gettop(lfs->L) == 1) failed
BGP[81718]: Received signal 6 at 1648554165 (si_addr 0x6e00013f36, PC 0x7fcc5adebce1); aborting...
BGP[81718]: /usr/local/lib/libfrr.so.0(zlog_backtrace_sigsafe+0x5e) [0x7fcc5b1caf5e]
BGP[81718]: /usr/local/lib/libfrr.so.0(zlog_signal+0xe6) [0x7fcc5b1cb136]
BGP[81718]: /usr/local/lib/libfrr.so.0(+0xcd4b2) [0x7fcc5b1f54b2]
BGP[81718]: /lib/x86_64-linux-gnu/libpthread.so.0(+0x14140) [0x7fcc5af89140]
BGP[81718]: /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x141) [0x7fcc5adebce1]
BGP[81718]: /lib/x86_64-linux-gnu/libc.so.6(abort+0x123) [0x7fcc5add5537]
BGP[81718]: /usr/local/lib/libfrr.so.0(_zlog_assert_failed+0xd7) [0x7fcc5b21ecd7]
BGP[81718]: /usr/lib/frr/bgpd(+0x162710) [0x55ed70255710]
BGP[81718]: /usr/local/lib/libfrr.so.0(+0xc0e47) [0x7fcc5b1e8e47]
BGP[81718]: /usr/local/lib/libfrr.so.0(route_map_apply_ext+0x4b6) [0x7fcc5b1eaaf6]
BGP[81718]: /usr/lib/frr/bgpd(+0x13eb24) [0x55ed70231b24]
BGP[81718]: /usr/lib/frr/bgpd(bgp_update+0x7db) [0x55ed7023f81b]
BGP[81718]: /usr/lib/frr/bgpd(bgp_nlri_parse_ip+0x113) [0x55ed70241bc3]
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_script.c')
| -rw-r--r-- | bgpd/bgp_script.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/bgpd/bgp_script.c b/bgpd/bgp_script.c index 9446a25a05..bf3e612bfd 100644 --- a/bgpd/bgp_script.c +++ b/bgpd/bgp_script.c @@ -156,18 +156,19 @@ void lua_pushattr(lua_State *L, const struct attr *attr) void lua_decode_attr(lua_State *L, int idx, struct attr *attr) { - lua_getfield(L, -1, "metric"); + lua_getfield(L, idx, "metric"); attr->med = lua_tointeger(L, -1); lua_pop(L, 1); - lua_getfield(L, -1, "ifindex"); + lua_getfield(L, idx, "ifindex"); attr->nh_ifindex = lua_tointeger(L, -1); lua_pop(L, 1); - lua_getfield(L, -1, "aspath"); + lua_getfield(L, idx, "aspath"); attr->aspath = aspath_str2aspath(lua_tostring(L, -1)); lua_pop(L, 1); - lua_getfield(L, -1, "localpref"); + lua_getfield(L, idx, "localpref"); attr->local_pref = lua_tointeger(L, -1); lua_pop(L, 1); + lua_pop(L, 1); } void *lua_toattr(lua_State *L, int idx) |
