mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-13 17:49:56 +00:00
Merge pull request #10918 from opensourcerouting/fix/bgpd_crash
bgpd: Fix Lua route-map crash
This commit is contained in:
commit
eda1d29a06
@ -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)
|
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);
|
attr->med = lua_tointeger(L, -1);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
lua_getfield(L, -1, "ifindex");
|
lua_getfield(L, idx, "ifindex");
|
||||||
attr->nh_ifindex = lua_tointeger(L, -1);
|
attr->nh_ifindex = lua_tointeger(L, -1);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
lua_getfield(L, -1, "aspath");
|
lua_getfield(L, idx, "aspath");
|
||||||
attr->aspath = aspath_str2aspath(lua_tostring(L, -1));
|
attr->aspath = aspath_str2aspath(lua_tostring(L, -1));
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
lua_getfield(L, -1, "localpref");
|
lua_getfield(L, idx, "localpref");
|
||||||
attr->local_pref = lua_tointeger(L, -1);
|
attr->local_pref = lua_tointeger(L, -1);
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *lua_toattr(lua_State *L, int idx)
|
void *lua_toattr(lua_State *L, int idx)
|
||||||
|
@ -373,7 +373,7 @@ int frrscript_load(struct frrscript *fs, const char *function_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (luaL_dofile(L, script_name) != 0) {
|
if (luaL_dofile(L, script_name) != 0) {
|
||||||
zlog_err("frrscript: failed loading script '%s.lua': error: %s",
|
zlog_err("frrscript: failed loading script '%s': error: %s",
|
||||||
script_name, lua_tostring(L, -1));
|
script_name, lua_tostring(L, -1));
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -381,7 +381,7 @@ int frrscript_load(struct frrscript *fs, const char *function_name,
|
|||||||
/* To check the Lua function, we get it from the global table */
|
/* To check the Lua function, we get it from the global table */
|
||||||
lua_getglobal(L, function_name);
|
lua_getglobal(L, function_name);
|
||||||
if (lua_isfunction(L, lua_gettop(L)) == 0) {
|
if (lua_isfunction(L, lua_gettop(L)) == 0) {
|
||||||
zlog_err("frrscript: loaded script '%s.lua' but %s not found",
|
zlog_err("frrscript: loaded script '%s' but %s not found",
|
||||||
script_name, function_name);
|
script_name, function_name);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -391,7 +391,7 @@ int frrscript_load(struct frrscript *fs, const char *function_name,
|
|||||||
|
|
||||||
if (load_cb && (*load_cb)(fs) != 0) {
|
if (load_cb && (*load_cb)(fs) != 0) {
|
||||||
zlog_err(
|
zlog_err(
|
||||||
"frrscript: '%s.lua': %s: loaded but callback returned non-zero exit code",
|
"frrscript: '%s': %s: loaded but callback returned non-zero exit code",
|
||||||
script_name, function_name);
|
script_name, function_name);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user