]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: move bgp routemap stuff out of frrlua.[ch]
authorQuentin Young <qlyoung@cumulusnetworks.com>
Sun, 11 Aug 2019 19:23:35 +0000 (19:23 +0000)
committerQuentin Young <qlyoung@nvidia.com>
Tue, 1 Dec 2020 23:37:14 +0000 (18:37 -0500)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
bgpd/bgp_routemap.c
lib/frrlua.c
lib/frrlua.h

index 5274c4fae0870d0727a5e864c8ca835729a75f05..247391adef8afa22e92bb0ec6c0c788a60b8bfaf 100644 (file)
@@ -338,6 +338,45 @@ static const struct route_map_rule_cmd route_match_peer_cmd = {
 };
 
 #if defined(HAVE_LUA)
+
+enum frrlua_rm_status {
+       /*
+        * Script function run failure.  This will translate into a
+        * deny
+        */
+       LUA_RM_FAILURE = 0,
+       /*
+        * No Match was found for the route map function
+        */
+       LUA_RM_NOMATCH,
+       /*
+        * Match was found but no changes were made to the
+        * incoming data.
+        */
+       LUA_RM_MATCH,
+       /*
+        * Match was found and data was modified, so
+        * figure out what changed
+        */
+       LUA_RM_MATCH_AND_CHANGE,
+};
+
+static enum frrlua_rm_status frrlua_run_rm_rule(lua_State *L, const char *rule)
+{
+       int status;
+
+       lua_getglobal(L, rule);
+       status = lua_pcall(L, 0, 1, 0);
+       if (status) {
+               zlog_debug("Executing Failure with function: %s: %d",
+                          rule, status);
+               return LUA_RM_FAILURE;
+       }
+
+       status = lua_tonumber(L, -1);
+       return status;
+}
+
 static enum route_map_cmd_result_t
 route_match_command(void *rule, const struct prefix *prefix, void *object)
 {
index 7dc87869012f224a8857b6753579a67f4097dbc2..252b66796110f802721e353a4db829cb5fce6825 100644 (file)
@@ -170,28 +170,4 @@ void frrlua_export_logging(lua_State *L)
        lua_setfield(L, -2, "log");
 }
 
-
-/*
- * Experimental.
- *
- * This section has experimental Lua functionality that doesn't belong
- * elsewhere.
- */
-
-enum frrlua_rm_status frrlua_run_rm_rule(lua_State *L, const char *rule)
-{
-       int status;
-
-       lua_getglobal(L, rule);
-       status = lua_pcall(L, 0, 1, 0);
-       if (status) {
-               zlog_debug("Executing Failure with function: %s: %d",
-                          rule, status);
-               return LUA_RM_FAILURE;
-       }
-
-       status = lua_tonumber(L, -1);
-       return status;
-}
-
 #endif
index 56c43b7755248896dc28c698fcfff3edc62d380b..f77842b445fca381bfc80777d961e5997e0caa91 100644 (file)
 extern "C" {
 #endif
 
-/*
- * Status enum for Lua routemap processing results
- */
-enum frrlua_rm_status {
-       /*
-        * Script function run failure.  This will translate into a
-        * deny
-        */
-       LUA_RM_FAILURE = 0,
-       /*
-        * No Match was found for the route map function
-        */
-       LUA_RM_NOMATCH,
-       /*
-        * Match was found but no changes were made to the
-        * incoming data.
-        */
-       LUA_RM_MATCH,
-       /*
-        * Match was found and data was modified, so
-        * figure out what changed
-        */
-       LUA_RM_MATCH_AND_CHANGE,
-};
-
 /*
  * Pushes a new table containing relevant fields from a prefix structure.
  *
@@ -68,11 +43,6 @@ void frrlua_newtable_prefix(lua_State *L, const struct prefix *prefix);
  */
 void frrlua_newtable_interface(lua_State *L, const struct interface *ifp);
 
-/*
- * Runs a routemap rule or something
- */
-enum frrlua_rm_status frrlua_run_rm_rule(lua_State *L, const char *rule);
-
 /*
  * Retrieve a string from table on the top of the stack.
  *