]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: add source plugin info to dplane context
authorMark Stapp <mjs@voltanet.io>
Tue, 2 Apr 2019 16:25:33 +0000 (12:25 -0400)
committerMark Stapp <mjs@voltanet.io>
Tue, 28 May 2019 12:28:49 +0000 (08:28 -0400)
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>
zebra/zebra_dplane.c
zebra/zebra_dplane.h

index a13fc28d7de7264f8685aa5da9af3cbb800b1b3e..a98a1bce7990593e7eb350ca0c27e62d0bfd33ac 100644 (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);
index 0a487e07122ba8600a79c3a6fa77bab53650bc93..75b7748cb87174be5a9e4184a80087a2c3ff863a 100644 (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);