summaryrefslogtreecommitdiffstats
path: root/ospf6d/ospf6_abr.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2021-10-06 02:25:55 +0200
committerRenato Westphal <renato@opensourcerouting.org>2021-10-06 02:25:55 +0200
commit8ee9d58b0d67fc918259ef69f106586bd0a3a6da (patch)
tree21fe8d6e32034d9e204289598927442ff1bf62a6 /ospf6d/ospf6_abr.c
parentospf6d: remove unnecessary check when translating Type-7 LSA (diff)
downloadfrr-8ee9d58b0d67fc918259ef69f106586bd0a3a6da.tar.xz
frr-8ee9d58b0d67fc918259ef69f106586bd0a3a6da.zip
ospf6d: assorted code cleanup
This commits consists of several changes that positively impact code reability without introducing any logical change. Summary of the changes: * Return earlier in ospf6_abr_range_update() in order to reduce one level of indentation; * Remove ospf6_translated_nssa_originate() since it's nothing other than a useless wrapper around ospf6_lsa_translated_nssa_new(); * Change ospf6_abr_translate_nssa() to return void; * Change ospf6_abr_process_nssa_translates() checking for NSSA areas before anything else; * Remove ospf6_abr_remove_unapproved_translates_apply() since it's a small function that is only called in one place; * Change ospf6_abr_check_translate_nssa() to avoid an LSDB lookup when the router isn't an ABR. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospf6d/ospf6_abr.c')
-rw-r--r--ospf6d/ospf6_abr.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c
index 0b2c14bc5..690a0dd25 100644
--- a/ospf6d/ospf6_abr.c
+++ b/ospf6d/ospf6_abr.c
@@ -681,34 +681,31 @@ void ospf6_abr_range_update(struct ospf6_route *range, struct ospf6 *ospf6)
* if there
* were active ranges.
*/
+ if (!ospf6_abr_range_summary_needs_update(range, cost))
+ return;
- if (ospf6_abr_range_summary_needs_update(range, cost)) {
- if (IS_OSPF6_DEBUG_ABR)
- zlog_debug("%s: range %pFX update", __func__,
- &range->prefix);
- for (ALL_LIST_ELEMENTS(ospf6->area_list, node, nnode, oa))
- summary_orig +=
- ospf6_abr_originate_summary_to_area(range, oa);
-
- if (CHECK_FLAG(range->flag, OSPF6_ROUTE_ACTIVE_SUMMARY)
- && summary_orig) {
- if (!CHECK_FLAG(range->flag,
- OSPF6_ROUTE_BLACKHOLE_ADDED)) {
- if (IS_OSPF6_DEBUG_ABR)
- zlog_debug("Add discard route");
+ if (IS_OSPF6_DEBUG_ABR)
+ zlog_debug("%s: range %pFX update", __func__, &range->prefix);
- ospf6_zebra_add_discard(range, ospf6);
- }
- } else {
- /* Summary removed or no summary generated as no
- * specifics exist */
- if (CHECK_FLAG(range->flag,
- OSPF6_ROUTE_BLACKHOLE_ADDED)) {
- if (IS_OSPF6_DEBUG_ABR)
- zlog_debug("Delete discard route");
+ for (ALL_LIST_ELEMENTS(ospf6->area_list, node, nnode, oa))
+ summary_orig += ospf6_abr_originate_summary_to_area(range, oa);
- ospf6_zebra_delete_discard(range, ospf6);
- }
+ if (CHECK_FLAG(range->flag, OSPF6_ROUTE_ACTIVE_SUMMARY)
+ && summary_orig) {
+ if (!CHECK_FLAG(range->flag, OSPF6_ROUTE_BLACKHOLE_ADDED)) {
+ if (IS_OSPF6_DEBUG_ABR)
+ zlog_debug("Add discard route");
+
+ ospf6_zebra_add_discard(range, ospf6);
+ }
+ } else {
+ /* Summary removed or no summary generated as no
+ * specifics exist */
+ if (CHECK_FLAG(range->flag, OSPF6_ROUTE_BLACKHOLE_ADDED)) {
+ if (IS_OSPF6_DEBUG_ABR)
+ zlog_debug("Delete discard route");
+
+ ospf6_zebra_delete_discard(range, ospf6);
}
}
}