zebra: Create the SAFI_MULTICAST rnh tables

Actually create the SAFI_MULTICAST rnh tables.  No code
uses these yet.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2021-09-24 16:42:25 -04:00
parent d597533a9d
commit a4598b97d9
3 changed files with 15 additions and 4 deletions

View File

@ -80,6 +80,8 @@ static inline struct route_table *get_rnh_table(vrf_id_t vrfid, afi_t afi,
if (zvrf) { if (zvrf) {
if (safi == SAFI_UNICAST) if (safi == SAFI_UNICAST)
t = zvrf->rnh_table[afi]; t = zvrf->rnh_table[afi];
else if (safi == SAFI_MULTICAST)
t = zvrf->rnh_table_multicast[afi];
} }
return t; return t;
@ -88,7 +90,7 @@ static inline struct route_table *get_rnh_table(vrf_id_t vrfid, afi_t afi,
static void zebra_rnh_remove_from_routing_table(struct rnh *rnh) static void zebra_rnh_remove_from_routing_table(struct rnh *rnh)
{ {
struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(rnh->vrf_id); struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(rnh->vrf_id);
struct route_table *table = zvrf->table[rnh->afi][SAFI_UNICAST]; struct route_table *table = zvrf->table[rnh->afi][rnh->safi];
struct route_node *rn; struct route_node *rn;
rib_dest_t *dest; rib_dest_t *dest;
@ -112,7 +114,7 @@ static void zebra_rnh_remove_from_routing_table(struct rnh *rnh)
static void zebra_rnh_store_in_routing_table(struct rnh *rnh) static void zebra_rnh_store_in_routing_table(struct rnh *rnh)
{ {
struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(rnh->vrf_id); struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(rnh->vrf_id);
struct route_table *table = zvrf->table[rnh->afi][SAFI_UNICAST]; struct route_table *table = zvrf->table[rnh->afi][rnh->safi];
struct route_node *rn; struct route_node *rn;
rib_dest_t *dest; rib_dest_t *dest;
@ -223,7 +225,7 @@ void zebra_free_rnh(struct rnh *rnh)
list_delete(&rnh->zebra_pseudowire_list); list_delete(&rnh->zebra_pseudowire_list);
zvrf = zebra_vrf_lookup_by_id(rnh->vrf_id); zvrf = zebra_vrf_lookup_by_id(rnh->vrf_id);
table = zvrf->table[family2afi(rnh->resolved_route.family)][SAFI_UNICAST]; table = zvrf->table[family2afi(rnh->resolved_route.family)][rnh->safi];
if (table) { if (table) {
struct route_node *rern; struct route_node *rern;
@ -563,7 +565,7 @@ zebra_rnh_resolve_nexthop_entry(struct zebra_vrf *zvrf, afi_t afi,
*prn = NULL; *prn = NULL;
route_table = zvrf->table[afi][SAFI_UNICAST]; route_table = zvrf->table[afi][rnh->safi];
if (!route_table) if (!route_table)
return NULL; return NULL;

View File

@ -150,6 +150,10 @@ static int zebra_vrf_enable(struct vrf *vrf)
table = route_table_init(); table = route_table_init();
table->cleanup = zebra_rnhtable_node_cleanup; table->cleanup = zebra_rnhtable_node_cleanup;
zvrf->rnh_table[afi] = table; zvrf->rnh_table[afi] = table;
table = route_table_init();
table->cleanup = zebra_rnhtable_node_cleanup;
zvrf->rnh_table_multicast[afi] = table;
} }
/* Kick off any VxLAN-EVPN processing. */ /* Kick off any VxLAN-EVPN processing. */
@ -192,6 +196,8 @@ static int zebra_vrf_disable(struct vrf *vrf)
for (afi = AFI_IP; afi <= AFI_IP6; afi++) { for (afi = AFI_IP; afi <= AFI_IP6; afi++) {
route_table_finish(zvrf->rnh_table[afi]); route_table_finish(zvrf->rnh_table[afi]);
zvrf->rnh_table[afi] = NULL; zvrf->rnh_table[afi] = NULL;
route_table_finish(zvrf->rnh_table_multicast[afi]);
zvrf->rnh_table_multicast[afi] = NULL;
for (safi = SAFI_UNICAST; safi <= SAFI_MULTICAST; safi++) for (safi = SAFI_UNICAST; safi <= SAFI_MULTICAST; safi++)
rib_close_table(zvrf->table[afi][safi]); rib_close_table(zvrf->table[afi][safi]);
@ -292,6 +298,8 @@ static int zebra_vrf_delete(struct vrf *vrf)
if (zvrf->rnh_table[afi]) if (zvrf->rnh_table[afi])
route_table_finish(zvrf->rnh_table[afi]); route_table_finish(zvrf->rnh_table[afi]);
if (zvrf->rnh_table_multicast[afi])
route_table_finish(zvrf->rnh_table[afi]);
} }
otable = otable_pop(&zvrf->other_tables); otable = otable_pop(&zvrf->other_tables);

View File

@ -78,6 +78,7 @@ struct zebra_vrf {
/* Recursive Nexthop table */ /* Recursive Nexthop table */
struct route_table *rnh_table[AFI_MAX]; struct route_table *rnh_table[AFI_MAX];
struct route_table *rnh_table_multicast[AFI_MAX];
struct otable_head other_tables; struct otable_head other_tables;