From: anlan_cs Date: Fri, 26 Aug 2022 10:53:03 +0000 (-0400) Subject: zebra: fix missing vni transition X-Git-Tag: docker/8.3.1~1^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=8ca2682ae8c155e18fe95438be8b702c31c1fa5f;p=mirror%2Ffrr.git zebra: fix missing vni transition `show evpn vni detail` doesn't reflect any change in vni transition. Need to add processing in command of `[no] vni (1-16777215)`. With the config: ``` ! vni 66 ! vrf vrf1 vni 88 exit-vrf ! ``` Before: ``` (config-vrf)# no vni 88 (config-vrf)# do show evpn vni detail VNI: 66 Type: L3 Tenant VRF: default L2 VNIs: <- Empty ``` After: ``` (config-vrf)# no vni 88 (config-vrf)# do show evpn vni detail VNI: 66 Type: L3 Tenant VRF: default L2 VNIs: 88 <- ``` Signed-off-by: anlan_cs (cherry picked from commit df78d91d8aab3bdb5b7fc8db6c451aa1d9be7b78) --- diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 4d8cfd3e0c..22edba9817 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -2090,6 +2090,7 @@ static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf, vni_t vni, int add) { struct zebra_evpn *zevpn = NULL; + struct zebra_l3vni *zl3vni = NULL; /* There is a possibility that VNI notification was already received * from kernel and we programmed it as L2-VNI @@ -2117,6 +2118,10 @@ static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf, vni_t vni, /* Free up all remote VTEPs, if any. */ zebra_evpn_vtep_del_all(zevpn, 1); + zl3vni = zl3vni_from_vrf(zevpn->vrf_id); + if (zl3vni) + listnode_delete(zl3vni->l2vnis, zevpn); + /* Delete the hash entry. */ if (zebra_evpn_vxlan_del(zevpn)) { flog_err(EC_ZEBRA_VNI_DEL_FAILED, @@ -2172,8 +2177,12 @@ static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf, vni_t vni, /* Find bridge interface for the VNI */ vlan_if = zvni_map_to_svi(vxl->access_vlan, zif->brslave_info.br_if); - if (vlan_if) + 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); + } zevpn->vxlan_if = ifp; zevpn->local_vtep_ip = vxl->vtep_ip;