From 210429c74722d85f392cbee344ffd30bea83a004 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Wed, 8 Sep 2021 13:13:19 -0300 Subject: [PATCH] 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 --- ospf6d/ospf6_asbr.c | 5 ++++- ospf6d/ospf6_nssa.c | 7 ++++--- tests/topotests/ospf6_topo2/test_ospf6_topo2.py | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index b47f0ca169..85abd9d011 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -1433,7 +1433,10 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex, memset(&tinfo, 0, sizeof(tinfo)); 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 (ROUTEMAP_NAME(red)) { diff --git a/ospf6d/ospf6_nssa.c b/ospf6d/ospf6_nssa.c index 89a72bf225..abaa16f411 100644 --- a/ospf6d/ospf6_nssa.c +++ b/ospf6d/ospf6_nssa.c @@ -1169,10 +1169,11 @@ static void ospf6_check_and_originate_type7_lsa(struct ospf6_area *area) for (route = ospf6_route_head( area->ospf6->external_table); route; route = ospf6_route_next(route)) { - /* This means the Type-5 LSA was originated for this route */ - if (route->path.origin.id != 0) - ospf6_nssa_lsa_originate(route, area); + struct ospf6_external_info *info = route->route_option; + /* 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 diff --git a/tests/topotests/ospf6_topo2/test_ospf6_topo2.py b/tests/topotests/ospf6_topo2/test_ospf6_topo2.py index 8be461aeac..997058f926 100644 --- a/tests/topotests/ospf6_topo2/test_ospf6_topo2.py +++ b/tests/topotests/ospf6_topo2/test_ospf6_topo2.py @@ -218,7 +218,7 @@ def test_ospfv3_expected_route_types(): "numberOfIntraAreaRoutes": 1, "numberOfInterAreaRoutes": 2, "numberOfExternal1Routes": 0, - "numberOfExternal2Routes": 4, + "numberOfExternal2Routes": 3, }, )