]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: set zd_is_update in 1 spot
authorDonald Sharp <sharpd@nvidia.com>
Wed, 10 Nov 2021 20:09:37 +0000 (15:09 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Fri, 4 Feb 2022 20:33:58 +0000 (15:33 -0500)
The ctx->zd_is_update is being set in various
spots based upon the same value that we are
passing into dplane_ctx_ns_init.  Let's just
consolidate all this into the dplane_ctx_ns_init
so that the zd_is_udpate value is set at the
same time that we increment the sequence numbers
to use.

As a note for future me's reading this.  The sequence
number choosen for the seq number passed to the
kernel is that each context gets a copy of the
appropriate nlsock to use.  Since it's a copy
at a point in time, we know we have a unique sequence
number value.

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

index bf34fb54a92740a6e43ed14df0d65d0e89a0fd39..96a606af9834368181df013bea36e32caf734953 100644 (file)
@@ -2296,6 +2296,8 @@ static int dplane_ctx_ns_init(struct zebra_dplane_ctx *ctx,
 {
        dplane_info_from_zns(&(ctx->zd_ns_info), zns);
 
+       ctx->zd_is_update = is_update;
+
 #if defined(HAVE_NETLINK)
        /* Increment message counter after copying to context struct - may need
         * two messages in some 'update' cases.
@@ -2514,7 +2516,6 @@ int dplane_ctx_nexthop_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op,
         * it probably won't require two messages
         */
        dplane_ctx_ns_init(ctx, zns, (op == DPLANE_OP_NH_UPDATE));
-       ctx->zd_is_update = (op == DPLANE_OP_NH_UPDATE);
 
        ret = AOK;
 
@@ -2537,7 +2538,6 @@ int dplane_ctx_lsp_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op,
        /* Capture namespace info */
        dplane_ctx_ns_init(ctx, zebra_ns_lookup(NS_DEFAULT),
                           (op == DPLANE_OP_LSP_UPDATE));
-       ctx->zd_is_update = (op == DPLANE_OP_LSP_UPDATE);
 
        memset(&ctx->u.lsp, 0, sizeof(ctx->u.lsp));
 
@@ -2813,7 +2813,6 @@ static int dplane_ctx_rule_init(struct zebra_dplane_ctx *ctx,
 
        dplane_ctx_ns_init(ctx, zebra_ns_lookup(NS_DEFAULT),
                           op == DPLANE_OP_RULE_UPDATE);
-       ctx->zd_is_update = (op == DPLANE_OP_RULE_UPDATE);
 
        ctx->zd_vrf_id = new_rule->vrf_id;
        strlcpy(ctx->zd_ifname, new_rule->ifname, sizeof(ctx->zd_ifname));
@@ -2859,7 +2858,6 @@ static int dplane_ctx_iptable_init(struct zebra_dplane_ctx *ctx,
        ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
 
        dplane_ctx_ns_init(ctx, zebra_ns_lookup(NS_DEFAULT), false);
-       ctx->zd_is_update = false;
 
        ctx->zd_vrf_id = iptable->vrf_id;
        memcpy(&ctx->u.iptable, iptable, sizeof(struct zebra_pbr_iptable));
@@ -2899,7 +2897,6 @@ static int dplane_ctx_ipset_init(struct zebra_dplane_ctx *ctx,
        ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
 
        dplane_ctx_ns_init(ctx, zebra_ns_lookup(NS_DEFAULT), false);
-       ctx->zd_is_update = false;
 
        ctx->zd_vrf_id = ipset->vrf_id;
 
@@ -2934,7 +2931,6 @@ dplane_ctx_ipset_entry_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op,
        ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
 
        dplane_ctx_ns_init(ctx, zebra_ns_lookup(NS_DEFAULT), false);
-       ctx->zd_is_update = false;
 
        ctx->zd_vrf_id = ipset->vrf_id;
 
@@ -3015,7 +3011,6 @@ dplane_route_update_internal(struct route_node *rn,
                 */
                if ((op == DPLANE_OP_ROUTE_UPDATE) &&
                    old_re && (old_re != re)) {
-                       ctx->zd_is_update = true;
 
                        old_re->dplane_sequence =
                                zebra_router_get_next_sequence();