diff options
author | rgirada <rgirada@vmware.com> | 2019-02-04 14:22:39 +0100 |
---|---|---|
committer | rgirada <rgirada@vmware.com> | 2019-02-04 14:22:39 +0100 |
commit | 93d836e6fe498918c0a65217b6e868c47e419c09 (patch) | |
tree | 4582144c827400c874598b4d9fe4737e974d5257 /ospfd | |
parent | zebrad: Added changes to track route-map usage (diff) | |
download | frr-93d836e6fe498918c0a65217b6e868c47e419c09.tar.xz frr-93d836e6fe498918c0a65217b6e868c47e419c09.zip |
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')
-rw-r--r-- | ospfd/ospf_routemap.c | 18 | ||||
-rw-r--r-- | ospfd/ospf_zebra.c | 9 |
2 files changed, 20 insertions, 7 deletions
diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index 54009639f..a15e605ac 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 diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index a86800f90..ea2c492e1 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -983,17 +983,22 @@ int ospf_redistribute_check(struct ospf *ospf, struct external_info *ei, /* OSPF route-map set for redistribution */ void ospf_routemap_set(struct ospf_redist *red, const char *name) { - if (ROUTEMAP_NAME(red)) + if (ROUTEMAP_NAME(red)) { + route_map_counter_decrement(ROUTEMAP(red)); free(ROUTEMAP_NAME(red)); + } ROUTEMAP_NAME(red) = strdup(name); ROUTEMAP(red) = route_map_lookup_by_name(name); + route_map_counter_increment(ROUTEMAP(red)); } void ospf_routemap_unset(struct ospf_redist *red) { - if (ROUTEMAP_NAME(red)) + if (ROUTEMAP_NAME(red)) { + route_map_counter_decrement(ROUTEMAP(red)); free(ROUTEMAP_NAME(red)); + } ROUTEMAP_NAME(red) = NULL; ROUTEMAP(red) = NULL; |