summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_intra.c
diff options
context:
space:
mode:
authorharios_niral <hari@niralnetworks.com>2020-10-07 22:38:43 -0700
committerharios_niral <hari@niralnetworks.com>2020-10-30 23:50:08 -0700
commitbeadc736bbd27da5d2bb6f2770fceea7af227ef3 (patch)
treecd3b630a3556f93fd68c80d087051882ae56e138 /ospf6d/ospf6_intra.c
parentc85b63238ae18baaabd833cdbfba79bba227a0e0 (diff)
ospf6d : Transformation changes for ospf6 vrf support.
1. All the changes are related to handle ospf6 with different vrf. 2. The dependancy of global ospf6 is removed. Co-authored-by: Kaushik <kaushik@niralnetworks.com> Signed-off-by: harios_niral <hari@niralnetworks.com>
Diffstat (limited to 'ospf6d/ospf6_intra.c')
-rw-r--r--ospf6d/ospf6_intra.c66
1 files changed, 36 insertions, 30 deletions
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c
index 6eda9f750c..15bfabb75d 100644
--- a/ospf6d/ospf6_intra.c
+++ b/ospf6d/ospf6_intra.c
@@ -147,7 +147,7 @@ static void ospf6_router_lsa_options_set(struct ospf6_area *oa,
OSPF6_OPT_CLEAR_ALL(router_lsa->options);
memcpy(router_lsa->options, oa->options, 3);
- if (ospf6_is_router_abr(ospf6))
+ if (ospf6_is_router_abr(oa->ospf6))
SET_FLAG(router_lsa->bits, OSPF6_ROUTER_BIT_B);
else
UNSET_FLAG(router_lsa->bits, OSPF6_ROUTER_BIT_B);
@@ -990,7 +990,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
zlog_debug(" include %s", buf);
}
ospf6_route_add(ospf6_route_copy(route),
- route_advertise);
+ route_advertise, oa->ospf6);
}
}
@@ -1011,7 +1011,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
oa->lsdb);
}
}
- ospf6_route_table_delete(route_advertise);
+ ospf6_route_table_delete(route_advertise, oa->ospf6);
return 0;
}
@@ -1091,7 +1091,7 @@ int ospf6_intra_prefix_lsa_originate_stub(struct thread *thread)
op = OSPF6_PREFIX_NEXT(op);
}
- ospf6_route_table_delete(route_advertise);
+ ospf6_route_table_delete(route_advertise, oa->ospf6);
if (prefix_num == 0) {
if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
@@ -1260,7 +1260,8 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
zlog_debug(" include %s", buf);
}
- ospf6_route_add(route, route_advertise);
+ ospf6_route_add(route, route_advertise,
+ oi->area->ospf6);
prefix_num--;
}
if (current != end && IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
@@ -1282,7 +1283,7 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
prefix_num++;
}
- ospf6_route_table_delete(route_advertise);
+ ospf6_route_table_delete(route_advertise, oi->area->ospf6);
if (prefix_num == 0) {
if (IS_OSPF6_DEBUG_ORIGINATE(INTRA_PREFIX))
@@ -1315,14 +1316,14 @@ int ospf6_intra_prefix_lsa_originate_transit(struct thread *thread)
return 0;
}
-static void ospf6_intra_prefix_update_route_origin(struct ospf6_route *oa_route)
+static void ospf6_intra_prefix_update_route_origin(struct ospf6_route *oa_route,
+ struct ospf6 *ospf6)
{
struct ospf6_path *h_path;
struct ospf6_route *g_route, *nroute;
/* Update Global ospf6 route path */
- g_route = ospf6_route_lookup(&oa_route->prefix,
- ospf6->route_table);
+ g_route = ospf6_route_lookup(&oa_route->prefix, ospf6->route_table);
assert(g_route);
@@ -1442,15 +1443,15 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
* nh_list
*/
if (oa->route_table->hook_add)
- (*oa->route_table->hook_add)
- (old_route);
+ (*oa->route_table->hook_add)(
+ old_route, oa->ospf6);
if (old_route->path.origin.id ==
route->path.origin.id &&
old_route->path.origin.adv_router ==
route->path.origin.adv_router) {
ospf6_intra_prefix_update_route_origin(
- old_route);
+ old_route, oa->ospf6);
}
break;
}
@@ -1464,7 +1465,8 @@ 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->route_table,
+ oa->ospf6);
else
SET_FLAG(old_route->flag,
OSPF6_ROUTE_REMOVE);
@@ -1600,7 +1602,8 @@ 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->route_table->hook_add)(old_route,
+ oa->ospf6);
/* Delete the new route its info added to existing
* route.
*/
@@ -1612,7 +1615,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);
+ ospf6_route_add(route, oa->route_table, oa->ospf6);
}
}
@@ -1748,7 +1751,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);
+ ospf6_route_add(route, oa->route_table, oa->ospf6);
}
prefix_num--;
}
@@ -1830,7 +1833,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->route_table->hook_add)(route, oa->ospf6);
/* route's primary path is similar
* to LSA, replace route's primary
@@ -1840,7 +1843,8 @@ static void ospf6_intra_prefix_lsa_remove_update_route(struct ospf6_lsa *lsa,
if ((route->path.origin.id == lsa->header->id) &&
(route->path.origin.adv_router ==
lsa->header->adv_router)) {
- ospf6_intra_prefix_update_route_origin(route);
+ ospf6_intra_prefix_update_route_origin(route,
+ oa->ospf6);
}
}
@@ -1922,7 +1926,8 @@ void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa *lsa)
listcount(route->paths),
listcount(route->nh_list));
}
- ospf6_route_remove(route, oa->route_table);
+ ospf6_route_remove(route, oa->route_table,
+ oa->ospf6);
}
}
if (route)
@@ -1938,8 +1943,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 *) = NULL;
- void (*hook_remove)(struct ospf6_route *) = NULL;
+ void (*hook_add)(struct ospf6_route *, struct ospf6 *) = NULL;
+ void (*hook_remove)(struct ospf6_route *, struct ospf6 *) = NULL;
if (IS_OSPF6_DEBUG_EXAMIN(INTRA_PREFIX))
zlog_debug("Re-examin intra-routes for area %s", oa->name);
@@ -1969,15 +1974,15 @@ void ospf6_intra_route_calculation(struct ospf6_area *oa)
}
if (CHECK_FLAG(route->flag, OSPF6_ROUTE_REMOVE))
- ospf6_route_remove(route, oa->route_table);
+ ospf6_route_remove(route, oa->route_table, oa->ospf6);
else if (CHECK_FLAG(route->flag, OSPF6_ROUTE_ADD)
|| CHECK_FLAG(route->flag, OSPF6_ROUTE_CHANGE)) {
if (hook_add)
- (*hook_add)(route);
+ (*hook_add)(route, oa->ospf6);
route->flag = 0;
} else {
/* Redo the summaries as things might have changed */
- ospf6_abr_originate_summary(route);
+ ospf6_abr_originate_summary(route, oa->ospf6);
route->flag = 0;
}
}
@@ -2045,8 +2050,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 *) = NULL;
- void (*hook_remove)(struct ospf6_route *) = NULL;
+ void (*hook_add)(struct ospf6_route *, struct ospf6 *) = NULL;
+ void (*hook_remove)(struct ospf6_route *, struct ospf6 *) = NULL;
uint32_t brouter_id;
char brouter_name[16];
@@ -2104,7 +2109,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);
+ ospf6_route_add(copy, oa->ospf6->brouter_table, oa->ospf6);
if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID(brouter_id)
|| IS_OSPF6_DEBUG_ROUTE(MEMORY)) {
@@ -2190,7 +2195,8 @@ 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);
+ ospf6_route_remove(brouter, oa->ospf6->brouter_table,
+ oa->ospf6);
brouter = NULL;
} else if (CHECK_FLAG(brouter->flag, OSPF6_ROUTE_ADD)
|| CHECK_FLAG(brouter->flag, OSPF6_ROUTE_CHANGE)) {
@@ -2204,7 +2210,7 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
/* newly added */
if (hook_add)
- (*hook_add)(brouter);
+ (*hook_add)(brouter, oa->ospf6);
} else {
if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID(
brouter_id)
@@ -2213,7 +2219,7 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
zlog_info("brouter %s still exists via area %s",
brouter_name, oa->name);
/* But re-originate summaries */
- ospf6_abr_originate_summary(brouter);
+ ospf6_abr_originate_summary(brouter, oa->ospf6);
}
if (brouter) {