From efde4f25612fb3a690ed1e0ce789a490f949bb2e Mon Sep 17 00:00:00 2001 From: Sharath Ramamurthy Date: Tue, 27 Jul 2021 14:54:40 +0530 Subject: [PATCH] zebra: Refactoring changes for zebra_evpn_map_vlan zebra_evpn_from_svi and zl3vni_from_svi Today to find the vni for a given (vlan, bridge) we walk over all interfaces and filter the vxlan device associated with the bridge. With multiple vlan aware bridge changes, we can derive the vni directly by looking up the hash table i.e. the vlan_table of the associated (vlan, bridge) which would give the vni. During vrf_terminate() call zebra_l2_bridge_if_cleanup if the interface that we are removing is of type bridge. In this case, we walk over all the vlan<->access_bd association and clean them up. zebra_evpn_t is modified to record (vlan, bridge) details and the corresponding vty is modified to print the same. zevpn_bridge_if_set and zl3vni_bridge_if_set is used to set/unset the association. Signed-off-by: Sharath Ramamurthy --- zebra/interface.c | 1 + zebra/interface.h | 1 + zebra/zebra_evpn.c | 124 +++++++++++++++++++++++------------- zebra/zebra_evpn.h | 4 ++ zebra/zebra_evpn_vxlan.h | 30 +++++++++ zebra/zebra_l2.c | 9 ++- zebra/zebra_vxlan.c | 66 +++++++++++++------ zebra/zebra_vxlan_if.c | 81 ++++++++++------------- zebra/zebra_vxlan_if.h | 8 +-- zebra/zebra_vxlan_private.h | 4 ++ 10 files changed, 211 insertions(+), 117 deletions(-) diff --git a/zebra/interface.c b/zebra/interface.c index 2ec1ac1341..b3ae7cf148 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -228,6 +228,7 @@ static int if_zebra_delete_hook(struct interface *ifp) rtadv_if_fini(zebra_if); + zebra_l2_bridge_if_cleanup(ifp); zebra_evpn_if_cleanup(zebra_if); zebra_evpn_mac_ifp_del(ifp); diff --git a/zebra/interface.h b/zebra/interface.h index 0242438dc2..cc88141541 100644 --- a/zebra/interface.h +++ b/zebra/interface.h @@ -28,6 +28,7 @@ #include "bitfield.h" #include "zebra/zebra_l2.h" +#include "zebra/zebra_l2_bridge_if.h" #include "zebra/zebra_nhg_private.h" #include "zebra/zebra_router.h" #include "zebra/rtadv.h" diff --git a/zebra/zebra_evpn.c b/zebra/zebra_evpn.c index 6f2765284b..8e204cd547 100644 --- a/zebra/zebra_evpn.c +++ b/zebra/zebra_evpn.c @@ -44,6 +44,7 @@ #include "zebra/rt_netlink.h" #include "zebra/zebra_errors.h" #include "zebra/zebra_l2.h" +#include "zebra/zebra_l2_bridge_if.h" #include "zebra/zebra_ns.h" #include "zebra/zebra_vrf.h" #include "zebra/zebra_vxlan.h" @@ -117,6 +118,9 @@ void zebra_evpn_print(struct zebra_evpn *zevpn, void **ctxt) if (json == NULL) { vty_out(vty, "VNI: %u\n", zevpn->vni); vty_out(vty, " Type: %s\n", "L2"); + vty_out(vty, " Vlan: %u\n", zevpn->vid); + vty_out(vty, " Bridge: %s\n", + zevpn->bridge_if ? zevpn->bridge_if->name : "-"); vty_out(vty, " Tenant VRF: %s\n", vrf_id_to_name(zevpn->vrf_id)); } else { json_object_int_add(json, "vni", zevpn->vni); @@ -663,6 +667,7 @@ static int zebra_evpn_map_vlan_ns(struct ns *ns, void *_in_param, void **_p_zevpn) { + int found = 0; struct zebra_ns *zns = ns->info; struct route_node *rn; struct interface *br_if; @@ -670,43 +675,58 @@ static int zebra_evpn_map_vlan_ns(struct ns *ns, struct zebra_evpn *zevpn; struct interface *tmp_if = NULL; struct zebra_if *zif; - struct zebra_vxlan_vni *vni; struct zebra_from_svi_param *in_param = (struct zebra_from_svi_param *)_in_param; + vlanid_t vid; + vni_t vni_id = 0; + uint8_t bridge_vlan_aware; assert(p_zevpn && in_param); br_if = in_param->br_if; + assert(br_if); zif = in_param->zif; assert(zif); - assert(br_if); + vid = in_param->vid; + bridge_vlan_aware = in_param->bridge_vlan_aware; - /* See if this interface (or interface plus VLAN Id) maps to a VxLAN */ - /* TODO: Optimize with a hash. */ - for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) { - tmp_if = (struct interface *)rn->info; - if (!tmp_if) - continue; - zif = tmp_if->info; - if (!zif || zif->zif_type != ZEBRA_IF_VXLAN) - continue; - if (!if_is_operative(tmp_if)) - continue; - - if (zif->brslave_info.br_if != br_if) - continue; - - vni = zebra_vxlan_if_access_vlan_find( - zif, in_param->bridge_vlan_aware, in_param->vid); + if (bridge_vlan_aware) { + vni_id = zebra_l2_bridge_if_vni_find(zif, vid); + if (vni_id) + found = 1; + } else { + /* See if this interface (or interface plus VLAN Id) maps to a + * VxLAN */ + /* TODO: Optimize with a hash. */ + for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) { + tmp_if = (struct interface *)rn->info; + if (!tmp_if) + continue; + zif = tmp_if->info; + if (!zif || zif->zif_type != ZEBRA_IF_VXLAN) + continue; + if (!if_is_operative(tmp_if)) + continue; + + if (zif->brslave_info.br_if != br_if) + continue; + + vni_id = zebra_vxlan_if_access_vlan_vni_find(zif, vid, + br_if); + if (vni_id) { + found = 1; + break; + } - if (!in_param->bridge_vlan_aware || vni) { - zevpn = zebra_evpn_lookup(vni->vni); - *p_zevpn = zevpn; - return NS_WALK_STOP; } } - return NS_WALK_CONTINUE; + if (!found) + return NS_WALK_CONTINUE; + + zevpn = zebra_evpn_lookup(vni_id); + *p_zevpn = zevpn; + return NS_WALK_STOP; } /* @@ -747,35 +767,51 @@ static int zebra_evpn_from_svi_ns(struct ns *ns, struct zebra_evpn *zevpn; struct interface *tmp_if = NULL; struct zebra_if *zif; - struct zebra_vxlan_vni *vni; + struct zebra_if *br_zif; + struct zebra_l2_bridge_vlan *bvlan; struct zebra_from_svi_param *in_param = (struct zebra_from_svi_param *)_in_param; int found = 0; + vni_t vni_id = 0; + vlanid_t vid = 0; + uint8_t bridge_vlan_aware; if (!in_param) return NS_WALK_STOP; + br_if = in_param->br_if; zif = in_param->zif; assert(zif); - - /* TODO: Optimize with a hash. */ - for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) { - tmp_if = (struct interface *)rn->info; - if (!tmp_if) - continue; - zif = tmp_if->info; - if (!zif || zif->zif_type != ZEBRA_IF_VXLAN) - continue; - if (!if_is_operative(tmp_if)) - continue; - - if (zif->brslave_info.br_if != br_if) - continue; - - vni = zebra_vxlan_if_access_vlan_find( - zif, in_param->bridge_vlan_aware, in_param->vid); - if (!in_param->bridge_vlan_aware || vni) { + bridge_vlan_aware = in_param->bridge_vlan_aware; + vid = in_param->vid; + br_zif = br_if->info; + assert(br_zif); + + if (bridge_vlan_aware) { + bvlan = zebra_l2_bridge_if_vlan_find(br_zif, vid); + if (bvlan && bvlan->access_bd && bvlan->access_bd->vni) { found = 1; + vni_id = bvlan->access_bd->vni; + } + } else { + /* TODO: Optimize with a hash. */ + for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) { + tmp_if = (struct interface *)rn->info; + if (!tmp_if) + continue; + zif = tmp_if->info; + if (!zif || zif->zif_type != ZEBRA_IF_VXLAN) + continue; + if (!if_is_operative(tmp_if)) + continue; + + if (zif->brslave_info.br_if != br_if) + continue; + + vni_id = zebra_vxlan_if_access_vlan_vni_find(zif, vid, + br_if); + if (vni_id) + found = 1; break; } } @@ -783,7 +819,7 @@ static int zebra_evpn_from_svi_ns(struct ns *ns, if (!found) return NS_WALK_CONTINUE; - zevpn = zebra_evpn_lookup(vni->vni); + zevpn = zebra_evpn_lookup(vni_id); if (p_zevpn) *p_zevpn = zevpn; return NS_WALK_STOP; diff --git a/zebra/zebra_evpn.h b/zebra/zebra_evpn.h index 5dd54a117e..b07c6515b2 100644 --- a/zebra/zebra_evpn.h +++ b/zebra/zebra_evpn.h @@ -84,6 +84,10 @@ struct zebra_evpn { uint32_t flags; #define ZEVPN_READY_FOR_BGP (1 << 0) /* ready to be sent to BGP */ + /* Corresponding Bridge information */ + vlanid_t vid; + struct interface *bridge_if; + /* Flag for advertising gw macip */ uint8_t advertise_gw_macip; diff --git a/zebra/zebra_evpn_vxlan.h b/zebra/zebra_evpn_vxlan.h index 3884a1e7ea..71df08a7a7 100644 --- a/zebra/zebra_evpn_vxlan.h +++ b/zebra/zebra_evpn_vxlan.h @@ -69,3 +69,33 @@ static inline void zevpn_vxlan_if_set(struct zebra_evpn *zevpn, zebra_evpn_vxl_evpn_set(zif, zevpn, set); } + +/* EVPN<=>Bridge interface association */ +static inline void zevpn_bridge_if_set(struct zebra_evpn *zevpn, + struct interface *ifp, bool set) +{ + if (set) { + if (zevpn->bridge_if == ifp) + return; + zevpn->bridge_if = ifp; + } else { + if (!zevpn->bridge_if) + return; + zevpn->bridge_if = NULL; + } +} + +/* EVPN<=>Bridge interface association */ +static inline void zl3vni_bridge_if_set(struct zebra_l3vni *zl3vni, + struct interface *ifp, bool set) +{ + if (set) { + if (zl3vni->bridge_if == ifp) + return; + zl3vni->bridge_if = ifp; + } else { + if (!zl3vni->bridge_if) + return; + zl3vni->bridge_if = NULL; + } +} diff --git a/zebra/zebra_l2.c b/zebra/zebra_l2.c index e1de9a147a..c43fe49026 100644 --- a/zebra/zebra_l2.c +++ b/zebra/zebra_l2.c @@ -42,6 +42,7 @@ #include "zebra/rt_netlink.h" #include "zebra/interface.h" #include "zebra/zebra_l2.h" +#include "zebra/zebra_l2_bridge_if.h" #include "zebra/zebra_vxlan.h" #include "zebra/zebra_vxlan_if.h" #include "zebra/zebra_evpn_mh.h" @@ -263,12 +264,14 @@ void zebra_l2_bridge_add_update(struct interface *ifp, int add) { struct zebra_if *zif; + struct zebra_l2_bridge_if *br; zif = ifp->info; assert(zif); - /* Copy over the L2 information. */ - memcpy(&zif->l2info.br, bridge_info, sizeof(*bridge_info)); + br = BRIDGE_FROM_ZEBRA_IF(zif); + br->vlan_aware = bridge_info->bridge.vlan_aware; + zebra_l2_bridge_if_add(ifp); /* Link all slaves to this bridge */ map_slaves_to_bridge(ifp, 1, false, ZEBRA_BRIDGE_NO_ACTION); @@ -279,6 +282,8 @@ void zebra_l2_bridge_add_update(struct interface *ifp, */ void zebra_l2_bridge_del(struct interface *ifp) { + zebra_l2_bridge_if_del(ifp); + /* Unlink all slaves to this bridge */ map_slaves_to_bridge(ifp, 0, false, ZEBRA_BRIDGE_NO_ACTION); } diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index db231217b5..c3a39fc435 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -46,6 +46,7 @@ #include "zebra/rt_netlink.h" #include "zebra/zebra_errors.h" #include "zebra/zebra_l2.h" +#include "zebra/zebra_l2_bridge_if.h" #include "zebra/zebra_ns.h" #include "zebra/zebra_vrf.h" #include "zebra/zebra_vxlan.h" @@ -722,6 +723,9 @@ static void zl3vni_print(struct zebra_l3vni *zl3vni, void **ctx) vty_out(vty, "VNI: %u\n", zl3vni->vni); vty_out(vty, " Type: %s\n", "L3"); vty_out(vty, " Tenant VRF: %s\n", zl3vni_vrf_name(zl3vni)); + vty_out(vty, " Vlan: %u\n", zl3vni->vid); + vty_out(vty, " Bridge: %s\n", + zl3vni->bridge_if ? zl3vni->bridge_if->name : "-"); vty_out(vty, " Local Vtep Ip: %pI4\n", &zl3vni->local_vtep_ip); vty_out(vty, " Vxlan-Intf: %s\n", @@ -909,7 +913,9 @@ struct interface *zvni_map_to_svi(vlanid_t vid, struct interface *br_if) int zebra_evpn_vxlan_del(struct zebra_evpn *zevpn) { + zevpn->vid = 0; zevpn_vxlan_if_set(zevpn, zevpn->vxlan_if, false /* set */); + zevpn_bridge_if_set(zevpn, zevpn->bridge_if, false /* set */); /* Remove references to the BUM mcast grp */ zebra_vxlan_sg_deref(zevpn->local_vtep_ip, zevpn->mcast_grp); @@ -925,6 +931,7 @@ static int zevpn_build_vni_hash_table(struct zebra_if *zif, struct zebra_l3vni *zl3vni; struct interface *ifp; struct zebra_l2info_vxlan *vxl; + struct interface *br_if; ifp = zif->ifp; vxl = &zif->l2info.vxl; @@ -1019,9 +1026,11 @@ static int zevpn_build_vni_hash_table(struct zebra_if *zif, zebra_evpn_es_set_base_evpn(zevpn); } zevpn_vxlan_if_set(zevpn, ifp, true /* set */); - vlan_if = zvni_map_to_svi(vnip->access_vlan, - zif->brslave_info.br_if); + br_if = zif->brslave_info.br_if; + zevpn_bridge_if_set(zevpn, br_if, true /* set */); + vlan_if = zvni_map_to_svi(vnip->access_vlan, br_if); if (vlan_if) { + zevpn->vid = vnip->access_vlan; zevpn->svi_if = vlan_if; zevpn->vrf_id = vlan_if->vrf->vrf_id; zl3vni = zl3vni_from_vrf(vlan_if->vrf->vrf_id); @@ -1868,6 +1877,8 @@ struct zebra_l3vni *zl3vni_from_vrf(vrf_id_t vrf_id) static int zl3vni_from_svi_ns(struct ns *ns, void *_in_param, void **_p_zl3vni) { + int found = 0; + vni_t vni_id = 0; struct zebra_ns *zns = ns->info; struct zebra_l3vni **p_zl3vni = (struct zebra_l3vni **)_p_zl3vni; struct zebra_from_svi_param *in_param = @@ -1875,33 +1886,46 @@ static int zl3vni_from_svi_ns(struct ns *ns, void *_in_param, void **_p_zl3vni) struct route_node *rn = NULL; struct interface *tmp_if = NULL; struct zebra_if *zif = NULL; - struct zebra_vxlan_vni *vni = NULL; + struct zebra_if *br_zif = NULL; assert(in_param && p_zl3vni); - /* loop through all vxlan-interface */ - for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) { - tmp_if = (struct interface *)rn->info; - if (!tmp_if) - continue; - zif = tmp_if->info; - if (!zif || zif->zif_type != ZEBRA_IF_VXLAN) - continue; - if (!if_is_operative(tmp_if)) - continue; + br_zif = in_param->br_if->info; + assert(br_zif); - if (zif->brslave_info.br_if != in_param->br_if) - continue; + if (in_param->bridge_vlan_aware) { + vni_id = zebra_l2_bridge_if_vni_find(br_zif, in_param->vid); + if (vni_id) + found = 1; + } else { + /* loop through all vxlan-interface */ + for (rn = route_top(zns->if_table); rn; rn = route_next(rn)) { + tmp_if = (struct interface *)rn->info; + if (!tmp_if) + continue; + zif = tmp_if->info; + if (!zif || zif->zif_type != ZEBRA_IF_VXLAN) + continue; + if (!if_is_operative(tmp_if)) + continue; - vni = zebra_vxlan_if_access_vlan_find(zif, in_param->bridge_vlan_aware, - in_param->vid); - if (!in_param->bridge_vlan_aware || vni) { - *p_zl3vni = zl3vni_lookup(vni->vni); - return NS_WALK_STOP; + if (zif->brslave_info.br_if != in_param->br_if) + continue; + + vni_id = zebra_vxlan_if_access_vlan_vni_find(zif, in_param->vid, + in_param->br_if); + if (vni_id) { + found = 1; + break; + } } } - return NS_WALK_CONTINUE; + if (!found) + return NS_WALK_CONTINUE; + + *p_zl3vni = zl3vni_lookup(vni_id); + return NS_WALK_STOP; } /* diff --git a/zebra/zebra_vxlan_if.c b/zebra/zebra_vxlan_if.c index 1491b8bc5a..d4a05fcc0b 100644 --- a/zebra/zebra_vxlan_if.c +++ b/zebra/zebra_vxlan_if.c @@ -87,22 +87,6 @@ static int zebra_vxlan_if_vni_walk_callback(struct hash_bucket *bucket, return ret; } -static int zebra_vxlan_if_vni_access_vlan_find(struct zebra_if *zif, - struct zebra_vxlan_vni *vni, - void *ctxt) -{ - int ret = HASHWALK_CONTINUE; - struct zebra_vxlan_if_vlan_ctx *ctx; - - ctx = (struct zebra_vxlan_if_vlan_ctx *)ctxt; - - if (vni->access_vlan == ctx->vid) { - ctx->vni = vni; - ret = HASHWALK_ABORT; - } - return ret; -} - static void zebra_vxlan_if_vni_iterate_callback(struct hash_bucket *bucket, void *ctxt) { @@ -122,6 +106,7 @@ static int zebra_vxlan_if_del_vni(struct interface *ifp, struct zebra_if *zif; struct zebra_evpn *zevpn; struct zebra_l3vni *zl3vni; + struct interface *br_if; /* Check if EVPN is enabled. */ if (!is_evpn_enabled()) @@ -144,6 +129,9 @@ static int zebra_vxlan_if_del_vni(struct interface *ifp, /* remove the association with vxlan_if */ memset(&zl3vni->local_vtep_ip, 0, sizeof(struct in_addr)); zl3vni->vxlan_if = NULL; + zl3vni->vid = 0; + br_if = zif->brslave_info.br_if; + zl3vni_bridge_if_set(zl3vni, br_if, false /* unset */); } else { /* process if-del for l2-vni*/ @@ -195,6 +183,7 @@ static int zebra_vxlan_if_update_vni(struct interface *ifp, struct zebra_evpn *zevpn; struct zebra_l3vni *zl3vni; struct interface *vlan_if; + struct interface *br_if; /* Check if EVPN is enabled. */ if (!is_evpn_enabled()) @@ -263,6 +252,12 @@ static int zebra_vxlan_if_update_vni(struct interface *ifp, /* Update local tunnel IP. */ zl3vni->local_vtep_ip = vxl->vtep_ip; + zl3vni->vid = (zl3vni->vid != vnip->access_vlan) + ? vnip->access_vlan + : zl3vni->vid; + br_if = zif->brslave_info.br_if; + zl3vni_bridge_if_set(zl3vni, br_if, true /* set */); + /* if we have a valid new master, process l3-vni oper up */ if (chgflags & ZEBRA_VXLIF_MASTER_CHANGE) { if (if_is_operative(ifp) && is_l3vni_oper_up(zl3vni)) @@ -321,8 +316,13 @@ static int zebra_vxlan_if_update_vni(struct interface *ifp, zebra_evpn_es_set_base_evpn(zevpn); } zevpn_vxlan_if_set(zevpn, ifp, true /* set */); - vlan_if = zvni_map_to_svi(vnip->access_vlan, - zif->brslave_info.br_if); + zevpn->vid = (zevpn->vid != vnip->access_vlan) + ? vnip->access_vlan + : zevpn->vid; + br_if = zif->brslave_info.br_if; + zevpn_bridge_if_set(zevpn, br_if, true /* set */); + + vlan_if = zvni_map_to_svi(vnip->access_vlan, br_if); if (vlan_if) zevpn->svi_if = vlan_if; @@ -375,6 +375,7 @@ static int zebra_vxlan_if_add_vni(struct interface *ifp, struct zebra_l2info_vxlan *vxl; struct zebra_evpn *zevpn; struct zebra_l3vni *zl3vni; + struct interface *br_if; /* Check if EVPN is enabled. */ if (!is_evpn_enabled()) @@ -406,6 +407,10 @@ static int zebra_vxlan_if_add_vni(struct interface *ifp, zl3vni->mac_vlan_if = zl3vni_map_to_mac_vlan_if(zl3vni); + zl3vni->vid = vnip->access_vlan; + br_if = zif->brslave_info.br_if; + zl3vni_bridge_if_set(zl3vni, br_if, true /* set */); + if (is_l3vni_oper_up(zl3vni)) zebra_vxlan_process_l3vni_oper_up(zl3vni); } else { @@ -431,9 +436,11 @@ static int zebra_vxlan_if_add_vni(struct interface *ifp, zebra_evpn_es_set_base_evpn(zevpn); } zevpn_vxlan_if_set(zevpn, ifp, true /* set */); - vlan_if = zvni_map_to_svi(vnip->access_vlan, - zif->brslave_info.br_if); + br_if = zif->brslave_info.br_if; + zevpn_bridge_if_set(zevpn, br_if, true /* set */); + vlan_if = zvni_map_to_svi(vnip->access_vlan, br_if); if (vlan_if) { + zevpn->vid = vnip->access_vlan; zevpn->svi_if = vlan_if; zevpn->vrf_id = vlan_if->vrf->vrf_id; zl3vni = zl3vni_from_vrf(vlan_if->vrf->vrf_id); @@ -727,27 +734,17 @@ void zebra_vxlan_if_vni_walk(struct zebra_if *zif, hash_walk(vni_info->vni_table, zebra_vxlan_if_vni_walk_callback, &ctx); } -struct zebra_vxlan_vni *zebra_vxlan_if_access_vlan_find(struct zebra_if *zif, - uint8_t vlan_aware, - vlanid_t vid) +vni_t zebra_vxlan_if_access_vlan_vni_find(struct zebra_if *zif, vlanid_t vid, + struct interface *br_if) { struct zebra_vxlan_vni *vni = NULL; - struct zebra_vxlan_if_vlan_ctx ctx; - if (IS_ZEBRA_VXLAN_IF_VNI(zif)) { - vni = zebra_vxlan_if_vni_find(zif, 0); - if (vlan_aware && vni->access_vlan != vid) - vni = NULL; - return vni; - } - - ctx.vid = vid; - ctx.vni = NULL; - zebra_vxlan_if_vni_walk(zif, zebra_vxlan_if_vni_access_vlan_find, - (void *)&ctx); - vni = ctx.vni; + /* Expected to be called only for vlan-unware bridges */ + assert(!IS_ZEBRA_IF_BRIDGE_VLAN_AWARE((struct zebra_if *)br_if->info)); + vni = zebra_vxlan_if_vni_find(zif, 0); + assert(vni); - return vni; + return vni->vni; } int zebra_vxlan_if_vni_table_add_update(struct interface *ifp, @@ -991,10 +988,6 @@ int zebra_vxlan_if_vni_del(struct interface *ifp, vni_t vni) struct zebra_vxlan_vni vni_tmp; struct zebra_vxlan_vni_info *vni_info; - /* Check if EVPN is enabled. */ - if (!is_evpn_enabled()) - return 0; - zif = ifp->info; assert(zif); @@ -1022,10 +1015,6 @@ int zebra_vxlan_if_del(struct interface *ifp) struct zebra_if *zif; struct zebra_vxlan_vni_info *vni_info; - /* Check if EVPN is enabled. */ - if (!is_evpn_enabled()) - return 0; - zif = ifp->info; assert(zif); @@ -1098,7 +1087,7 @@ int zebra_vxlan_if_vni_add(struct interface *ifp, struct zebra_vxlan_vni *vni) /* This should be called in SVD context only */ assert(IS_ZEBRA_VXLAN_IF_SVD(zif)); - /* First inser into the table */ + /* First insert into the table */ vni_info = VNI_INFO_FROM_ZEBRA_IF(zif); hash_get(vni_info->vni_table, (void *)vni, zebra_vxlan_vni_alloc); diff --git a/zebra/zebra_vxlan_if.h b/zebra/zebra_vxlan_if.h index c70b2f8fc6..9ddd0f89cd 100644 --- a/zebra/zebra_vxlan_if.h +++ b/zebra/zebra_vxlan_if.h @@ -1,5 +1,5 @@ /* - * Zebra VxLAN (EVPN) Data structures and definitions + * Zebra VxLAN (EVPN) interface data structures and definitions * These are public definitions referenced by other files. * Copyright (C) 2021 Cumulus Networks, Inc. * Sharath Ramamurthy @@ -60,9 +60,9 @@ extern void zebra_vxlan_if_vni_walk(struct zebra_if *zif, struct zebra_vxlan_vni *, void *), void *arg); -extern struct zebra_vxlan_vni * -zebra_vxlan_if_access_vlan_find(struct zebra_if *zif, uint8_t vlan_aware, - vlanid_t vid); +extern vni_t zebra_vxlan_if_access_vlan_vni_find(struct zebra_if *zif, + vlanid_t vid, + struct interface *br_if); extern int zebra_vxlan_if_vni_mcast_group_update(struct interface *ifp, vni_t vni_id, struct in_addr *mcast_group); diff --git a/zebra/zebra_vxlan_private.h b/zebra/zebra_vxlan_private.h index 6da45b214e..4296640f78 100644 --- a/zebra/zebra_vxlan_private.h +++ b/zebra/zebra_vxlan_private.h @@ -51,6 +51,10 @@ struct zebra_l3vni { uint32_t filter; #define PREFIX_ROUTES_ONLY (1 << 0) /* l3-vni used for prefix routes only */ + /* Corresponding Bridge information */ + vlanid_t vid; + struct interface *bridge_if; + /* Local IP */ struct in_addr local_vtep_ip; -- 2.39.5