diff options
author | Rafael Zalamena <rzalamena@users.noreply.github.com> | 2020-11-03 15:59:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-03 15:59:38 +0100 |
commit | 7c62dc76d4e78cce352d511fea89f908a9ee30ce (patch) | |
tree | b7eadd961c71dd302d2c1800cb1d6abee2677c38 /ospf6d/ospf6_abr.c | |
parent | Merge pull request #6795 from rgirada/ospf_db_json (diff) | |
parent | ospf6d : Transformation changes for ospf6 vrf support. (diff) | |
download | frr-7c62dc76d4e78cce352d511fea89f908a9ee30ce.tar.xz frr-7c62dc76d4e78cce352d511fea89f908a9ee30ce.zip |
Merge pull request #7261 from Niral-Networks/niral_dev_vrf_ospf6
ospf6d : Transformation changes for ospf6 vrf support.
Diffstat (limited to 'ospf6d/ospf6_abr.c')
-rw-r--r-- | ospf6d/ospf6_abr.c | 100 |
1 files changed, 51 insertions, 49 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index cbb80b668..f087289df 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -82,10 +82,10 @@ static int ospf6_abr_nexthops_belong_to_area(struct ospf6_route *route, static void ospf6_abr_delete_route(struct ospf6_route *range, struct ospf6_route *summary, struct ospf6_route_table *summary_table, - struct ospf6_lsa *old) + struct ospf6_lsa *old, struct ospf6 *ospf6) { if (summary) { - ospf6_route_remove(summary, summary_table); + ospf6_route_remove(summary, summary_table, ospf6); } if (old && !OSPF6_LSA_IS_MAXAGE(old)) @@ -117,7 +117,7 @@ void ospf6_abr_disable_area(struct ospf6_area *area) area->ospf6->router_id, area->lsdb); if (old) ospf6_lsa_purge(old); - ospf6_route_remove(ro, area->summary_prefix); + ospf6_route_remove(ro, area->summary_prefix, area->ospf6); } /* Withdraw all summary router-routes previously originated */ @@ -128,7 +128,7 @@ void ospf6_abr_disable_area(struct ospf6_area *area) area->ospf6->router_id, area->lsdb); if (old) ospf6_lsa_purge(old); - ospf6_route_remove(ro, area->summary_router); + ospf6_route_remove(ro, area->summary_router, area->ospf6); } /* Schedule Router-LSA for each area (ABR status may change) */ @@ -273,10 +273,11 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, "The range is not active. withdraw"); ospf6_abr_delete_route(route, summary, - summary_table, old); + summary_table, old, + area->ospf6); } } else if (old) { - ospf6_route_remove(summary, summary_table); + ospf6_route_remove(summary, summary_table, area->ospf6); ospf6_lsa_purge(old); } return 0; @@ -287,7 +288,8 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, zlog_debug( "Area has been stubbed, purge Inter-Router LSA"); - ospf6_abr_delete_route(route, summary, summary_table, old); + ospf6_abr_delete_route(route, summary, summary_table, old, + area->ospf6); return 0; } @@ -296,7 +298,8 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (is_debug) zlog_debug("Area has been stubbed, purge prefix LSA"); - ospf6_abr_delete_route(route, summary, summary_table, old); + ospf6_abr_delete_route(route, summary, summary_table, old, + area->ospf6); return 0; } @@ -332,7 +335,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, zlog_debug( "This is the secondary path to the ASBR, ignore"); ospf6_abr_delete_route(route, summary, summary_table, - old); + old, area->ospf6); return 0; } @@ -363,7 +366,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, "Suppressed by range %pFX of area %s", &range->prefix, route_area->name); ospf6_abr_delete_route(route, summary, summary_table, - old); + old, area->ospf6); return 0; } } @@ -376,7 +379,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, zlog_debug( "This is the range with DoNotAdvertise set. ignore"); ospf6_abr_delete_route(route, summary, summary_table, - old); + old, area->ospf6); return 0; } @@ -385,7 +388,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, if (is_debug) zlog_debug("The range is not active. withdraw"); ospf6_abr_delete_route(route, summary, summary_table, - old); + old, area->ospf6); return 0; } } @@ -437,7 +440,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route, summary->path.origin.type, summary->path.origin.adv_router, area->lsdb); } - summary = ospf6_route_add(summary, summary_table); + summary = ospf6_route_add(summary, summary_table, area->ospf6); } else { summary->type = route->type; monotime(&summary->changed); @@ -576,7 +579,8 @@ ospf6_abr_range_summary_needs_update(struct ospf6_route *range, uint32_t cost) return (redo_summary); } -static void ospf6_abr_range_update(struct ospf6_route *range) +static void ospf6_abr_range_update(struct ospf6_route *range, + struct ospf6 *ospf6) { uint32_t cost = 0; struct listnode *node, *nnode; @@ -615,7 +619,7 @@ static void ospf6_abr_range_update(struct ospf6_route *range) if (IS_OSPF6_DEBUG_ABR) zlog_debug("Add discard route"); - ospf6_zebra_add_discard(range); + ospf6_zebra_add_discard(range, ospf6); } } else { /* Summary removed or no summary generated as no @@ -625,18 +629,19 @@ static void ospf6_abr_range_update(struct ospf6_route *range) if (IS_OSPF6_DEBUG_ABR) zlog_debug("Delete discard route"); - ospf6_zebra_delete_discard(range); + ospf6_zebra_delete_discard(range, ospf6); } } } } -void ospf6_abr_originate_summary(struct ospf6_route *route) +void ospf6_abr_originate_summary(struct ospf6_route *route, struct ospf6 *ospf6) { struct listnode *node, *nnode; struct ospf6_area *oa; struct ospf6_route *range = NULL; + if (route->type == OSPF6_DEST_TYPE_NETWORK) { oa = ospf6_area_lookup(route->path.area_id, ospf6); if (!oa) { @@ -647,7 +652,7 @@ void ospf6_abr_originate_summary(struct ospf6_route *route) range = ospf6_route_lookup_bestmatch(&route->prefix, oa->range_table); if (range) { - ospf6_abr_range_update(range); + ospf6_abr_range_update(range, ospf6); } } @@ -674,7 +679,7 @@ void ospf6_abr_defaults_to_stub(struct ospf6 *o) def->path.subtype = OSPF6_PATH_SUBTYPE_DEFAULT_RT; def->path.area_id = o->backbone->area_id; - for (ALL_LIST_ELEMENTS(ospf6->area_list, node, nnode, oa)) { + for (ALL_LIST_ELEMENTS(o->area_list, node, nnode, oa)) { if (!IS_AREA_STUB(oa)) { /* withdraw defaults when an area switches from stub to * non-stub */ @@ -704,7 +709,8 @@ void ospf6_abr_defaults_to_stub(struct ospf6 *o) void ospf6_abr_old_path_update(struct ospf6_route *old_route, struct ospf6_route *route, - struct ospf6_route_table *table) + struct ospf6_route_table *table, + struct ospf6 *ospf6) { struct ospf6_path *o_path = NULL; struct listnode *anode, *anext; @@ -751,7 +757,7 @@ void ospf6_abr_old_path_update(struct ospf6_route *old_route, : 0); if (table->hook_add) - (*table->hook_add)(old_route); + (*table->hook_add)(old_route, ospf6); if (old_route->path.origin.id == route->path.origin.id && old_route->path.origin.adv_router == @@ -768,9 +774,9 @@ void ospf6_abr_old_path_update(struct ospf6_route *old_route, } } -void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa, - struct ospf6_route *old, - struct ospf6_route_table *table) +void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa, struct ospf6_route *old, + struct ospf6_route_table *table, + struct ospf6 *ospf6) { if (listcount(old->paths) > 1) { struct listnode *anode, *anext, *nnode, *rnode, *rnext; @@ -807,7 +813,7 @@ void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa, : 0); if (table->hook_add) - (*table->hook_add)(old); + (*table->hook_add)(old, ospf6); if ((old->path.origin.id == lsa->header->id) && (old->path.origin.adv_router @@ -824,11 +830,10 @@ void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa, h_path->origin.adv_router; } } else - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, ospf6); } } else - ospf6_route_remove(old, table); - + ospf6_route_remove(old, table, ospf6); } /* RFC 2328 16.2. Calculating the inter-area routes */ @@ -943,7 +948,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) if (is_debug) zlog_debug("cost is LS_INFINITY, ignore"); if (old) - ospf6_abr_old_route_remove(lsa, old, table); + ospf6_abr_old_route_remove(lsa, old, table, oa->ospf6); return; } if (OSPF6_LSA_IS_MAXAGE(lsa)) { @@ -951,7 +956,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) zlog_debug("%s: LSA %s is MaxAge, ignore", __func__, lsa->name); if (old) - ospf6_abr_old_route_remove(lsa, old, table); + ospf6_abr_old_route_remove(lsa, old, table, oa->ospf6); return; } @@ -961,7 +966,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) zlog_debug("LSA %s is self-originated, ignore", lsa->name); if (old) - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, oa->ospf6); return; } @@ -977,7 +982,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) zlog_debug( "Prefix is equal to address range, ignore"); if (old) - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, oa->ospf6); return; } @@ -988,7 +993,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) if (is_debug) zlog_debug("Prefix has NU/LA bit set, ignore"); if (old) - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, oa->ospf6); return; } } @@ -1001,7 +1006,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) if (is_debug) zlog_debug("Prefix has NU/LA bit set, ignore"); if (old) - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, oa->ospf6); return; } @@ -1015,7 +1020,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) "Ignorning Inter-Router LSA for an ABR (%s)", buf); if (old) - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, oa->ospf6); return; } @@ -1043,7 +1048,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) zlog_debug( "%s: remove old entry: %s %p ", __func__, buf, (void *)old); - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, oa->ospf6); } } return; @@ -1062,7 +1067,8 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) zlog_debug( "Prefix was denied by import-list"); if (old) - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, + oa->ospf6); return; } } @@ -1074,7 +1080,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) if (is_debug) zlog_debug("Prefix was denied by prefix-list"); if (old) - ospf6_route_remove(old, table); + ospf6_route_remove(old, table, oa->ospf6); return; } } @@ -1127,7 +1133,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) */ if (listcount(old_route->paths) > 1) ospf6_abr_old_path_update(old_route, route, - table); + table, oa->ospf6); continue; } @@ -1195,7 +1201,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) * For Inter-Router trigger summary update */ if (table->hook_add) - (*table->hook_add)(old_route); + (*table->hook_add)(old_route, oa->ospf6); /* Delete new route */ ospf6_route_delete(route); @@ -1214,23 +1220,19 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa) path = ospf6_path_dup(&route->path); ospf6_copy_nexthops(path->nh_list, abr_entry->nh_list); listnode_add_sort(route->paths, path); - /* ospf6_ia_add_nw_route (table, &prefix, route); */ - ospf6_route_add(route, table); + ospf6_route_add(route, table, oa->ospf6); } } -void ospf6_abr_examin_brouter(uint32_t router_id) +void ospf6_abr_examin_brouter(uint32_t router_id, struct ospf6_route *route, + struct ospf6 *ospf6) { struct ospf6_lsa *lsa; struct ospf6_area *oa; uint16_t type; - if (ospf6_is_router_abr(ospf6)) - oa = ospf6->backbone; - else - oa = listgetdata(listhead(ospf6->area_list)); - + oa = ospf6_area_lookup(route->path.area_id, ospf6); /* * It is possible to designate a non backbone * area first. If that is the case safely @@ -1271,7 +1273,7 @@ void ospf6_abr_prefix_resummarize(struct ospf6 *o) for (route = ospf6_route_head(o->route_table); route; route = ospf6_route_next(route)) - ospf6_abr_originate_summary(route); + ospf6_abr_originate_summary(route, o); if (IS_OSPF6_DEBUG_ABR) zlog_debug("Finished re-examining Inter-Prefix Summaries"); |