diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index e782839d17..1d33d5f4a4 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -80,6 +80,8 @@ static inline struct route_table *get_rnh_table(vrf_id_t vrfid, afi_t afi, if (zvrf) { if (safi == SAFI_UNICAST) t = zvrf->rnh_table[afi]; + else if (safi == SAFI_MULTICAST) + t = zvrf->rnh_table_multicast[afi]; } 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) { 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; 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) { 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; rib_dest_t *dest; @@ -223,7 +225,7 @@ void zebra_free_rnh(struct rnh *rnh) list_delete(&rnh->zebra_pseudowire_list); 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) { struct route_node *rern; @@ -563,7 +565,7 @@ zebra_rnh_resolve_nexthop_entry(struct zebra_vrf *zvrf, afi_t afi, *prn = NULL; - route_table = zvrf->table[afi][SAFI_UNICAST]; + route_table = zvrf->table[afi][rnh->safi]; if (!route_table) return NULL; diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index 69b586d71e..d52601b63d 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -150,6 +150,10 @@ static int zebra_vrf_enable(struct vrf *vrf) table = route_table_init(); table->cleanup = zebra_rnhtable_node_cleanup; 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. */ @@ -192,6 +196,8 @@ static int zebra_vrf_disable(struct vrf *vrf) for (afi = AFI_IP; afi <= AFI_IP6; afi++) { route_table_finish(zvrf->rnh_table[afi]); 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++) rib_close_table(zvrf->table[afi][safi]); @@ -292,6 +298,8 @@ static int zebra_vrf_delete(struct vrf *vrf) if (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); diff --git a/zebra/zebra_vrf.h b/zebra/zebra_vrf.h index e6126a22ca..5afa655203 100644 --- a/zebra/zebra_vrf.h +++ b/zebra/zebra_vrf.h @@ -78,6 +78,7 @@ struct zebra_vrf { /* Recursive Nexthop table */ struct route_table *rnh_table[AFI_MAX]; + struct route_table *rnh_table_multicast[AFI_MAX]; struct otable_head other_tables;