summaryrefslogtreecommitdiff
path: root/ospfd/ospf_routemap.c
diff options
context:
space:
mode:
authorrgirada <rgirada@vmware.com>2019-02-04 05:22:39 -0800
committerrgirada <rgirada@vmware.com>2019-02-04 05:22:39 -0800
commit93d836e6fe498918c0a65217b6e868c47e419c09 (patch)
tree4582144c827400c874598b4d9fe4737e974d5257 /ospfd/ospf_routemap.c
parent54e80c7656779081bfb2dda62c157a6db87112b4 (diff)
ospfd: 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 <rgirada@vmware.com>
Diffstat (limited to 'ospfd/ospf_routemap.c')
-rw-r--r--ospfd/ospf_routemap.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c
index 54009639fc..a15e605aca 100644
--- a/ospfd/ospf_routemap.c
+++ b/ospfd/ospf_routemap.c
@@ -70,11 +70,19 @@ static void ospf_route_map_update(const char *name)
/* Keep old route-map. */
struct route_map *old = ROUTEMAP(red);
- /* Update route-map. */
- ROUTEMAP(red) =
- route_map_lookup_by_name(
- ROUTEMAP_NAME(red));
-
+ if (!old) {
+ /* Route-map creation */
+ /* Update route-map. */
+ ROUTEMAP(red) =
+ route_map_lookup_by_name(
+ ROUTEMAP_NAME(red));
+
+ route_map_counter_increment(
+ ROUTEMAP(red));
+ } else {
+ /* Route-map deletion */
+ ROUTEMAP(red) = NULL;
+ }
/* No update for this distribute type.
*/
if (old == NULL