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 <mjs@voltanet.io>
This commit is contained in:
Mark Stapp 2019-04-02 12:25:33 -04:00
parent ee5e8a4820
commit 0024a559c8
2 changed files with 22 additions and 0 deletions

View File

@ -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);

View File

@ -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);