]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: update script encoder signatures
authorQuentin Young <qlyoung@nvidia.com>
Sun, 29 Nov 2020 06:50:03 +0000 (01:50 -0500)
committerQuentin Young <qlyoung@nvidia.com>
Tue, 1 Dec 2020 23:37:14 +0000 (18:37 -0500)
Update the two test functions that encode a prefix and an interface to
match the encoder_func signature expected by the scripting infra.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
lib/frrlua.c
lib/frrlua.h

index 57288e66760de3b4a568e1ae086a95416da29c41..4d576829c5619bdfca4efb9f09ea1d6ca7fb14ba 100644 (file)
@@ -70,7 +70,7 @@ int frrlua_table_get_integer(lua_State *L, const char *key)
  * datatypes.
  */
 
-void frrlua_newtable_prefix(lua_State *L, const struct prefix *prefix)
+int frrlua_newtable_prefix(lua_State *L, const struct prefix *prefix)
 {
        char buffer[100];
 
@@ -81,10 +81,11 @@ void frrlua_newtable_prefix(lua_State *L, const struct prefix *prefix)
        lua_setfield(L, -2, "route");
        lua_pushinteger(L, prefix->family);
        lua_setfield(L, -2, "family");
-       lua_setglobal(L, "prefix");
+
+       return 0;
 }
 
-void frrlua_newtable_interface(lua_State *L, const struct interface *ifp)
+int frrlua_newtable_interface(lua_State *L, const struct interface *ifp)
 {
        zlog_debug("frrlua: pushing interface table");
 
@@ -111,6 +112,8 @@ void frrlua_newtable_interface(lua_State *L, const struct interface *ifp)
        lua_setfield(L, -2, "link_ifindex");
        lua_pushinteger(L, ifp->ll_type);
        lua_setfield(L, -2, "linklayer_type");
+
+       return 0;
 }
 
 /*
@@ -171,7 +174,7 @@ void frrlua_export_logging(lua_State *L)
 {
        lua_newtable(L);
        luaL_setfuncs(L, log_funcs, 0);
-       lua_setfield(L, -2, "log");
+       lua_setglobal(L, "log");
 }
 
 /*
index 37e8e8635b25920930b6c8cdc53f49be787d3a0d..029e6ecee84d26b07c116fa6c4f55b48f1315d91 100644 (file)
@@ -37,12 +37,12 @@ extern "C" {
  *
  * Additionally sets the global variable "prefix" to point at this table.
  */
-void frrlua_newtable_prefix(lua_State *L, const struct prefix *prefix);
+int frrlua_newtable_prefix(lua_State *L, const struct prefix *prefix);
 
 /*
  * Pushes a new table containing relevant fields from an interface structure.
  */
-void frrlua_newtable_interface(lua_State *L, const struct interface *ifp);
+int frrlua_newtable_interface(lua_State *L, const struct interface *ifp);
 
 /*
  * Retrieve a string from table on the top of the stack.