From c4992a2f7177b1747321921f7bec3fe79a146e52 Mon Sep 17 00:00:00 2001 From: anlan_cs Date: Thu, 31 Mar 2022 02:19:55 -0400 Subject: [PATCH] zebra: fix missing vrf change of l2vni on vxlan interface The bounded vrf of `l2vni/zevpn` have wrong relation with the order in which vxlan interface and svi interface are set. If set vxlan interface with vlanid first, then set svi interface with vrf, it is ok that vxlan interface will get correct `vrf` inherited from svi. But reverse the set sequence (i.e. set svi first, then vxlan), vxlan interface can't get correct `vrf`, becasue the handling of `ZEBRA_VXLIF_VLAN_CHANGE` missed inheritting `vrf` by mistake. ``` host# do show evpn vni 101 VNI: 101 Type: L2 Tenant VRF: vrf1 ``` So update `vrf` ("Tenant VRF") of l2vni in `zebra_vxlan_if_update()`. Signed-off-by: anlan_cs --- zebra/zebra_vxlan.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 13e1f63457..004c89bfa7 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -5130,8 +5130,13 @@ int zebra_vxlan_if_update(struct interface *ifp, uint16_t chgflags) zevpn_vxlan_if_set(zevpn, ifp, true /* set */); vlan_if = zvni_map_to_svi(vxl->access_vlan, zif->brslave_info.br_if); - if (vlan_if) + if (vlan_if) { zevpn->svi_if = vlan_if; + zevpn->vrf_id = vlan_if->vrf->vrf_id; + zl3vni = zl3vni_from_vrf(vlan_if->vrf->vrf_id); + if (zl3vni) + listnode_add_sort_nodup(zl3vni->l2vnis, zevpn); + } /* Take further actions needed. * Note that if we are here, there is a change of interest. -- 2.39.5