ospf6d: don't generate Type-7 LSA for route created by "default-information-originate"

The route created by the "default-information-originate" command
isn't a regular external route. As such, an NSSA ABR shouldn't
originate a corresponding Type-7 LSA for it (there's a separate
configuration knob to generate Type-7 default routes).

While here, fix a small issue in ospf6_asbr_redistribute_add()
where routes created by "default-information-originate" were being
displayed with an incorrect "unknown" type.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
Renato Westphal 2021-09-08 13:13:19 -03:00
parent 16727fd7eb
commit 210429c747
3 changed files with 9 additions and 5 deletions

View File

@ -1433,7 +1433,10 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
memset(&tinfo, 0, sizeof(tinfo)); memset(&tinfo, 0, sizeof(tinfo));
if (IS_OSPF6_DEBUG_ASBR) if (IS_OSPF6_DEBUG_ASBR)
zlog_debug("Redistribute %pFX (%s)", prefix, ZROUTE_NAME(type)); zlog_debug("Redistribute %pFX (%s)", prefix,
type == DEFAULT_ROUTE
? "default-information-originate"
: ZROUTE_NAME(type));
/* if route-map was specified but not found, do not advertise */ /* if route-map was specified but not found, do not advertise */
if (ROUTEMAP_NAME(red)) { if (ROUTEMAP_NAME(red)) {

View File

@ -1169,10 +1169,11 @@ static void ospf6_check_and_originate_type7_lsa(struct ospf6_area *area)
for (route = ospf6_route_head( for (route = ospf6_route_head(
area->ospf6->external_table); area->ospf6->external_table);
route; route = ospf6_route_next(route)) { route; route = ospf6_route_next(route)) {
/* This means the Type-5 LSA was originated for this route */ struct ospf6_external_info *info = route->route_option;
if (route->path.origin.id != 0)
ospf6_nssa_lsa_originate(route, area);
/* This means the Type-5 LSA was originated for this route */
if (route->path.origin.id != 0 && info->type != DEFAULT_ROUTE)
ospf6_nssa_lsa_originate(route, area);
} }
/* Loop through the aggregation table to originate type-7 LSAs /* Loop through the aggregation table to originate type-7 LSAs

View File

@ -218,7 +218,7 @@ def test_ospfv3_expected_route_types():
"numberOfIntraAreaRoutes": 1, "numberOfIntraAreaRoutes": 1,
"numberOfInterAreaRoutes": 2, "numberOfInterAreaRoutes": 2,
"numberOfExternal1Routes": 0, "numberOfExternal1Routes": 0,
"numberOfExternal2Routes": 4, "numberOfExternal2Routes": 3,
}, },
) )