mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 22:57:45 +00:00
zebra: return void for dplane_ctx_get_pbr_iptable
The only time this function ever failed is when the developer does not pass in a usable pointer to place the data in. Change it to an assert to signify to the end developer that is what we want and then remove all the if checks for failure Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
8249f96a5f
commit
8d78e148b8
@ -871,8 +871,7 @@ void zsend_iptable_notify_owner(const struct zebra_dplane_ctx *ctx,
|
||||
struct zebra_pbr_iptable ipt;
|
||||
uint16_t cmd = ZEBRA_IPTABLE_NOTIFY_OWNER;
|
||||
|
||||
if (!dplane_ctx_get_pbr_iptable(ctx, &ipt))
|
||||
return;
|
||||
dplane_ctx_get_pbr_iptable(ctx, &ipt);
|
||||
|
||||
if (IS_ZEBRA_DEBUG_PACKET)
|
||||
zlog_debug("%s: Notifying %s id %u note %u", __func__,
|
||||
|
@ -2145,14 +2145,12 @@ dplane_ctx_get_br_port_backup_nhg_id(const struct zebra_dplane_ctx *ctx)
|
||||
}
|
||||
|
||||
/* Accessors for PBR iptable information */
|
||||
bool
|
||||
dplane_ctx_get_pbr_iptable(const struct zebra_dplane_ctx *ctx,
|
||||
void dplane_ctx_get_pbr_iptable(const struct zebra_dplane_ctx *ctx,
|
||||
struct zebra_pbr_iptable *table)
|
||||
{
|
||||
DPLANE_CTX_VALID(ctx);
|
||||
|
||||
memcpy(table, &ctx->u.iptable, sizeof(struct zebra_pbr_iptable));
|
||||
return true;
|
||||
}
|
||||
|
||||
void dplane_ctx_get_pbr_ipset(const struct zebra_dplane_ctx *ctx,
|
||||
@ -5059,9 +5057,10 @@ static void kernel_dplane_log_detail(struct zebra_dplane_ctx *ctx)
|
||||
case DPLANE_OP_IPTABLE_DELETE: {
|
||||
struct zebra_pbr_iptable ipt;
|
||||
|
||||
if (dplane_ctx_get_pbr_iptable(ctx, &ipt))
|
||||
dplane_ctx_get_pbr_iptable(ctx, &ipt);
|
||||
zlog_debug("Dplane iptable update op %s, unique(%u), ctx %p",
|
||||
dplane_op2str(dplane_ctx_get_op(ctx)), ipt.unique, ctx);
|
||||
dplane_op2str(dplane_ctx_get_op(ctx)), ipt.unique,
|
||||
ctx);
|
||||
} break;
|
||||
case DPLANE_OP_IPSET_ADD:
|
||||
case DPLANE_OP_IPSET_DELETE: {
|
||||
|
@ -526,8 +526,7 @@ const struct prefix *
|
||||
dplane_ctx_rule_get_old_dst_ip(const struct zebra_dplane_ctx *ctx);
|
||||
/* Accessors for policy based routing iptable information */
|
||||
struct zebra_pbr_iptable;
|
||||
bool
|
||||
dplane_ctx_get_pbr_iptable(const struct zebra_dplane_ctx *ctx,
|
||||
void dplane_ctx_get_pbr_iptable(const struct zebra_dplane_ctx *ctx,
|
||||
struct zebra_pbr_iptable *table);
|
||||
struct zebra_pbr_ipset;
|
||||
void dplane_ctx_get_pbr_ipset(const struct zebra_dplane_ctx *ctx,
|
||||
|
@ -552,13 +552,12 @@ void zebra_pbr_process_iptable(struct zebra_dplane_ctx *ctx)
|
||||
else
|
||||
mode = 0;
|
||||
|
||||
if (dplane_ctx_get_pbr_iptable(ctx, &ipt)) {
|
||||
dplane_ctx_get_pbr_iptable(ctx, &ipt);
|
||||
|
||||
ret = hook_call(zebra_pbr_iptable_update, mode, &ipt);
|
||||
if (ret)
|
||||
dplane_ctx_set_status(ctx,
|
||||
ZEBRA_DPLANE_REQUEST_SUCCESS);
|
||||
}
|
||||
if (!ret)
|
||||
dplane_ctx_set_status(ctx, ZEBRA_DPLANE_REQUEST_SUCCESS);
|
||||
else
|
||||
dplane_ctx_set_status(ctx, ZEBRA_DPLANE_REQUEST_FAILURE);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user