From: Mark Stapp Date: Tue, 2 Apr 2019 16:25:33 +0000 (-0400) Subject: zebra: add source plugin info to dplane context X-Git-Tag: base_7.2~300^2~6 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=0024a559c81072f8877643af32dd42cbb6c68530;p=matthieu%2Ffrr.git zebra: add source plugin info to dplane context Some updates may be the result of a plugin's actions - such as an async notification. Add accessor so that we can identify that an update was generated by a plugin. Signed-off-by: Mark Stapp --- diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index a13fc28d7d..a98a1bce79 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -172,6 +172,11 @@ struct zebra_dplane_ctx { uint32_t zd_seq; uint32_t zd_old_seq; + /* Some updates may be generated by notifications: allow the + * plugin to notice and ignore results from its own notifications. + */ + uint32_t zd_notif_provider; + /* TODO -- internal/sub-operation status? */ enum zebra_dplane_result zd_remote_status; enum zebra_dplane_result zd_kernel_status; @@ -710,6 +715,20 @@ vrf_id_t dplane_ctx_get_vrf(const struct zebra_dplane_ctx *ctx) return ctx->zd_vrf_id; } +bool dplane_ctx_is_from_notif(const struct zebra_dplane_ctx *ctx) +{ + DPLANE_CTX_VALID(ctx); + + return (ctx->zd_notif_provider != 0); +} + +uint32_t dplane_ctx_get_notif_provider(const struct zebra_dplane_ctx *ctx) +{ + DPLANE_CTX_VALID(ctx); + + return ctx->zd_notif_provider; +} + void dplane_ctx_set_type(struct zebra_dplane_ctx *ctx, int type) { DPLANE_CTX_VALID(ctx); diff --git a/zebra/zebra_dplane.h b/zebra/zebra_dplane.h index 0a487e0712..75b7748cb8 100644 --- a/zebra/zebra_dplane.h +++ b/zebra/zebra_dplane.h @@ -201,6 +201,9 @@ uint32_t dplane_ctx_get_old_seq(const struct zebra_dplane_ctx *ctx); void dplane_ctx_set_vrf(struct zebra_dplane_ctx *ctx, vrf_id_t vrf); vrf_id_t dplane_ctx_get_vrf(const struct zebra_dplane_ctx *ctx); +bool dplane_ctx_is_from_notif(const struct zebra_dplane_ctx *ctx); +uint32_t dplane_ctx_get_notif_provider(const struct zebra_dplane_ctx *ctx); + /* Accessors for route update information */ void dplane_ctx_set_type(struct zebra_dplane_ctx *ctx, int type); int dplane_ctx_get_type(const struct zebra_dplane_ctx *ctx);