]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Handle vni determination for non-vlan-aware bridges
authorSharath Ramamurthy <sramamurthy@nvidia.com>
Tue, 27 Jul 2021 16:20:47 +0000 (21:50 +0530)
committerStephen Worley <sworley@nvidia.com>
Mon, 13 Feb 2023 23:12:04 +0000 (18:12 -0500)
This patch addresses following

- Remove unused VLAN Id parameter when trying to determine the VNI associated
  with a non-VLAN aware bridge. Also, add a check to ensure that in this case,
  we have a per-VNI VXLAN interface. Due to sequence of events, it is possible
  that we may have VLAN-VNI mappings, in which case the code should return
  gracefully.

- With support for a container VXLAN interface that has VLAN-VNI mappings,
  the VXLAN interface itself may be up but a particular VNI might have
  been removed. Ensure that VNI mapping exists before proceeding with
  further processing.

Signed-off-by: Sharath Ramamurthy <sramamurthy@nvidia.com>
zebra/zebra_evpn.c
zebra/zebra_evpn_mh.c
zebra/zebra_vxlan.c
zebra/zebra_vxlan_if.c
zebra/zebra_vxlan_if.h

index 8e204cd547b047a6e82bef56cd780ee26fde91d8..214f34c58e01354712d6e979c244540a5d80f129 100644 (file)
@@ -711,13 +711,12 @@ static int zebra_evpn_map_vlan_ns(struct ns *ns,
                        if (zif->brslave_info.br_if != br_if)
                                continue;
 
-                       vni_id = zebra_vxlan_if_access_vlan_vni_find(zif, vid,
-                                                                    br_if);
+                       vni_id =
+                               zebra_vxlan_if_access_vlan_vni_find(zif, br_if);
                        if (vni_id) {
                                found = 1;
                                break;
                        }
-
                }
        }
 
@@ -808,11 +807,12 @@ static int zebra_evpn_from_svi_ns(struct ns *ns,
                        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)
+                       vni_id =
+                               zebra_vxlan_if_access_vlan_vni_find(zif, br_if);
+                       if (vni_id) {
                                found = 1;
-                       break;
+                               break;
+                       }
                }
        }
 
index 4bba98c5a02d3d9affd3907ef9fadf9d168fb0f6..adb1d229c19ca687086614ebdfe798f64af8f721 100644 (file)
@@ -500,11 +500,14 @@ void zebra_evpn_update_all_es(struct zebra_evpn *zevpn)
                if (if_is_operative(vxlan_if)
                    && vxlan_zif->brslave_info.br_if) {
                        vni = zebra_vxlan_if_vni_find(vxlan_zif, zevpn->vni);
-                       vlan_if =
-                               zvni_map_to_svi(vni->access_vlan,
-                                               vxlan_zif->brslave_info.br_if);
-                       if (vlan_if)
-                               zebra_evpn_acc_bd_svi_mac_add(vlan_if);
+                       /* VLAN-VNI mappings may not exist */
+                       if (vni) {
+                               vlan_if = zvni_map_to_svi(
+                                       vni->access_vlan,
+                                       vxlan_zif->brslave_info.br_if);
+                               if (vlan_if)
+                                       zebra_evpn_acc_bd_svi_mac_add(vlan_if);
+                       }
                }
        }
 }
index c3a39fc435141b61d35823463afcd2fb30eb3221..9101dbe6a324bb3612c8590337785bf4cd1ad008 100644 (file)
@@ -1912,8 +1912,8 @@ static int zl3vni_from_svi_ns(struct ns *ns, void *_in_param, void **_p_zl3vni)
                        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);
+                       vni_id = zebra_vxlan_if_access_vlan_vni_find(
+                                       zif, in_param->br_if);
                        if (vni_id) {
                                found = 1;
                                break;
index ce27cfb41201a5d3e262a7585288b44625ea9887..78a04372dc40249b079fe3a618430fb7ba151a52 100644 (file)
@@ -655,6 +655,7 @@ struct zebra_vxlan_vni *zebra_vxlan_if_vni_find(const struct zebra_if *zif,
                return vnip;
        }
 
+       /* For SVD, the VNI value is a required parameter. */
        assert(vni);
 
        memset(&vni_tmp, 0, sizeof(vni_tmp));
@@ -716,13 +717,17 @@ void zebra_vxlan_if_vni_walk(struct zebra_if *zif,
        hash_walk(vni_info->vni_table, zebra_vxlan_if_vni_walk_callback, &ctx);
 }
 
-vni_t zebra_vxlan_if_access_vlan_vni_find(struct zebra_if *zif, vlanid_t vid,
+vni_t zebra_vxlan_if_access_vlan_vni_find(struct zebra_if *zif,
                                          struct interface *br_if)
 {
        struct zebra_vxlan_vni *vni = NULL;
 
-       /* Expected to be called only for vlan-unware bridges */
-       assert(!IS_ZEBRA_IF_BRIDGE_VLAN_AWARE((struct zebra_if *)br_if->info));
+       /* Expected to be called only for vlan-unware bridges. In this case,
+        * we only support a per-VNI VXLAN interface model.
+        */
+       if (!IS_ZEBRA_VXLAN_IF_VNI(zif))
+               return 0;
+
        vni = zebra_vxlan_if_vni_find(zif, 0);
        assert(vni);
 
index 9ddd0f89cdee60afeba308e4282ceb30e7b1a259..a09e3dbe8cb1bbd2c62b59dd8abed2c653f4376f 100644 (file)
@@ -61,7 +61,6 @@ extern void zebra_vxlan_if_vni_walk(struct zebra_if *zif,
                                                void *),
                                    void *arg);
 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,