diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-05-11 02:55:50 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@nvidia.com> | 2020-12-02 00:37:14 +0100 |
commit | 6021965926654eb96c22391725ae0133ea77e784 (patch) | |
tree | dc01fbcb9e98656a02f5143fdd342ab98ac9fd0e /bgpd | |
parent | Merge pull request #7601 from patrasar/pim_fix (diff) | |
download | frr-6021965926654eb96c22391725ae0133ea77e784.tar.xz frr-6021965926654eb96c22391725ae0133ea77e784.zip |
lib: clean up frrlua.[ch]
* Use frrlua_* prefix to differentiate from Lua builtins
* Allow frrlua_initialize to pass an empty script
* Fixup naming of table accessors
* Fixup naming of prefix -> table encoder
* Fixup BGP routemap code to new function names
* Fix includes for frrlua.h
* Clean up doc comments
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_routemap.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 637eaca39..d9457ea61 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -344,9 +344,9 @@ route_match_command(void *rule, const struct prefix *prefix, void *object) int status = RMAP_NOMATCH; u_int32_t locpref = 0; u_int32_t newlocpref = 0; - enum lua_rm_status lrm_status; + enum frrlua_rm_status lrm_status; struct bgp_path_info *path = (struct bgp_path_info *)object; - lua_State *L = lua_initialize("/etc/frr/lua.scr"); + lua_State *L = frrlua_initialize("/etc/frr/lua.scr"); if (L == NULL) return status; @@ -354,9 +354,7 @@ route_match_command(void *rule, const struct prefix *prefix, void *object) /* * Setup the prefix information to pass in */ - lua_setup_prefix_table(L, prefix); - - zlog_debug("Set up prefix table"); + frrlua_newtable_prefix(L, prefix); /* * Setup the bgp_path_info information */ @@ -376,7 +374,7 @@ route_match_command(void *rule, const struct prefix *prefix, void *object) /* * Run the rule */ - lrm_status = lua_run_rm_rule(L, rule); + lrm_status = frrlua_run_rm_rule(L, rule); switch (lrm_status) { case LUA_RM_FAILURE: zlog_debug("RM_FAILURE"); @@ -387,13 +385,13 @@ route_match_command(void *rule, const struct prefix *prefix, void *object) case LUA_RM_MATCH_AND_CHANGE: zlog_debug("MATCH AND CHANGE"); lua_getglobal(L, "nexthop"); - path->attr->med = get_integer(L, "metric"); + path->attr->med = frrlua_table_get_integer(L, "metric"); /* * This needs to be abstraced with the set function */ if (path->attr->flag & ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)) locpref = path->attr->local_pref; - newlocpref = get_integer(L, "localpref"); + newlocpref = frrlua_table_get_integer(L, "localpref"); if (newlocpref != locpref) { path->attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF); path->attr->local_pref = newlocpref; |