diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2023-03-08 01:13:53 +0100 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2023-04-01 00:28:15 +0200 |
commit | 271588ace08cda6d0c882c71f3ef24a48c3adaae (patch) | |
tree | 266c21bd4820b4932b83b0966ae128f12cacd5ea /ospfd | |
parent | ospfd: refactor range commands (diff) | |
download | frr-271588ace08cda6d0c882c71f3ef24a48c3adaae.tar.xz frr-271588ace08cda6d0c882c71f3ef24a48c3adaae.zip |
ospfd: do not install blackhole routes for ranges with "not-advertise"
Adding blackhole routes is unnecessary in that case.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospfd')
-rw-r--r-- | ospfd/ospf_abr.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/ospfd/ospf_abr.c b/ospfd/ospf_abr.c index 72d231a31..a13a32854 100644 --- a/ospfd/ospf_abr.c +++ b/ospfd/ospf_abr.c @@ -76,7 +76,8 @@ static void ospf_area_range_delete(struct ospf_area *area, { struct ospf_area_range *range = rn->info; - if (ospf_area_range_active(range)) + if (ospf_area_range_active(range) && + CHECK_FLAG(range->flags, OSPF_AREA_RANGE_ADVERTISE)) ospf_delete_discard_route(area->ospf, area->ospf->new_table, (struct prefix_ipv4 *)&rn->p); @@ -1933,25 +1934,27 @@ static void ospf_abr_manage_discard_routes(struct ospf *ospf) struct listnode *node, *nnode; struct route_node *rn; struct ospf_area *area; - struct ospf_area_range *range; - for (ALL_LIST_ELEMENTS(ospf->areas, node, nnode, area)) - for (rn = route_top(area->ranges); rn; rn = route_next(rn)) - if ((range = rn->info) != NULL) - if (CHECK_FLAG(range->flags, - OSPF_AREA_RANGE_ADVERTISE)) { - if (ospf_area_range_active(range)) - ospf_add_discard_route( - ospf, ospf->new_table, - area, - (struct prefix_ipv4 - *)&rn->p); - else - ospf_delete_discard_route( - ospf, ospf->new_table, - (struct prefix_ipv4 - *)&rn->p); - } + for (ALL_LIST_ELEMENTS(ospf->areas, node, nnode, area)) { + for (rn = route_top(area->ranges); rn; rn = route_next(rn)) { + struct ospf_area_range *range; + + range = rn->info; + if (!range) + continue; + + if (ospf_area_range_active(range) + && CHECK_FLAG(range->flags, + OSPF_AREA_RANGE_ADVERTISE)) + ospf_add_discard_route( + ospf, ospf->new_table, area, + (struct prefix_ipv4 *)&rn->p); + else + ospf_delete_discard_route( + ospf, ospf->new_table, + (struct prefix_ipv4 *)&rn->p); + } + } } /* This is the function taking care about ABR NSSA, i.e. NSSA |