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;
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
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.
*