diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index d9457ea616..5274c4fae0 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -346,7 +346,8 @@ route_match_command(void *rule, const struct prefix *prefix, void *object) u_int32_t newlocpref = 0; enum frrlua_rm_status lrm_status; struct bgp_path_info *path = (struct bgp_path_info *)object; - lua_State *L = frrlua_initialize("/etc/frr/lua.scr"); + lua_State *L = luaL_newstate();; + luaL_openlibs(L); if (L == NULL) return status; diff --git a/lib/frrlua.c b/lib/frrlua.c index 4c38e08a07..7dc8786901 100644 --- a/lib/frrlua.c +++ b/lib/frrlua.c @@ -194,38 +194,4 @@ enum frrlua_rm_status frrlua_run_rm_rule(lua_State *L, const char *rule) return status; } -/* Initialization */ - -static void *frrlua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) -{ - (void)ud; - (void)osize; /* not used */ - - if (nsize == 0) { - free(ptr); - return NULL; - } else - return realloc(ptr, nsize); -} - -lua_State *frrlua_initialize(const char *file) -{ - int status; - lua_State *L = lua_newstate(frrlua_alloc, NULL); - - luaL_openlibs(L); - if (file) { - status = luaL_loadfile(L, file); - if (status) { - zlog_debug("Failure to open %s %d", file, status); - lua_close(L); - return NULL; - } - lua_pcall(L, 0, LUA_MULTRET, 0); - } - - return L; -} - - #endif diff --git a/lib/frrlua.h b/lib/frrlua.h index d6ee2347a9..56c43b7755 100644 --- a/lib/frrlua.h +++ b/lib/frrlua.h @@ -56,15 +56,6 @@ enum frrlua_rm_status { LUA_RM_MATCH_AND_CHANGE, }; -/* - * Creates a new Lua state, loads all libraries, and if a script is provided, - * runs it. - * - * Returns: - * The new Lua state. - */ -lua_State *frrlua_initialize(const char *file); - /* * Pushes a new table containing relevant fields from a prefix structure. *