From 3230a4dba5f3ee7dfe0d8d12f23b212c62215faa Mon Sep 17 00:00:00 2001 From: Stephen Worley Date: Tue, 23 Apr 2019 10:24:58 -0400 Subject: [PATCH] zebra: Check for nh group support in dplane ctx Only queue a nexthop object update if the dataplane supports nexthop objects. Otherwise, mark it as a success since we should only me sending them to the kernel if we think they are valid anywyay. Signed-off-by: Stephen Worley --- zebra/zebra_dplane.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index d3e10bbb5d..f818ed5bc6 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -1593,6 +1593,11 @@ static int dplane_ctx_nexthop_init(struct zebra_dplane_ctx *ctx, structs */ zns = ((struct zebra_vrf *)vrf_info_lookup(nhe->vrf_id))->zns; + if (!zns->supports_nh) { + ret = EOPNOTSUPP; + goto done; + } + // TODO: Might not need to mark this as an update, since // it probably won't require two messages dplane_ctx_ns_init(ctx, zns, (op == DPLANE_OP_NH_UPDATE)); @@ -1885,8 +1890,12 @@ done: if (ret == AOK) result = ZEBRA_DPLANE_REQUEST_QUEUED; else { - atomic_fetch_add_explicit(&zdplane_info.dg_nexthop_errors, 1, - memory_order_relaxed); + if (ret == EOPNOTSUPP) + result = ZEBRA_DPLANE_REQUEST_SUCCESS; + else + atomic_fetch_add_explicit( + &zdplane_info.dg_nexthop_errors, 1, + memory_order_relaxed); if (ctx) dplane_ctx_free(&ctx); } -- 2.39.5