Skip to content

Commit

Permalink
lib,*: add vrf id to pbr rule results zapi message
Browse files Browse the repository at this point in the history
The iprule/pbr rule object has a vrf id, and zebra uses
that internally, but the vrf id isn't returned to clients
who install rules and are waiting for results. Include the
vrf_id sent by the client in the zapi result notification
message; update the existing clients so they decode the id.

Signed-off-by: Mark Stapp <[email protected]>
  • Loading branch information
Mark Stapp committed Oct 5, 2023
1 parent 3651803 commit 4fabe90
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion zebra/zapi_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,9 @@ void zsend_rule_notify_owner(const struct zebra_dplane_ctx *ctx,

s = stream_new(ZEBRA_MAX_PACKET_SIZ);

zclient_create_header(s, ZEBRA_RULE_NOTIFY_OWNER, VRF_DEFAULT);
zclient_create_header(s, ZEBRA_RULE_NOTIFY_OWNER,
dplane_ctx_rule_get_vrfid(ctx));

stream_put(s, &note, sizeof(note));
stream_putl(s, dplane_ctx_rule_get_seq(ctx));
stream_putl(s, dplane_ctx_rule_get_priority(ctx));
Expand Down
7 changes: 7 additions & 0 deletions zebra/zebra_dplane.c
Original file line number Diff line number Diff line change
Expand Up @@ -3031,6 +3031,13 @@ void dplane_ctx_rule_set_dp_flow_ptr(struct zebra_dplane_ctx *ctx,
ctx->u.rule.new.dp_flow_ptr = dp_flow_ptr;
}

vrf_id_t dplane_ctx_rule_get_vrfid(const struct zebra_dplane_ctx *ctx)
{
DPLANE_CTX_VALID(ctx);

return ctx->u.rule.new.prule.vrf_id;
}

/***********************************************************************
* PBR RULE ACCESSORS - end
**********************************************************************/
Expand Down
2 changes: 2 additions & 0 deletions zebra/zebra_dplane.h
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@ intptr_t
dplane_ctx_rule_get_old_dp_flow_ptr(const struct zebra_dplane_ctx *ctx);
void dplane_ctx_rule_set_dp_flow_ptr(struct zebra_dplane_ctx *ctx,
intptr_t dp_flow_ptr);
vrf_id_t dplane_ctx_rule_get_vrfid(const struct zebra_dplane_ctx *ctx);

/* Accessors for policy based routing iptable information */
struct zebra_pbr_iptable;
void dplane_ctx_get_pbr_iptable(const struct zebra_dplane_ctx *ctx,
Expand Down

0 comments on commit 4fabe90

Please sign in to comment.