Merge pull request #10158 from ckishimo/ospf6d_norefresh

ospf6d: stop refreshing type-5 from NSSA
This commit is contained in:
Russ White 2022-03-29 08:36:05 -04:00 committed by GitHub
commit c845d58d6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 27 deletions

View File

@ -613,7 +613,8 @@ struct ospf6_lsa *ospf6_translated_nssa_refresh(struct ospf6_area *area,
return new;
}
static void ospf6_abr_translate_nssa(struct ospf6_area *area, struct ospf6_lsa *lsa)
static void ospf6_abr_translate_nssa(struct ospf6_area *area,
struct ospf6_lsa *lsa)
{
/* Incoming Type-7 or aggregated Type-7
*
@ -625,7 +626,7 @@ static void ospf6_abr_translate_nssa(struct ospf6_area *area, struct ospf6_lsa *
* Later, any Unapproved Translated Type-5's are flushed/discarded
*/
struct ospf6_lsa *old = NULL, *new = NULL;
struct ospf6_lsa *old = NULL;
struct ospf6_as_external_lsa *nssa_lsa;
struct prefix prefix;
struct ospf6_route *match;
@ -661,11 +662,36 @@ static void ospf6_abr_translate_nssa(struct ospf6_area *area, struct ospf6_lsa *
return;
}
/* Find the type-5 LSA in the area-range table */
match = ospf6_route_lookup_bestmatch(&prefix, area->nssa_range_table);
if (match && CHECK_FLAG(match->flag, OSPF6_ROUTE_NSSA_RANGE)) {
if (prefix_same(&prefix, &match->prefix)) {
/* The prefix range is being removed,
* no need to refresh
*/
if
CHECK_FLAG(match->flag, OSPF6_ROUTE_REMOVE)
return;
} else {
if (!CHECK_FLAG(match->flag, OSPF6_ROUTE_REMOVE)) {
if (IS_OSPF6_DEBUG_NSSA)
zlog_debug(
"%s: LSA Id %pI4 suppressed by range %pFX of area %s",
__func__, &lsa->header->id,
&match->prefix, area->name);
/* LSA will be suppressed by area-range command,
* no need to refresh
*/
return;
}
}
}
/* Find the existing AS-External LSA for this prefix */
match = ospf6_route_lookup(&prefix, ospf6->external_table);
match = ospf6_route_lookup(&prefix, ospf6->route_table);
if (match) {
old = ospf6_lsdb_lookup(OSPF6_LSTYPE_AS_EXTERNAL,
match->path.origin.id, ospf6->router_id,
old = ospf6_lsdb_lookup(htons(OSPF6_LSTYPE_AS_EXTERNAL),
lsa->external_lsa_id, ospf6->router_id,
ospf6->lsdb);
}
@ -675,20 +701,15 @@ static void ospf6_abr_translate_nssa(struct ospf6_area *area, struct ospf6_lsa *
return;
}
if (old) {
if (old && !OSPF6_LSA_IS_MAXAGE(old)) {
if (IS_OSPF6_DEBUG_NSSA)
zlog_debug(
"%s : found old translated LSA Id %pI4, refreshing",
"%s : found old translated LSA Id %pI4, skip",
__func__, &old->header->id);
/* refresh */
new = ospf6_translated_nssa_refresh(area, lsa, old);
if (!new) {
if (IS_OSPF6_DEBUG_NSSA)
zlog_debug(
"%s : could not refresh translated LSA Id %pI4",
__func__, &old->header->id);
}
UNSET_FLAG(old->flag, OSPF6_LSA_UNAPPROVED);
return;
} else {
/* no existing external route for this LSA Id
* originate translated LSA

View File

@ -134,6 +134,7 @@ def build_topo(tgen):
switch = tgen.add_switch("s4")
switch.add_link(tgen.gears["r4"], nodeif="r4-stubnet")
def setup_module(mod):
"Sets up the pytest environment"
tgen = Topogen(build_topo, mod.__name__)
@ -585,10 +586,11 @@ def test_nssa_range():
logger.info("Expecting NSSA range to be added on r3")
routes = {
"2001:db8:1000::/64": {
"metricType":2,
"metricCost":20,
"metricCostE2":10,
}}
"metricType": 2,
"metricCost": 20,
"metricCostE2": 10,
}
}
expect_ospfv3_routes("r3", routes, wait=30, type="external-2", detail=True)
# Change the NSSA range cost.
@ -601,10 +603,11 @@ def test_nssa_range():
logger.info("Expecting NSSA range to be updated with new cost")
routes = {
"2001:db8:1000::/64": {
"metricType":2,
"metricCost":20,
"metricCostE2":1000,
}}
"metricType": 2,
"metricCost": 20,
"metricCostE2": 1000,
}
}
expect_ospfv3_routes("r3", routes, wait=30, type="external-2", detail=True)
# Configure the NSSA range to not be advertised.
@ -631,12 +634,12 @@ def test_nssa_range():
logger.info("Expecting previously summarized routes to be re-added")
routes = {
"2001:db8:1000::1/128": {
"metricType":2,
"metricCost":20,
"metricType": 2,
"metricCostE2": 20,
},
"2001:db8:1000::2/128": {
"metricType":2,
"metricCost":20,
"metricType": 2,
"metricCostE2": 20,
},
}
expect_ospfv3_routes("r3", routes, wait=30, type="external-2", detail=True)