From 9d59df634c02c9554e65738940858041ff826a68 Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Wed, 14 Jul 2021 11:33:11 -0400 Subject: [PATCH] zebra: add new dplane op codes for interface addr events Add new dplane op values for incoming interface address add and delete events. Signed-off-by: Mark Stapp --- zebra/kernel_netlink.c | 2 ++ zebra/zebra_dplane.c | 21 +++++++++++++++++++++ zebra/zebra_dplane.h | 6 +++++- zebra/zebra_nhg.c | 2 ++ zebra/zebra_rib.c | 2 ++ 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index e645ae0ffd..f50fd74ac1 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -1360,6 +1360,8 @@ static enum netlink_msg_status nl_put_msg(struct nl_batch *bth, case DPLANE_OP_GRE_SET: return netlink_put_gre_set_msg(bth, ctx); + case DPLANE_OP_INTF_ADDR_ADD: + case DPLANE_OP_INTF_ADDR_DEL: case DPLANE_OP_NONE: return FRR_NETLINK_ERROR; } diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index e1faf9173e..ed374fa73c 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -690,6 +690,8 @@ static void dplane_ctx_free_internal(struct zebra_dplane_ctx *ctx) case DPLANE_OP_ADDR_INSTALL: case DPLANE_OP_ADDR_UNINSTALL: + case DPLANE_OP_INTF_ADDR_ADD: + case DPLANE_OP_INTF_ADDR_DEL: /* Maybe free label string, if allocated */ if (ctx->u.intf.label != NULL && ctx->u.intf.label != ctx->u.intf.label_buf) { @@ -1011,6 +1013,12 @@ const char *dplane_op2str(enum dplane_op_e op) case DPLANE_OP_GRE_SET: ret = "GRE_SET"; break; + + case DPLANE_OP_INTF_ADDR_ADD: + return "INTF_ADDR_ADD"; + + case DPLANE_OP_INTF_ADDR_DEL: + return "INTF_ADDR_DEL"; } return ret; @@ -4970,6 +4978,14 @@ static void kernel_dplane_log_detail(struct zebra_dplane_ctx *ctx) dplane_ctx_get_ifname(ctx), ctx->u.gre.link_ifindex); break; + + case DPLANE_OP_INTF_ADDR_ADD: + case DPLANE_OP_INTF_ADDR_DEL: + zlog_debug("Dplane incoming op %s, intf %s, addr %pFX", + dplane_op2str(dplane_ctx_get_op(ctx)), + dplane_ctx_get_ifname(ctx), + dplane_ctx_get_intf_addr(ctx)); + break; } } @@ -5112,6 +5128,11 @@ static void kernel_dplane_handle_result(struct zebra_dplane_ctx *ctx) case DPLANE_OP_BR_PORT_UPDATE: break; + /* TODO -- error counters for incoming events? */ + case DPLANE_OP_INTF_ADDR_ADD: + case DPLANE_OP_INTF_ADDR_DEL: + break; + case DPLANE_OP_NONE: if (res != ZEBRA_DPLANE_REQUEST_SUCCESS) atomic_fetch_add_explicit(&zdplane_info.dg_other_errors, diff --git a/zebra/zebra_dplane.h b/zebra/zebra_dplane.h index 3408634055..a23de61c80 100644 --- a/zebra/zebra_dplane.h +++ b/zebra/zebra_dplane.h @@ -104,7 +104,7 @@ enum zebra_dplane_result { */ /* - * Enqueue a route install or update for the dataplane. + * Operations that the dataplane can process. */ enum dplane_op_e { DPLANE_OP_NONE = 0, @@ -178,6 +178,10 @@ enum dplane_op_e { DPLANE_OP_NEIGH_TABLE_UPDATE, DPLANE_OP_GRE_SET, + + /* Incoming interface address events */ + DPLANE_OP_INTF_ADDR_ADD, + DPLANE_OP_INTF_ADDR_DEL, }; /* diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index ce11264383..c916c9a12f 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -2979,6 +2979,8 @@ void zebra_nhg_dplane_result(struct zebra_dplane_ctx *ctx) case DPLANE_OP_IPSET_ENTRY_DELETE: case DPLANE_OP_NEIGH_TABLE_UPDATE: case DPLANE_OP_GRE_SET: + case DPLANE_OP_INTF_ADDR_ADD: + case DPLANE_OP_INTF_ADDR_DEL: break; } diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 1fb4e5e6fc..76327fbc60 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -4223,6 +4223,8 @@ static int rib_process_dplane_results(struct thread *thread) case DPLANE_OP_BR_PORT_UPDATE: case DPLANE_OP_NEIGH_TABLE_UPDATE: case DPLANE_OP_GRE_SET: + case DPLANE_OP_INTF_ADDR_ADD: + case DPLANE_OP_INTF_ADDR_DEL: case DPLANE_OP_NONE: /* Don't expect this: just return the struct? */ dplane_ctx_fini(&ctx); -- 2.39.5