ospf6d: withdraw redistributed prefixes based on prefix-list changes

Problem reported that when an a previously advertised redistributed
route should be withdrawn based on a prefix-list change or route-map
deletion, the external LSAs would remain in the database and not be
withdrawn from peers. This fix does the withdraw when the prefix-list
is changed or route-map is deleted.

Ticket: CM-28944
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
This commit is contained in:
Don Slice 2020-05-05 13:18:15 +00:00
parent 15e9c561b2
commit 780d4bdd80

View File

@ -47,6 +47,9 @@
#include "ospf6_flood.h"
#include "ospf6d.h"
static void ospf6_asbr_redistribute_set(int type);
static void ospf6_asbr_redistribute_unset(int type);
unsigned char conf_debug_ospf6_asbr = 0;
#define ZROUTE_NAME(x) zebra_route_string(x)
@ -935,8 +938,9 @@ static void ospf6_asbr_routemap_update(const char *mapname)
ospf6->rmap[type].map = route_map_lookup_by_name(
ospf6->rmap[type].name);
if (mapname && ospf6->rmap[type].map
if (mapname
&& (strcmp(ospf6->rmap[type].name, mapname) == 0)) {
if (ospf6->rmap[type].map) {
if (IS_OSPF6_DEBUG_ASBR)
zlog_debug(
"%s: route-map %s update, reset redist %s",
@ -947,6 +951,22 @@ static void ospf6_asbr_routemap_update(const char *mapname)
ospf6->rmap[type].map);
ospf6_asbr_distribute_list_update(type);
} else {
/*
* if the mapname matches a route-map on
* ospf6 but the map doesn't exist, it
* is being deleted. flush and then
* readvertise
*/
if (IS_OSPF6_DEBUG_ASBR)
zlog_debug(
"%s: route-map %s deleted, reset redist %s",
__func__, mapname,
ZROUTE_NAME(type));
ospf6_asbr_redistribute_unset(type);
ospf6_asbr_routemap_set(type, mapname);
ospf6_asbr_redistribute_set(type);
}
}
} else
ospf6->rmap[type].map = NULL;
@ -1061,6 +1081,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
if (IS_OSPF6_DEBUG_ASBR)
zlog_debug("Denied by route-map \"%s\"",
ospf6->rmap[type].name);
ospf6_asbr_redistribute_remove(type, ifindex, prefix);
return;
}
}