mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 07:03:57 +00:00
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>
This commit is contained in:
parent
54e80c7656
commit
93d836e6fe
@ -70,11 +70,19 @@ static void ospf_route_map_update(const char *name)
|
||||
/* Keep old route-map. */
|
||||
struct route_map *old = ROUTEMAP(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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user