summaryrefslogtreecommitdiff
path: root/bgpd/bgp_script.c
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2022-03-30 07:53:03 -0400
committerGitHub <noreply@github.com>2022-03-30 07:53:03 -0400
commiteda1d29a06581860f4b78d5a49b27922d38d86e4 (patch)
tree5112530bfa161ac0aea4be0713592ad78e7e694c /bgpd/bgp_script.c
parent2f7f0f77c5982a72fe535fe3906f3e6caa692669 (diff)
parent9aa2174c3990169e46b23b6e07cd87c145e364ed (diff)
Merge pull request #10918 from opensourcerouting/fix/bgpd_crash
bgpd: Fix Lua route-map crash
Diffstat (limited to 'bgpd/bgp_script.c')
-rw-r--r--bgpd/bgp_script.c9
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)