From 64957b279cf56216f7849c1c1999ed6b7fcdd2c1 Mon Sep 17 00:00:00 2001 From: rgirada Date: Mon, 4 Feb 2019 05:16:25 -0800 Subject: [PATCH] ospf6d: Added changes to track route-map usage MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Made changes and updated the routemap applied counter in the following flows. 1.Increment the routemap applied counter when route map attached to a redistribution list. The counter will be updated if the routemap exists. 2.Decrement when route map removed / modified from a redistribution  list. 3.Increment/decrement when route map create/delete callback triggered. Signed-off-by: RajeshGirada --- ospf6d/ospf6_asbr.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 671267aa05..3153c29aa1 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -856,16 +856,22 @@ void ospf6_asbr_lsentry_remove(struct ospf6_route *asbr_entry) static void ospf6_asbr_routemap_set(int type, const char *mapname) { - if (ospf6->rmap[type].name) + if (ospf6->rmap[type].name) { + route_map_counter_decrement(ospf6->rmap[type].map); free(ospf6->rmap[type].name); + } ospf6->rmap[type].name = strdup(mapname); ospf6->rmap[type].map = route_map_lookup_by_name(mapname); + route_map_counter_increment(ospf6->rmap[type].map); } static void ospf6_asbr_routemap_unset(int type) { if (ospf6->rmap[type].name) free(ospf6->rmap[type].name); + + route_map_counter_decrement(ospf6->rmap[type].map); + ospf6->rmap[type].name = NULL; ospf6->rmap[type].map = NULL; } @@ -939,6 +945,10 @@ static void ospf6_asbr_routemap_update(const char *mapname) "%s: route-map %s update, reset redist %s", __PRETTY_FUNCTION__, mapname, ZROUTE_NAME(type)); + + route_map_counter_increment( + ospf6->rmap[type].map); + ospf6_asbr_distribute_list_update(type); } } else -- 2.39.5