]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Fix crashes in interface change 14223/head
authorDonald Sharp <sharpd@nvidia.com>
Mon, 14 Aug 2023 19:06:30 +0000 (15:06 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 17 Aug 2023 13:43:06 +0000 (09:43 -0400)
Upon some internal testing some crashes were found.  This fixes
the several crashes and normalizes the code to be closer in
it's execution pre and post changes to use the data plane.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/if_netlink.c
zebra/interface.c
zebra/zebra_dplane.c
zebra/zebra_dplane.h
zebra/zebra_l2.c

index 8767b2622c12e6b309c83d24f6b25f06eeaa8b78..ca0a354afdc0c7d2c452a24077b7ba8d92cd8b46 100644 (file)
@@ -635,8 +635,10 @@ static int netlink_bridge_vxlan_update(struct zebra_dplane_ctx *ctx,
        struct bridge_vlan_info *vinfo;
        struct zebra_dplane_bridge_vlan_info bvinfo;
 
-       if (!af_spec)
+       if (!af_spec) {
+               dplane_ctx_set_ifp_no_afspec(ctx);
                return 0;
+       }
 
        netlink_bridge_vxlan_vlan_vni_map_update(ctx, af_spec);
 
@@ -644,8 +646,10 @@ static int netlink_bridge_vxlan_update(struct zebra_dplane_ctx *ctx,
         * only 1 access VLAN is accepted.
         */
        netlink_parse_rtattr_nested(aftb, IFLA_BRIDGE_MAX, af_spec);
-       if (!aftb[IFLA_BRIDGE_VLAN_INFO])
+       if (!aftb[IFLA_BRIDGE_VLAN_INFO]) {
+               dplane_ctx_set_ifp_no_bridge_vlan_info(ctx);
                return 0;
+       }
 
        vinfo = RTA_DATA(aftb[IFLA_BRIDGE_VLAN_INFO]);
        bvinfo.flags = vinfo->flags;
index ab2b7d2446bb2aabd5e8a60226b13ba05c3fcad0..2157680d589659fca8874344b59745f0762b7fc6 100644 (file)
@@ -1848,9 +1848,15 @@ static void interface_bridge_vxlan_update(struct zebra_dplane_ctx *ctx,
        struct zebra_if *zif = ifp->info;
        const struct zebra_dplane_bridge_vlan_info *bvinfo;
 
+       if (dplane_ctx_get_ifp_no_afspec(ctx))
+               return;
+
        if (IS_ZEBRA_VXLAN_IF_SVD(zif))
                interface_bridge_vxlan_vlan_vni_map_update(ctx, ifp);
 
+       if (dplane_ctx_get_ifp_no_bridge_vlan_info(ctx))
+               return;
+
        bvinfo = dplane_ctx_get_ifp_bridge_vlan_info(ctx);
 
        if (!(bvinfo->flags & DPLANE_BRIDGE_VLAN_INFO_PVID))
index e527d93610f3e09738914a8d6eaa39c722055adb..7b2f6430804f0ad643a00c88b2f73c054e7d2a7b 100644 (file)
@@ -197,6 +197,8 @@ struct dplane_intf_info {
        bool startup;
        uint8_t family;
        struct zebra_vxlan_vni_array *vniarray;
+       bool no_bvinfo_avail;
+       bool no_afspec_avail;
        struct zebra_dplane_bridge_vlan_info bvinfo;
        struct zebra_dplane_bridge_vlan_info_array *bvarray;
 
@@ -1355,6 +1357,34 @@ dplane_ctx_get_ifp_vxlan_vni_array(const struct zebra_dplane_ctx *ctx)
        return ctx->u.intf.vniarray;
 }
 
+void dplane_ctx_set_ifp_no_afspec(struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.no_afspec_avail = true;
+}
+
+bool dplane_ctx_get_ifp_no_afspec(const struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.no_afspec_avail;
+}
+
+void dplane_ctx_set_ifp_no_bridge_vlan_info(struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       ctx->u.intf.no_bvinfo_avail = true;
+}
+
+bool dplane_ctx_get_ifp_no_bridge_vlan_info(struct zebra_dplane_ctx *ctx)
+{
+       DPLANE_CTX_VALID(ctx);
+
+       return ctx->u.intf.no_bvinfo_avail;
+}
+
 void dplane_ctx_set_ifp_bridge_vlan_info(
        struct zebra_dplane_ctx *ctx,
        struct zebra_dplane_bridge_vlan_info *bvinfo)
index 79248a4ae45e025d3a1f3545f21ce811be5a788c..c006522e01770c3f8aebc6531bacd9c2fc01e5d0 100644 (file)
@@ -429,6 +429,10 @@ struct zebra_dplane_bridge_vlan_info {
        uint16_t flags;
        uint16_t vid;
 };
+void dplane_ctx_set_ifp_no_afspec(struct zebra_dplane_ctx *ctx);
+bool dplane_ctx_get_ifp_no_afspec(const struct zebra_dplane_ctx *ctx);
+void dplane_ctx_set_ifp_no_bridge_vlan_info(struct zebra_dplane_ctx *ctx);
+bool dplane_ctx_get_ifp_no_bridge_vlan_info(struct zebra_dplane_ctx *ctx);
 void dplane_ctx_set_ifp_bridge_vlan_info(
        struct zebra_dplane_ctx *ctx,
        struct zebra_dplane_bridge_vlan_info *bvinfo);
index 39c1319f31558bcc811f195310ddeeccdaf01e6a..4f7a1cd4ceadf2ce49e10cc4775595624301dc0c 100644 (file)
@@ -383,7 +383,8 @@ void zebra_l2_vxlanif_update_access_vlan(struct interface *ifp,
        assert(zif);
 
        /* This would be called only in non svd case */
-       assert(IS_ZEBRA_VXLAN_IF_VNI(zif));
+       if (!IS_ZEBRA_VXLAN_IF_VNI(zif))
+               return;
 
        old_access_vlan = zif->l2info.vxl.vni_info.vni.access_vlan;
        ;