diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index cbacd6b4f2..9f3bec81d3 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -3112,7 +3112,7 @@ static void bgp_route_map_process_update(struct bgp *bgp, const char *rmap_name, } } -static int bgp_route_map_process_update_cb(char *rmap_name) +static void bgp_route_map_process_update_cb(char *rmap_name) { struct listnode *node, *nnode; struct bgp *bgp; @@ -3127,8 +3127,6 @@ static int bgp_route_map_process_update_cb(char *rmap_name) } vpn_policy_routemap_event(rmap_name); - - return 0; } int bgp_route_map_update_timer(struct thread *thread) @@ -3172,7 +3170,7 @@ static void bgp_route_map_mark_update(const char *rmap_name) static void bgp_route_map_add(const char *rmap_name) { - if (route_map_mark_updated(rmap_name, 0) == 0) + if (route_map_mark_updated(rmap_name) == 0) bgp_route_map_mark_update(rmap_name); route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED); @@ -3180,7 +3178,7 @@ static void bgp_route_map_add(const char *rmap_name) static void bgp_route_map_delete(const char *rmap_name) { - if (route_map_mark_updated(rmap_name, 1) == 0) + if (route_map_mark_updated(rmap_name) == 0) bgp_route_map_mark_update(rmap_name); route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_DELETED); @@ -3188,7 +3186,7 @@ static void bgp_route_map_delete(const char *rmap_name) static void bgp_route_map_event(route_map_event_t event, const char *rmap_name) { - if (route_map_mark_updated(rmap_name, 0) == 0) + if (route_map_mark_updated(rmap_name) == 0) bgp_route_map_mark_update(rmap_name); route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED); diff --git a/lib/routemap.c b/lib/routemap.c index 892b19dac5..056c793454 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -751,7 +751,7 @@ struct route_map *route_map_lookup_by_name(const char *name) return map; } -int route_map_mark_updated(const char *name, int del_later) +int route_map_mark_updated(const char *name) { struct route_map *map; int ret = -1; @@ -781,7 +781,7 @@ int route_map_mark_updated(const char *name, int del_later) return (ret); } -int route_map_clear_updated(struct route_map *map) +static int route_map_clear_updated(struct route_map *map) { int ret = -1; @@ -807,7 +807,7 @@ static struct route_map *route_map_get(const char *name) return map; } -void route_map_walk_update_list(int (*route_map_update_fn)(char *name)) +void route_map_walk_update_list(void (*route_map_update_fn)(char *name)) { struct route_map *node; struct route_map *nnode = NULL; diff --git a/lib/routemap.h b/lib/routemap.h index 990c7fa72f..0aeba7e1f6 100644 --- a/lib/routemap.h +++ b/lib/routemap.h @@ -215,9 +215,8 @@ extern route_map_result_t route_map_apply(struct route_map *map, extern void route_map_add_hook(void (*func)(const char *)); extern void route_map_delete_hook(void (*func)(const char *)); extern void route_map_event_hook(void (*func)(route_map_event_t, const char *)); -extern int route_map_mark_updated(const char *name, int deleted); -extern int route_map_clear_updated(struct route_map *rmap); -extern void route_map_walk_update_list(int (*update_fn)(char *name)); +extern int route_map_mark_updated(const char *name); +extern void route_map_walk_update_list(void (*update_fn)(char *name)); extern void route_map_upd8_dependency(route_map_event_t type, const char *arg, const char *rmap_name); extern void route_map_notify_dependencies(const char *affected_name, diff --git a/pimd/pim_routemap.c b/pimd/pim_routemap.c index 6d06229b98..b41124376f 100644 --- a/pimd/pim_routemap.c +++ b/pimd/pim_routemap.c @@ -26,34 +26,18 @@ #include "pimd.h" - -static void pim_route_map_mark_update(const char *rmap_name) -{ - // placeholder - return; -} - static void pim_route_map_add(const char *rmap_name) { - if (route_map_mark_updated(rmap_name, 0) == 0) - pim_route_map_mark_update(rmap_name); - route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED); } static void pim_route_map_delete(const char *rmap_name) { - if (route_map_mark_updated(rmap_name, 1) == 0) - pim_route_map_mark_update(rmap_name); - route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_DELETED); } static void pim_route_map_event(route_map_event_t event, const char *rmap_name) { - if (route_map_mark_updated(rmap_name, 0) == 0) - pim_route_map_mark_update(rmap_name); - route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED); } diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 10ba88880a..6d3c2b2265 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -1282,6 +1282,13 @@ static struct route_map_rule_cmd route_set_src_cmd = { "src", route_set_src, route_set_src_compile, route_set_src_free, }; +static void zebra_route_map_process_update_cb(char *rmap_name) +{ + if (IS_ZEBRA_DEBUG_EVENT) + zlog_debug("Event handler for route-map: %s", + rmap_name); +} + static int zebra_route_map_update_timer(struct thread *thread) { zebra_t_rmap_update = NULL; @@ -1294,6 +1301,13 @@ static int zebra_route_map_update_timer(struct thread *thread) "%u: Routemap update-timer fired, scheduling RIB processing", VRF_DEFAULT); + route_map_walk_update_list(zebra_route_map_process_update_cb); + + /* + * This code needs to be updated to be: + * 1) VRF Aware + * 2) Route-map aware + */ zebra_import_table_rm_update(); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); zebra_evaluate_rnh(0, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL); @@ -1433,20 +1447,26 @@ static void zebra_route_map_mark_update(const char *rmap_name) static void zebra_route_map_add(const char *rmap_name) { - zebra_route_map_mark_update(rmap_name); + if (route_map_mark_updated(rmap_name) == 0) + zebra_route_map_mark_update(rmap_name); + route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED); } static void zebra_route_map_delete(const char *rmap_name) { - zebra_route_map_mark_update(rmap_name); + if (route_map_mark_updated(rmap_name) == 0) + zebra_route_map_mark_update(rmap_name); + route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_DELETED); } static void zebra_route_map_event(route_map_event_t event, const char *rmap_name) { - zebra_route_map_mark_update(rmap_name); + if (route_map_mark_updated(rmap_name) == 0) + zebra_route_map_mark_update(rmap_name); + route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED); }