]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: fix missing vni transition 11881/head
authoranlan_cs <vic.lan@pica8.com>
Fri, 26 Aug 2022 10:53:03 +0000 (06:53 -0400)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 30 Aug 2022 15:13:54 +0000 (15:13 +0000)
`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 <vic.lan@pica8.com>
(cherry picked from commit df78d91d8aab3bdb5b7fc8db6c451aa1d9be7b78)

zebra/zebra_vxlan.c

index 4d8cfd3e0c20f7c88c09c636950a346e9be7549e..22edba981717ff08eabe7d96b185b544ab003640 100644 (file)
@@ -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;