Merge pull request #2499 from donaldsharp/routemap_kisses

Some route-map prep
This commit is contained in:
Russ White 2018-06-20 07:19:31 -04:00 committed by GitHub
commit c92a99c30d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 31 deletions

View File

@ -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 listnode *node, *nnode;
struct bgp *bgp; struct bgp *bgp;
@ -3127,8 +3127,6 @@ static int bgp_route_map_process_update_cb(char *rmap_name)
} }
vpn_policy_routemap_event(rmap_name); vpn_policy_routemap_event(rmap_name);
return 0;
} }
int bgp_route_map_update_timer(struct thread *thread) 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) 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); bgp_route_map_mark_update(rmap_name);
route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED); 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) 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); bgp_route_map_mark_update(rmap_name);
route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_DELETED); 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) 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); bgp_route_map_mark_update(rmap_name);
route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED); route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED);

View File

@ -751,7 +751,7 @@ struct route_map *route_map_lookup_by_name(const char *name)
return map; 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; struct route_map *map;
int ret = -1; int ret = -1;
@ -781,7 +781,7 @@ int route_map_mark_updated(const char *name, int del_later)
return (ret); return (ret);
} }
int route_map_clear_updated(struct route_map *map) static int route_map_clear_updated(struct route_map *map)
{ {
int ret = -1; int ret = -1;
@ -807,7 +807,7 @@ static struct route_map *route_map_get(const char *name)
return map; 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 *node;
struct route_map *nnode = NULL; struct route_map *nnode = NULL;

View File

@ -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_add_hook(void (*func)(const char *));
extern void route_map_delete_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 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_mark_updated(const char *name);
extern int route_map_clear_updated(struct route_map *rmap); extern void route_map_walk_update_list(void (*update_fn)(char *name));
extern void route_map_walk_update_list(int (*update_fn)(char *name));
extern void route_map_upd8_dependency(route_map_event_t type, const char *arg, extern void route_map_upd8_dependency(route_map_event_t type, const char *arg,
const char *rmap_name); const char *rmap_name);
extern void route_map_notify_dependencies(const char *affected_name, extern void route_map_notify_dependencies(const char *affected_name,

View File

@ -26,34 +26,18 @@
#include "pimd.h" #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) 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); route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED);
} }
static void pim_route_map_delete(const char *rmap_name) 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); 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) 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); route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED);
} }

View File

@ -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, "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) static int zebra_route_map_update_timer(struct thread *thread)
{ {
zebra_t_rmap_update = NULL; 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", "%u: Routemap update-timer fired, scheduling RIB processing",
VRF_DEFAULT); VRF_DEFAULT);
route_map_walk_update_list(zebra_route_map_process_update_cb);
/*
* This code needs to be updated to be:
* 1) VRF Aware <sigh>
* 2) Route-map aware
*/
zebra_import_table_rm_update(); zebra_import_table_rm_update();
rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE); rib_update(VRF_DEFAULT, RIB_UPDATE_RMAP_CHANGE);
zebra_evaluate_rnh(0, AF_INET, 1, RNH_NEXTHOP_TYPE, NULL); 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) 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); route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED);
} }
static void zebra_route_map_delete(const char *rmap_name) 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); route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_DELETED);
} }
static void zebra_route_map_event(route_map_event_t event, static void zebra_route_map_event(route_map_event_t event,
const char *rmap_name) 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); route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED);
} }