From: rgirada Date: Mon, 4 Feb 2019 13:16:25 +0000 (-0800) Subject: ospf6d: Added changes to track route-map usage X-Git-Tag: 7.1_pulled~273^2~3 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=64957b279cf56216f7849c1c1999ed6b7fcdd2c1;p=matthieu%2Ffrr.git ospf6d: Added changes to track route-map usage 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 --- 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