mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 05:18:47 +00:00
Merge pull request #7572 from idryzhov/ospf6-cleanup
ospf6 code cleanup
This commit is contained in:
commit
5b264736b8
@ -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 *ospf6)
|
||||
struct ospf6_lsa *old)
|
||||
{
|
||||
if (summary) {
|
||||
ospf6_route_remove(summary, summary_table, ospf6);
|
||||
ospf6_route_remove(summary, summary_table);
|
||||
}
|
||||
|
||||
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, area->ospf6);
|
||||
ospf6_route_remove(ro, area->summary_prefix);
|
||||
}
|
||||
|
||||
/* 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, area->ospf6);
|
||||
ospf6_route_remove(ro, area->summary_router);
|
||||
}
|
||||
|
||||
/* Schedule Router-LSA for each area (ABR status may change) */
|
||||
@ -271,11 +271,10 @@ 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,
|
||||
area->ospf6);
|
||||
summary_table, old);
|
||||
}
|
||||
} else if (old) {
|
||||
ospf6_route_remove(summary, summary_table, area->ospf6);
|
||||
ospf6_route_remove(summary, summary_table);
|
||||
ospf6_lsa_purge(old);
|
||||
}
|
||||
return 0;
|
||||
@ -286,8 +285,7 @@ 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,
|
||||
area->ospf6);
|
||||
ospf6_abr_delete_route(route, summary, summary_table, old);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -296,8 +294,7 @@ 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,
|
||||
area->ospf6);
|
||||
ospf6_abr_delete_route(route, summary, summary_table, old);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -333,7 +330,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, area->ospf6);
|
||||
old);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -364,7 +361,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, area->ospf6);
|
||||
old);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -377,7 +374,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, area->ospf6);
|
||||
old);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -386,7 +383,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, area->ospf6);
|
||||
old);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -437,7 +434,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, area->ospf6);
|
||||
summary = ospf6_route_add(summary, summary_table);
|
||||
} else {
|
||||
summary->type = route->type;
|
||||
monotime(&summary->changed);
|
||||
@ -706,8 +703,7 @@ 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 *ospf6)
|
||||
struct ospf6_route_table *table)
|
||||
{
|
||||
struct ospf6_path *o_path = NULL;
|
||||
struct listnode *anode, *anext;
|
||||
@ -754,7 +750,7 @@ void ospf6_abr_old_path_update(struct ospf6_route *old_route,
|
||||
: 0);
|
||||
|
||||
if (table->hook_add)
|
||||
(*table->hook_add)(old_route, ospf6);
|
||||
(*table->hook_add)(old_route);
|
||||
|
||||
if (old_route->path.origin.id == route->path.origin.id &&
|
||||
old_route->path.origin.adv_router ==
|
||||
@ -772,8 +768,7 @@ 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,
|
||||
struct ospf6 *ospf6)
|
||||
struct ospf6_route_table *table)
|
||||
{
|
||||
if (listcount(old->paths) > 1) {
|
||||
struct listnode *anode, *anext, *nnode, *rnode, *rnext;
|
||||
@ -810,7 +805,7 @@ void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa, struct ospf6_route *old,
|
||||
: 0);
|
||||
|
||||
if (table->hook_add)
|
||||
(*table->hook_add)(old, ospf6);
|
||||
(*table->hook_add)(old);
|
||||
|
||||
if ((old->path.origin.id == lsa->header->id) &&
|
||||
(old->path.origin.adv_router
|
||||
@ -827,10 +822,10 @@ void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa, struct ospf6_route *old,
|
||||
h_path->origin.adv_router;
|
||||
}
|
||||
} else
|
||||
ospf6_route_remove(old, table, ospf6);
|
||||
ospf6_route_remove(old, table);
|
||||
}
|
||||
} else
|
||||
ospf6_route_remove(old, table, ospf6);
|
||||
ospf6_route_remove(old, table);
|
||||
}
|
||||
|
||||
/* RFC 2328 16.2. Calculating the inter-area routes */
|
||||
@ -945,7 +940,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, oa->ospf6);
|
||||
ospf6_abr_old_route_remove(lsa, old, table);
|
||||
return;
|
||||
}
|
||||
if (OSPF6_LSA_IS_MAXAGE(lsa)) {
|
||||
@ -953,7 +948,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, oa->ospf6);
|
||||
ospf6_abr_old_route_remove(lsa, old, table);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -963,7 +958,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, oa->ospf6);
|
||||
ospf6_route_remove(old, table);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -979,7 +974,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, oa->ospf6);
|
||||
ospf6_route_remove(old, table);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -990,7 +985,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, oa->ospf6);
|
||||
ospf6_route_remove(old, table);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1003,7 +998,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, oa->ospf6);
|
||||
ospf6_route_remove(old, table);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1017,7 +1012,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, oa->ospf6);
|
||||
ospf6_route_remove(old, table);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1045,7 +1040,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, oa->ospf6);
|
||||
ospf6_route_remove(old, table);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -1064,8 +1059,7 @@ 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,
|
||||
oa->ospf6);
|
||||
ospf6_route_remove(old, table);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1077,7 +1071,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, oa->ospf6);
|
||||
ospf6_route_remove(old, table);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1130,7 +1124,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, oa->ospf6);
|
||||
table);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1198,7 +1192,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, oa->ospf6);
|
||||
(*table->hook_add)(old_route);
|
||||
|
||||
/* Delete new route */
|
||||
ospf6_route_delete(route);
|
||||
@ -1218,7 +1212,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
|
||||
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, oa->ospf6);
|
||||
ospf6_route_add(route, table);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ extern void ospf6_abr_originate_summary(struct ospf6_route *route,
|
||||
struct ospf6 *ospf6);
|
||||
extern void ospf6_abr_examin_summary(struct ospf6_lsa *lsa,
|
||||
struct ospf6_area *oa);
|
||||
extern void ospf6_abr_defaults_to_stub(struct ospf6 *);
|
||||
extern void ospf6_abr_defaults_to_stub(struct ospf6 *ospf6);
|
||||
extern void ospf6_abr_examin_brouter(uint32_t router_id,
|
||||
struct ospf6_route *route,
|
||||
struct ospf6 *ospf6);
|
||||
@ -81,12 +81,10 @@ extern void install_element_ospf6_debug_abr(void);
|
||||
extern int ospf6_abr_config_write(struct vty *vty);
|
||||
extern void ospf6_abr_old_route_remove(struct ospf6_lsa *lsa,
|
||||
struct ospf6_route *old,
|
||||
struct ospf6_route_table *table,
|
||||
struct ospf6 *ospf6);
|
||||
struct ospf6_route_table *table);
|
||||
extern void ospf6_abr_old_path_update(struct ospf6_route *old_route,
|
||||
struct ospf6_route *route,
|
||||
struct ospf6_route_table *table,
|
||||
struct ospf6 *ospf6);
|
||||
struct ospf6_route_table *table);
|
||||
extern void ospf6_abr_init(void);
|
||||
|
||||
#endif /*OSPF6_ABR_H*/
|
||||
|
@ -115,23 +115,25 @@ static void ospf6_area_lsdb_hook_remove(struct ospf6_lsa *lsa)
|
||||
}
|
||||
}
|
||||
|
||||
static void ospf6_area_route_hook_add(struct ospf6_route *route,
|
||||
struct ospf6 *ospf6)
|
||||
static void ospf6_area_route_hook_add(struct ospf6_route *route)
|
||||
{
|
||||
struct ospf6_area *oa = route->table->scope;
|
||||
struct ospf6 *ospf6 = oa->ospf6;
|
||||
struct ospf6_route *copy;
|
||||
|
||||
copy = ospf6_route_copy(route);
|
||||
ospf6_route_add(copy, ospf6->route_table, ospf6);
|
||||
ospf6_route_add(copy, ospf6->route_table);
|
||||
}
|
||||
|
||||
static void ospf6_area_route_hook_remove(struct ospf6_route *route,
|
||||
struct ospf6 *ospf6)
|
||||
static void ospf6_area_route_hook_remove(struct ospf6_route *route)
|
||||
{
|
||||
struct ospf6_area *oa = route->table->scope;
|
||||
struct ospf6 *ospf6 = oa->ospf6;
|
||||
struct ospf6_route *copy;
|
||||
|
||||
copy = ospf6_route_lookup_identical(route, ospf6->route_table);
|
||||
if (copy)
|
||||
ospf6_route_remove(copy, ospf6->route_table, ospf6);
|
||||
ospf6_route_remove(copy, ospf6->route_table);
|
||||
}
|
||||
|
||||
static void ospf6_area_stub_update(struct ospf6_area *area)
|
||||
@ -284,13 +286,13 @@ void ospf6_area_delete(struct ospf6_area *oa)
|
||||
ospf6_lsdb_delete(oa->lsdb_self);
|
||||
ospf6_lsdb_delete(oa->temp_router_lsa_lsdb);
|
||||
|
||||
ospf6_spf_table_finish(oa->spf_table, oa->ospf6);
|
||||
ospf6_route_table_delete(oa->spf_table, oa->ospf6);
|
||||
ospf6_route_table_delete(oa->route_table, oa->ospf6);
|
||||
ospf6_spf_table_finish(oa->spf_table);
|
||||
ospf6_route_table_delete(oa->spf_table);
|
||||
ospf6_route_table_delete(oa->route_table);
|
||||
|
||||
ospf6_route_table_delete(oa->range_table, oa->ospf6);
|
||||
ospf6_route_table_delete(oa->summary_prefix, oa->ospf6);
|
||||
ospf6_route_table_delete(oa->summary_router, oa->ospf6);
|
||||
ospf6_route_table_delete(oa->range_table);
|
||||
ospf6_route_table_delete(oa->summary_prefix);
|
||||
ospf6_route_table_delete(oa->summary_router);
|
||||
|
||||
listnode_delete(oa->ospf6->area_list, oa);
|
||||
oa->ospf6 = NULL;
|
||||
@ -351,8 +353,8 @@ void ospf6_area_disable(struct ospf6_area *oa)
|
||||
ospf6_lsdb_remove_all(oa->lsdb);
|
||||
ospf6_lsdb_remove_all(oa->lsdb_self);
|
||||
|
||||
ospf6_spf_table_finish(oa->spf_table, oa->ospf6);
|
||||
ospf6_route_remove_all(oa->route_table, oa->ospf6);
|
||||
ospf6_spf_table_finish(oa->spf_table);
|
||||
ospf6_route_remove_all(oa->route_table);
|
||||
|
||||
THREAD_OFF(oa->thread_router_lsa);
|
||||
THREAD_OFF(oa->thread_intra_prefix_lsa);
|
||||
@ -508,7 +510,7 @@ DEFUN (area_range,
|
||||
zlog_debug("%s: for prefix %s, flag = %x", __func__,
|
||||
argv[idx_ipv6_prefixlen]->arg, range->flag);
|
||||
if (range->rnode == NULL) {
|
||||
ospf6_route_add(range, oa->range_table, oa->ospf6);
|
||||
ospf6_route_add(range, oa->range_table);
|
||||
}
|
||||
|
||||
if (ospf6_is_router_abr(ospf6)) {
|
||||
@ -569,7 +571,7 @@ DEFUN (no_area_range,
|
||||
/* purge the old aggregated summary LSA */
|
||||
ospf6_abr_originate_summary(range, oa->ospf6);
|
||||
}
|
||||
ospf6_route_remove(range, oa->range_table, oa->ospf6);
|
||||
ospf6_route_remove(range, oa->range_table);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -978,15 +980,15 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root,
|
||||
|
||||
route = ospf6_route_lookup(&prefix, spf_table);
|
||||
if (route == NULL) {
|
||||
ospf6_spf_table_finish(spf_table, ospf6);
|
||||
ospf6_route_table_delete(spf_table, ospf6);
|
||||
ospf6_spf_table_finish(spf_table);
|
||||
ospf6_route_table_delete(spf_table);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
root = (struct ospf6_vertex *)route->route_option;
|
||||
ospf6_spf_display_subtree(vty, "", 0, root);
|
||||
|
||||
ospf6_spf_table_finish(spf_table, ospf6);
|
||||
ospf6_route_table_delete(spf_table, ospf6);
|
||||
ospf6_spf_table_finish(spf_table);
|
||||
ospf6_route_table_delete(spf_table);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
|
||||
*/
|
||||
if (ospf6->route_table->hook_add)
|
||||
(*ospf6->route_table->hook_add)(
|
||||
old_route, ospf6);
|
||||
old_route);
|
||||
|
||||
if (old_route->path.origin.id
|
||||
== route->path.origin.id
|
||||
@ -315,7 +315,7 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
|
||||
route->path.cost);
|
||||
}
|
||||
ospf6_route_remove(old_route,
|
||||
ospf6->route_table, ospf6);
|
||||
ospf6->route_table);
|
||||
}
|
||||
}
|
||||
if (route_updated)
|
||||
@ -425,8 +425,7 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
|
||||
|
||||
/* Update RIB/FIB */
|
||||
if (ospf6->route_table->hook_add)
|
||||
(*ospf6->route_table->hook_add)(old_route,
|
||||
ospf6);
|
||||
(*ospf6->route_table->hook_add)(old_route);
|
||||
|
||||
/* Delete the new route its info added to existing
|
||||
* route.
|
||||
@ -439,16 +438,17 @@ void ospf6_asbr_update_route_ecmp_path(struct ospf6_route *old,
|
||||
|
||||
if (!route_found) {
|
||||
/* Add new route to existing node in ospf6 route table. */
|
||||
ospf6_route_add(route, ospf6->route_table, ospf6);
|
||||
ospf6_route_add(route, ospf6->route_table);
|
||||
}
|
||||
}
|
||||
|
||||
void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa, struct ospf6 *ospf6)
|
||||
void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa)
|
||||
{
|
||||
struct ospf6_as_external_lsa *external;
|
||||
struct prefix asbr_id;
|
||||
struct ospf6_route *asbr_entry, *route, *old;
|
||||
struct ospf6_path *path;
|
||||
struct ospf6 *ospf6;
|
||||
|
||||
external = (struct ospf6_as_external_lsa *)OSPF6_LSA_HEADER_END(
|
||||
lsa->header);
|
||||
@ -456,6 +456,8 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa, struct ospf6 *ospf6)
|
||||
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
|
||||
zlog_debug("Calculate AS-External route for %s", lsa->name);
|
||||
|
||||
ospf6 = ospf6_get_by_lsdb(lsa);
|
||||
|
||||
if (lsa->header->adv_router == ospf6->router_id) {
|
||||
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
|
||||
zlog_debug("Ignore self-originated AS-External-LSA");
|
||||
@ -531,7 +533,7 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa, struct ospf6 *ospf6)
|
||||
old = ospf6_route_lookup(&route->prefix, ospf6->route_table);
|
||||
if (!old) {
|
||||
/* Add the new route to ospf6 instance route table. */
|
||||
ospf6_route_add(route, ospf6->route_table, ospf6);
|
||||
ospf6_route_add(route, ospf6->route_table);
|
||||
} else {
|
||||
/* RFC 2328 16.4 (6)
|
||||
* ECMP: Keep new equal preference path in current
|
||||
@ -733,8 +735,7 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
|
||||
*/
|
||||
if (oa->ospf6->route_table->hook_add)
|
||||
(*oa->ospf6->route_table
|
||||
->hook_add)(
|
||||
route, oa->ospf6);
|
||||
->hook_add)(route);
|
||||
|
||||
/* route's primary path is similar
|
||||
* to LSA, replace route's primary
|
||||
@ -758,8 +759,7 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
|
||||
}
|
||||
} else {
|
||||
ospf6_route_remove(
|
||||
route, oa->ospf6->route_table,
|
||||
oa->ospf6);
|
||||
route, oa->ospf6->route_table);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
@ -799,7 +799,7 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
|
||||
&route->prefix, route->path.cost, route->path.u.cost_e2,
|
||||
listcount(route->nh_list));
|
||||
}
|
||||
ospf6_route_remove(route, oa->ospf6->route_table, oa->ospf6);
|
||||
ospf6_route_remove(route, oa->ospf6->route_table);
|
||||
}
|
||||
if (route != NULL)
|
||||
ospf6_route_unlock(route);
|
||||
@ -825,7 +825,7 @@ void ospf6_asbr_lsentry_add(struct ospf6_route *asbr_entry, struct ospf6 *ospf6)
|
||||
router = ospf6_linkstate_prefix_adv_router(&asbr_entry->prefix);
|
||||
for (ALL_LSDB_TYPED_ADVRTR(ospf6->lsdb, type, router, lsa)) {
|
||||
if (!OSPF6_LSA_IS_MAXAGE(lsa))
|
||||
ospf6_asbr_lsa_add(lsa, ospf6);
|
||||
ospf6_asbr_lsa_add(lsa);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1191,7 +1191,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
|
||||
node = route_node_get(ospf6->external_id_table, &prefix_id);
|
||||
node->info = route;
|
||||
|
||||
route = ospf6_route_add(route, ospf6->external_table, ospf6);
|
||||
route = ospf6_route_add(route, ospf6->external_table);
|
||||
route->route_option = info;
|
||||
|
||||
if (IS_OSPF6_DEBUG_ASBR) {
|
||||
@ -1257,7 +1257,7 @@ void ospf6_asbr_redistribute_remove(int type, ifindex_t ifindex,
|
||||
route_unlock_node(node); /* to free the lookup lock */
|
||||
route_unlock_node(node); /* to free the original lock */
|
||||
|
||||
ospf6_route_remove(match, ospf6->external_table, ospf6);
|
||||
ospf6_route_remove(match, ospf6->external_table);
|
||||
XFREE(MTYPE_OSPF6_EXTERNAL_INFO, info);
|
||||
|
||||
/* Router-Bit (ASBR Flag) may have to be updated */
|
||||
|
@ -70,7 +70,7 @@ struct ospf6_as_external_lsa {
|
||||
(E)->bits_metric |= htonl(0x00ffffff) & htonl(C); \
|
||||
}
|
||||
|
||||
extern void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa, struct ospf6 *ospf6);
|
||||
extern void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa);
|
||||
extern void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
|
||||
struct ospf6_route *asbr_entry);
|
||||
extern void ospf6_asbr_lsentry_add(struct ospf6_route *asbr_entry,
|
||||
|
@ -261,7 +261,7 @@ void ospf6_interface_delete(struct ospf6_interface *oi)
|
||||
ospf6_lsdb_delete(oi->lsupdate_list);
|
||||
ospf6_lsdb_delete(oi->lsack_list);
|
||||
|
||||
ospf6_route_table_delete(oi->route_connected, oi->area->ospf6);
|
||||
ospf6_route_table_delete(oi->route_connected);
|
||||
|
||||
/* cut link */
|
||||
oi->interface->info = NULL;
|
||||
@ -417,7 +417,7 @@ void ospf6_interface_connected_route_update(struct interface *ifp)
|
||||
return;
|
||||
|
||||
/* update "route to advertise" interface route table */
|
||||
ospf6_route_remove_all(oi->route_connected, oi->area->ospf6);
|
||||
ospf6_route_remove_all(oi->route_connected);
|
||||
|
||||
for (ALL_LIST_ELEMENTS(oi->interface->connected, node, nnode, c)) {
|
||||
if (c->address->family != AF_INET6)
|
||||
@ -461,7 +461,7 @@ void ospf6_interface_connected_route_update(struct interface *ifp)
|
||||
inet_pton(AF_INET6, "::1", &nh_addr);
|
||||
ospf6_route_add_nexthop(route, oi->interface->ifindex,
|
||||
&nh_addr);
|
||||
ospf6_route_add(route, oi->route_connected, oi->area->ospf6);
|
||||
ospf6_route_add(route, oi->route_connected);
|
||||
}
|
||||
|
||||
/* create new Link-LSA */
|
||||
|
@ -987,7 +987,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
|
||||
if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
|
||||
zlog_debug(" include %pFX", &route->prefix);
|
||||
ospf6_route_add(ospf6_route_copy(route),
|
||||
route_advertise, oa->ospf6);
|
||||
route_advertise);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1008,7 +1008,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
|
||||
oa->lsdb);
|
||||
}
|
||||
}
|
||||
ospf6_route_table_delete(route_advertise, oa->ospf6);
|
||||
ospf6_route_table_delete(route_advertise);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1088,7 +1088,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
|
||||
op = OSPF6_PREFIX_NEXT(op);
|
||||
}
|
||||
|
||||
ospf6_route_table_delete(route_advertise, oa->ospf6);
|
||||
ospf6_route_table_delete(route_advertise);
|
||||
|
||||
if (prefix_num == 0) {
|
||||
if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
|
||||
@ -1254,8 +1254,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
|
||||
if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
|
||||
zlog_debug(" include %pFX", &route->prefix);
|
||||
|
||||
ospf6_route_add(route, route_advertise,
|
||||
oi->area->ospf6);
|
||||
ospf6_route_add(route, route_advertise);
|
||||
prefix_num--;
|
||||
}
|
||||
if (current != end && IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
|
||||
@ -1277,7 +1276,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
|
||||
prefix_num++;
|
||||
}
|
||||
|
||||
ospf6_route_table_delete(route_advertise, oi->area->ospf6);
|
||||
ospf6_route_table_delete(route_advertise);
|
||||
|
||||
if (prefix_num == 0) {
|
||||
if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
|
||||
@ -1438,7 +1437,7 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
|
||||
*/
|
||||
if (oa->route_table->hook_add)
|
||||
(*oa->route_table->hook_add)(
|
||||
old_route, oa->ospf6);
|
||||
old_route);
|
||||
|
||||
if (old_route->path.origin.id ==
|
||||
route->path.origin.id &&
|
||||
@ -1459,8 +1458,7 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
|
||||
}
|
||||
if (oa->route_table->hook_remove)
|
||||
ospf6_route_remove(old_route,
|
||||
oa->route_table,
|
||||
oa->ospf6);
|
||||
oa->route_table);
|
||||
else
|
||||
SET_FLAG(old_route->flag,
|
||||
OSPF6_ROUTE_REMOVE);
|
||||
@ -1601,8 +1599,7 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
|
||||
SET_FLAG(old_route->flag, OSPF6_ROUTE_ADD);
|
||||
/* Update ospf6 route table and RIB/FIB */
|
||||
if (oa->route_table->hook_add)
|
||||
(*oa->route_table->hook_add)(old_route,
|
||||
oa->ospf6);
|
||||
(*oa->route_table->hook_add)(old_route);
|
||||
/* Delete the new route its info added to existing
|
||||
* route.
|
||||
*/
|
||||
@ -1614,7 +1611,7 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
|
||||
|
||||
if (!route_found) {
|
||||
/* Add new route to existing node in ospf6 route table. */
|
||||
ospf6_route_add(route, oa->route_table, oa->ospf6);
|
||||
ospf6_route_add(route, oa->route_table);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1757,7 +1754,7 @@ void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa)
|
||||
listcount(route->paths),
|
||||
listcount(route->nh_list));
|
||||
}
|
||||
ospf6_route_add(route, oa->route_table, oa->ospf6);
|
||||
ospf6_route_add(route, oa->route_table);
|
||||
}
|
||||
prefix_num--;
|
||||
}
|
||||
@ -1839,7 +1836,7 @@ static void ospf6_intra_prefix_lsa_remove_update_route(struct ospf6_lsa *lsa,
|
||||
* nh_list
|
||||
*/
|
||||
if (oa->route_table->hook_add)
|
||||
(*oa->route_table->hook_add)(route, oa->ospf6);
|
||||
(*oa->route_table->hook_add)(route);
|
||||
|
||||
/* route's primary path is similar
|
||||
* to LSA, replace route's primary
|
||||
@ -1932,8 +1929,7 @@ void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa *lsa)
|
||||
listcount(route->paths),
|
||||
listcount(route->nh_list));
|
||||
}
|
||||
ospf6_route_remove(route, oa->route_table,
|
||||
oa->ospf6);
|
||||
ospf6_route_remove(route, oa->route_table);
|
||||
}
|
||||
}
|
||||
if (route)
|
||||
@ -1949,8 +1945,8 @@ void ospf6_intra_route_calculation(struct ospf6_area *oa)
|
||||
struct ospf6_route *route, *nroute;
|
||||
uint16_t type;
|
||||
struct ospf6_lsa *lsa;
|
||||
void (*hook_add)(struct ospf6_route *, struct ospf6 *) = NULL;
|
||||
void (*hook_remove)(struct ospf6_route *, struct ospf6 *) = NULL;
|
||||
void (*hook_add)(struct ospf6_route *) = NULL;
|
||||
void (*hook_remove)(struct ospf6_route *) = NULL;
|
||||
|
||||
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX))
|
||||
zlog_debug("Re-examin intra-routes for area %s", oa->name);
|
||||
@ -1980,11 +1976,11 @@ void ospf6_intra_route_calculation(struct ospf6_area *oa)
|
||||
}
|
||||
|
||||
if (CHECK_FLAG(route->flag, OSPF6_ROUTE_REMOVE))
|
||||
ospf6_route_remove(route, oa->route_table, oa->ospf6);
|
||||
ospf6_route_remove(route, oa->route_table);
|
||||
else if (CHECK_FLAG(route->flag, OSPF6_ROUTE_ADD)
|
||||
|| CHECK_FLAG(route->flag, OSPF6_ROUTE_CHANGE)) {
|
||||
if (hook_add)
|
||||
(*hook_add)(route, oa->ospf6);
|
||||
(*hook_add)(route);
|
||||
route->flag = 0;
|
||||
} else {
|
||||
/* Redo the summaries as things might have changed */
|
||||
@ -2056,8 +2052,8 @@ static void ospf6_brouter_debug_print(struct ospf6_route *brouter)
|
||||
void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
|
||||
{
|
||||
struct ospf6_route *brouter, *nbrouter, *copy;
|
||||
void (*hook_add)(struct ospf6_route *, struct ospf6 *) = NULL;
|
||||
void (*hook_remove)(struct ospf6_route *, struct ospf6 *) = NULL;
|
||||
void (*hook_add)(struct ospf6_route *) = NULL;
|
||||
void (*hook_remove)(struct ospf6_route *) = NULL;
|
||||
uint32_t brouter_id;
|
||||
char brouter_name[16];
|
||||
|
||||
@ -2115,7 +2111,7 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
|
||||
copy = ospf6_route_copy(brouter);
|
||||
copy->type = OSPF6_DEST_TYPE_ROUTER;
|
||||
copy->path.area_id = oa->area_id;
|
||||
ospf6_route_add(copy, oa->ospf6->brouter_table, oa->ospf6);
|
||||
ospf6_route_add(copy, oa->ospf6->brouter_table);
|
||||
|
||||
if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID(brouter_id)
|
||||
|| IS_OSPF6_DEBUG_ROUTE(MEMORY)) {
|
||||
@ -2201,8 +2197,7 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
|
||||
* removes brouters which are marked for remove.
|
||||
*/
|
||||
oa->intra_brouter_calc = 1;
|
||||
ospf6_route_remove(brouter, oa->ospf6->brouter_table,
|
||||
oa->ospf6);
|
||||
ospf6_route_remove(brouter, oa->ospf6->brouter_table);
|
||||
brouter = NULL;
|
||||
} else if (CHECK_FLAG(brouter->flag, OSPF6_ROUTE_ADD)
|
||||
|| CHECK_FLAG(brouter->flag, OSPF6_ROUTE_CHANGE)) {
|
||||
@ -2216,7 +2211,7 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
|
||||
|
||||
/* newly added */
|
||||
if (hook_add)
|
||||
(*hook_add)(brouter, oa->ospf6);
|
||||
(*hook_add)(brouter);
|
||||
} else {
|
||||
if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID(
|
||||
brouter_id)
|
||||
|
@ -88,12 +88,11 @@ static void __attribute__((noreturn)) ospf6_exit(int status)
|
||||
|
||||
for (ALL_LIST_ELEMENTS(om6->ospf6, node, nnode, ospf6)) {
|
||||
vrf = vrf_lookup_by_id(ospf6->vrf_id);
|
||||
ospf6_serv_close(&ospf6->fd);
|
||||
ospf6_delete(ospf6);
|
||||
ospf6 = NULL;
|
||||
FOR_ALL_INTERFACES (vrf, ifp)
|
||||
if (ifp->info != NULL)
|
||||
ospf6_interface_delete(ifp->info);
|
||||
ospf6_delete(ospf6);
|
||||
ospf6 = NULL;
|
||||
}
|
||||
|
||||
bfd_gbl_exit();
|
||||
|
@ -292,28 +292,28 @@ void ospf6_add_nexthop(struct list *nh_list, int ifindex, struct in6_addr *addr)
|
||||
|
||||
void ospf6_route_zebra_copy_nexthops(struct ospf6_route *route,
|
||||
struct zapi_nexthop nexthops[],
|
||||
int entries)
|
||||
int entries, vrf_id_t vrf_id)
|
||||
{
|
||||
struct ospf6_nexthop *nh;
|
||||
struct listnode *node;
|
||||
struct interface *ifp;
|
||||
char buf[64];
|
||||
int i;
|
||||
|
||||
if (route) {
|
||||
i = 0;
|
||||
for (ALL_LIST_ELEMENTS_RO(route->nh_list, node, nh)) {
|
||||
ifp = if_lookup_by_index_all_vrf(nh->ifindex);
|
||||
if (IS_OSPF6_DEBUG_ZEBRA(SEND)) {
|
||||
const char *ifname;
|
||||
inet_ntop(AF_INET6, &nh->address, buf,
|
||||
sizeof(buf));
|
||||
ifname = ifindex2ifname(nh->ifindex, vrf_id);
|
||||
zlog_debug(" nexthop: %s%%%.*s(%d)", buf,
|
||||
IFNAMSIZ, ifp->name, nh->ifindex);
|
||||
IFNAMSIZ, ifname, nh->ifindex);
|
||||
}
|
||||
if (i >= entries)
|
||||
return;
|
||||
|
||||
nexthops[i].vrf_id = ifp->vrf_id;
|
||||
nexthops[i].vrf_id = vrf_id;
|
||||
nexthops[i].ifindex = nh->ifindex;
|
||||
if (!IN6_IS_ADDR_UNSPECIFIED(&nh->address)) {
|
||||
nexthops[i].gate.ipv6 = nh->address;
|
||||
@ -398,6 +398,7 @@ void ospf6_copy_paths(struct list *dst, struct list *src)
|
||||
struct ospf6_route *ospf6_route_create(void)
|
||||
{
|
||||
struct ospf6_route *route;
|
||||
|
||||
route = XCALLOC(MTYPE_OSPF6_ROUTE, sizeof(struct ospf6_route));
|
||||
route->nh_list = list_new();
|
||||
route->nh_list->cmp = (int (*)(void *, void *))ospf6_nexthop_cmp;
|
||||
@ -590,8 +591,7 @@ static void route_table_assert(struct ospf6_route_table *table)
|
||||
#endif /*DEBUG*/
|
||||
|
||||
struct ospf6_route *ospf6_route_add(struct ospf6_route *route,
|
||||
struct ospf6_route_table *table,
|
||||
struct ospf6 *ospf6)
|
||||
struct ospf6_route_table *table)
|
||||
{
|
||||
struct route_node *node, *nextnode, *prevnode;
|
||||
struct ospf6_route *current = NULL;
|
||||
@ -700,7 +700,7 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route,
|
||||
ospf6_route_table_assert(table);
|
||||
|
||||
if (table->hook_add)
|
||||
(*table->hook_add)(route, ospf6);
|
||||
(*table->hook_add)(route);
|
||||
|
||||
return route;
|
||||
}
|
||||
@ -755,7 +755,7 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route,
|
||||
|
||||
SET_FLAG(route->flag, OSPF6_ROUTE_ADD);
|
||||
if (table->hook_add)
|
||||
(*table->hook_add)(route, ospf6);
|
||||
(*table->hook_add)(route);
|
||||
|
||||
return route;
|
||||
}
|
||||
@ -821,13 +821,13 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route,
|
||||
|
||||
SET_FLAG(route->flag, OSPF6_ROUTE_ADD);
|
||||
if (table->hook_add)
|
||||
(*table->hook_add)(route, ospf6);
|
||||
(*table->hook_add)(route);
|
||||
|
||||
return route;
|
||||
}
|
||||
|
||||
void ospf6_route_remove(struct ospf6_route *route,
|
||||
struct ospf6_route_table *table, struct ospf6 *ospf6)
|
||||
struct ospf6_route_table *table)
|
||||
{
|
||||
struct route_node *node;
|
||||
struct ospf6_route *current;
|
||||
@ -882,7 +882,7 @@ void ospf6_route_remove(struct ospf6_route *route,
|
||||
|
||||
/* Note hook_remove may call ospf6_route_remove */
|
||||
if (table->hook_remove)
|
||||
(*table->hook_remove)(route, ospf6);
|
||||
(*table->hook_remove)(route);
|
||||
|
||||
ospf6_route_unlock(route);
|
||||
}
|
||||
@ -1002,13 +1002,12 @@ struct ospf6_route *ospf6_route_match_next(struct prefix *prefix,
|
||||
return next;
|
||||
}
|
||||
|
||||
void ospf6_route_remove_all(struct ospf6_route_table *table,
|
||||
struct ospf6 *ospf6)
|
||||
void ospf6_route_remove_all(struct ospf6_route_table *table)
|
||||
{
|
||||
struct ospf6_route *route;
|
||||
for (route = ospf6_route_head(table); route;
|
||||
route = ospf6_route_next(route))
|
||||
ospf6_route_remove(route, table, ospf6);
|
||||
ospf6_route_remove(route, table);
|
||||
}
|
||||
|
||||
struct ospf6_route_table *ospf6_route_table_create(int s, int t)
|
||||
@ -1021,10 +1020,9 @@ struct ospf6_route_table *ospf6_route_table_create(int s, int t)
|
||||
return new;
|
||||
}
|
||||
|
||||
void ospf6_route_table_delete(struct ospf6_route_table *table,
|
||||
struct ospf6 *ospf6)
|
||||
void ospf6_route_table_delete(struct ospf6_route_table *table)
|
||||
{
|
||||
ospf6_route_remove_all(table, ospf6);
|
||||
ospf6_route_remove_all(table);
|
||||
bf_free(table->idspace);
|
||||
route_table_finish(table->table);
|
||||
XFREE(MTYPE_OSPF6_ROUTE, table);
|
||||
|
@ -193,9 +193,9 @@ struct ospf6_route_table {
|
||||
bitfield_t idspace;
|
||||
|
||||
/* hooks */
|
||||
void (*hook_add)(struct ospf6_route *, struct ospf6 *);
|
||||
void (*hook_add)(struct ospf6_route *);
|
||||
void (*hook_change)(struct ospf6_route *);
|
||||
void (*hook_remove)(struct ospf6_route *, struct ospf6 *);
|
||||
void (*hook_remove)(struct ospf6_route *);
|
||||
};
|
||||
|
||||
#define OSPF6_SCOPE_TYPE_NONE 0
|
||||
@ -280,7 +280,7 @@ extern int ospf6_route_cmp_nexthops(struct ospf6_route *a,
|
||||
struct ospf6_route *b);
|
||||
extern void ospf6_route_zebra_copy_nexthops(struct ospf6_route *route,
|
||||
struct zapi_nexthop nexthops[],
|
||||
int entries);
|
||||
int entries, vrf_id_t vrf_id);
|
||||
extern int ospf6_route_get_first_nh_index(struct ospf6_route *route);
|
||||
|
||||
/* Hide abstraction of nexthop implementation in route from outsiders */
|
||||
@ -307,11 +307,9 @@ ospf6_route_lookup_bestmatch(struct prefix *prefix,
|
||||
struct ospf6_route_table *table);
|
||||
|
||||
extern struct ospf6_route *ospf6_route_add(struct ospf6_route *route,
|
||||
struct ospf6_route_table *table,
|
||||
struct ospf6 *ospf6);
|
||||
struct ospf6_route_table *table);
|
||||
extern void ospf6_route_remove(struct ospf6_route *route,
|
||||
struct ospf6_route_table *table,
|
||||
struct ospf6 *ospf6);
|
||||
struct ospf6_route_table *table);
|
||||
|
||||
extern struct ospf6_route *ospf6_route_head(struct ospf6_route_table *table);
|
||||
extern struct ospf6_route *ospf6_route_next(struct ospf6_route *route);
|
||||
@ -322,10 +320,9 @@ ospf6_route_match_head(struct prefix *prefix, struct ospf6_route_table *table);
|
||||
extern struct ospf6_route *ospf6_route_match_next(struct prefix *prefix,
|
||||
struct ospf6_route *route);
|
||||
|
||||
extern void ospf6_route_remove_all(struct ospf6_route_table *, struct ospf6 *);
|
||||
extern void ospf6_route_remove_all(struct ospf6_route_table *table);
|
||||
extern struct ospf6_route_table *ospf6_route_table_create(int s, int t);
|
||||
extern void ospf6_route_table_delete(struct ospf6_route_table *,
|
||||
struct ospf6 *);
|
||||
extern void ospf6_route_table_delete(struct ospf6_route_table *table);
|
||||
extern void ospf6_route_dump(struct ospf6_route_table *table);
|
||||
|
||||
|
||||
|
@ -316,8 +316,7 @@ static void ospf6_nexthop_calc(struct ospf6_vertex *w, struct ospf6_vertex *v,
|
||||
}
|
||||
|
||||
static int ospf6_spf_install(struct ospf6_vertex *v,
|
||||
struct ospf6_route_table *result_table,
|
||||
struct ospf6 *ospf6)
|
||||
struct ospf6_route_table *result_table)
|
||||
{
|
||||
struct ospf6_route *route, *parent_route;
|
||||
struct ospf6_vertex *prev;
|
||||
@ -417,12 +416,11 @@ static int ospf6_spf_install(struct ospf6_vertex *v,
|
||||
listnode_add_sort(v->parent->child_list, v);
|
||||
route->route_option = v;
|
||||
|
||||
ospf6_route_add(route, result_table, ospf6);
|
||||
ospf6_route_add(route, result_table);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ospf6_spf_table_finish(struct ospf6_route_table *result_table,
|
||||
struct ospf6 *ospf6)
|
||||
void ospf6_spf_table_finish(struct ospf6_route_table *result_table)
|
||||
{
|
||||
struct ospf6_route *route, *nroute;
|
||||
struct ospf6_vertex *v;
|
||||
@ -430,7 +428,7 @@ void ospf6_spf_table_finish(struct ospf6_route_table *result_table,
|
||||
nroute = ospf6_route_next(route);
|
||||
v = (struct ospf6_vertex *)route->route_option;
|
||||
ospf6_vertex_delete(v);
|
||||
ospf6_route_remove(route, result_table, ospf6);
|
||||
ospf6_route_remove(route, result_table);
|
||||
}
|
||||
}
|
||||
|
||||
@ -468,7 +466,7 @@ void ospf6_spf_calculation(uint32_t router_id,
|
||||
struct ospf6_lsa *lsa;
|
||||
struct in6_addr address;
|
||||
|
||||
ospf6_spf_table_finish(result_table, oa->ospf6);
|
||||
ospf6_spf_table_finish(result_table);
|
||||
|
||||
/* Install the calculating router itself as the root of the SPF tree */
|
||||
/* construct root vertex */
|
||||
@ -497,7 +495,7 @@ void ospf6_spf_calculation(uint32_t router_id,
|
||||
while ((v = vertex_pqueue_pop(&candidate_list))) {
|
||||
/* installing may result in merging or rejecting of the vertex
|
||||
*/
|
||||
if (ospf6_spf_install(v, result_table, oa->ospf6) < 0)
|
||||
if (ospf6_spf_install(v, result_table) < 0)
|
||||
continue;
|
||||
|
||||
/* Skip overloaded routers */
|
||||
|
@ -139,8 +139,7 @@ static inline unsigned int ospf6_lsremove_to_spf_reason(struct ospf6_lsa *lsa)
|
||||
return (reason);
|
||||
}
|
||||
|
||||
extern void ospf6_spf_table_finish(struct ospf6_route_table *result_table,
|
||||
struct ospf6 *ospf6);
|
||||
extern void ospf6_spf_table_finish(struct ospf6_route_table *result_table);
|
||||
extern void ospf6_spf_calculation(uint32_t router_id,
|
||||
struct ospf6_route_table *result_table,
|
||||
struct ospf6_area *oa);
|
||||
|
@ -124,12 +124,9 @@ struct ospf6 *ospf6_lookup_by_vrf_name(const char *name)
|
||||
|
||||
static void ospf6_top_lsdb_hook_add(struct ospf6_lsa *lsa)
|
||||
{
|
||||
struct ospf6 *ospf6 = NULL;
|
||||
|
||||
switch (ntohs(lsa->header->type)) {
|
||||
case OSPF6_LSTYPE_AS_EXTERNAL:
|
||||
ospf6 = ospf6_get_by_lsdb(lsa);
|
||||
ospf6_asbr_lsa_add(lsa, ospf6);
|
||||
ospf6_asbr_lsa_add(lsa);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -149,24 +146,27 @@ static void ospf6_top_lsdb_hook_remove(struct ospf6_lsa *lsa)
|
||||
}
|
||||
}
|
||||
|
||||
static void ospf6_top_route_hook_add(struct ospf6_route *route,
|
||||
struct ospf6 *ospf6)
|
||||
static void ospf6_top_route_hook_add(struct ospf6_route *route)
|
||||
{
|
||||
struct ospf6 *ospf6 = route->table->scope;
|
||||
|
||||
ospf6_abr_originate_summary(route, ospf6);
|
||||
ospf6_zebra_route_update_add(route, ospf6);
|
||||
}
|
||||
|
||||
static void ospf6_top_route_hook_remove(struct ospf6_route *route,
|
||||
struct ospf6 *ospf6)
|
||||
static void ospf6_top_route_hook_remove(struct ospf6_route *route)
|
||||
{
|
||||
struct ospf6 *ospf6 = route->table->scope;
|
||||
|
||||
route->flag |= OSPF6_ROUTE_REMOVE;
|
||||
ospf6_abr_originate_summary(route, ospf6);
|
||||
ospf6_zebra_route_update_remove(route, ospf6);
|
||||
}
|
||||
|
||||
static void ospf6_top_brouter_hook_add(struct ospf6_route *route,
|
||||
struct ospf6 *ospf6)
|
||||
static void ospf6_top_brouter_hook_add(struct ospf6_route *route)
|
||||
{
|
||||
struct ospf6 *ospf6 = route->table->scope;
|
||||
|
||||
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL) ||
|
||||
IS_OSPF6_DEBUG_BROUTER) {
|
||||
uint32_t brouter_id;
|
||||
@ -186,9 +186,10 @@ static void ospf6_top_brouter_hook_add(struct ospf6_route *route,
|
||||
ospf6_abr_originate_summary(route, ospf6);
|
||||
}
|
||||
|
||||
static void ospf6_top_brouter_hook_remove(struct ospf6_route *route,
|
||||
struct ospf6 *ospf6)
|
||||
static void ospf6_top_brouter_hook_remove(struct ospf6_route *route)
|
||||
{
|
||||
struct ospf6 *ospf6 = route->table->scope;
|
||||
|
||||
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL) ||
|
||||
IS_OSPF6_DEBUG_BROUTER) {
|
||||
uint32_t brouter_id;
|
||||
@ -301,6 +302,8 @@ void ospf6_delete(struct ospf6 *o)
|
||||
ospf6_disable(o);
|
||||
ospf6_del(o);
|
||||
|
||||
ospf6_serv_close(&o->fd);
|
||||
|
||||
for (ALL_LIST_ELEMENTS(o->area_list, node, nnode, oa))
|
||||
ospf6_area_delete(oa);
|
||||
|
||||
@ -310,10 +313,10 @@ void ospf6_delete(struct ospf6 *o)
|
||||
ospf6_lsdb_delete(o->lsdb);
|
||||
ospf6_lsdb_delete(o->lsdb_self);
|
||||
|
||||
ospf6_route_table_delete(o->route_table, o);
|
||||
ospf6_route_table_delete(o->brouter_table, o);
|
||||
ospf6_route_table_delete(o->route_table);
|
||||
ospf6_route_table_delete(o->brouter_table);
|
||||
|
||||
ospf6_route_table_delete(o->external_table, o);
|
||||
ospf6_route_table_delete(o->external_table);
|
||||
route_table_finish(o->external_id_table);
|
||||
|
||||
ospf6_distance_reset(o);
|
||||
@ -338,8 +341,8 @@ static void ospf6_disable(struct ospf6 *o)
|
||||
ospf6_asbr_redistribute_reset(o->vrf_id);
|
||||
|
||||
ospf6_lsdb_remove_all(o->lsdb);
|
||||
ospf6_route_remove_all(o->route_table, o);
|
||||
ospf6_route_remove_all(o->brouter_table, o);
|
||||
ospf6_route_remove_all(o->route_table);
|
||||
ospf6_route_remove_all(o->brouter_table);
|
||||
|
||||
THREAD_OFF(o->maxage_remover);
|
||||
THREAD_OFF(o->t_spf_calc);
|
||||
@ -457,7 +460,6 @@ DEFUN (no_router_ospf6,
|
||||
if (ospf6 == NULL)
|
||||
vty_out(vty, "OSPFv3 is not configured\n");
|
||||
else {
|
||||
ospf6_serv_close(&ospf6->fd);
|
||||
ospf6_delete(ospf6);
|
||||
ospf6 = NULL;
|
||||
}
|
||||
|
@ -344,7 +344,8 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request,
|
||||
api.prefix = *dest;
|
||||
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
|
||||
api.nexthop_num = MIN(nhcount, MULTIPATH_NUM);
|
||||
ospf6_route_zebra_copy_nexthops(request, api.nexthops, api.nexthop_num);
|
||||
ospf6_route_zebra_copy_nexthops(request, api.nexthops, api.nexthop_num,
|
||||
api.vrf_id);
|
||||
SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
|
||||
api.metric = (request->path.metric_type == 2 ? request->path.u.cost_e2
|
||||
: request->path.cost);
|
||||
|
@ -1237,8 +1237,6 @@ static void ospf6_plist_del(struct prefix_list *plist)
|
||||
/* Install ospf related commands. */
|
||||
void ospf6_init(struct thread_master *master)
|
||||
{
|
||||
struct ospf6 *ospf6;
|
||||
|
||||
ospf6_top_init();
|
||||
ospf6_area_init();
|
||||
ospf6_interface_init();
|
||||
@ -1302,8 +1300,4 @@ void ospf6_init(struct thread_master *master)
|
||||
VIEW_NODE,
|
||||
&show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd);
|
||||
install_element(VIEW_NODE, &show_ipv6_ospf6_database_aggr_router_cmd);
|
||||
|
||||
ospf6 = ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME);
|
||||
if (ospf6 == NULL)
|
||||
ospf6_instance_create(VRF_DEFAULT_NAME);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user