zebra: return void for dplane_ctx_get_pbr_ipset_entry

The dplane_ctx_get_pbr_ipset_entry function only
failed when the caller did not pass in a valid
usable pointer.  Change the code to assert on
a pointer not being passed in and remove the
bool return

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2021-10-28 10:42:23 -04:00
parent 8d78e148b8
commit f284c1322d
4 changed files with 12 additions and 16 deletions

View File

@ -940,8 +940,7 @@ void zsend_ipset_entry_notify_owner(const struct zebra_dplane_ctx *ctx,
struct zebra_pbr_ipset ipset; struct zebra_pbr_ipset ipset;
uint16_t cmd = ZEBRA_IPSET_ENTRY_NOTIFY_OWNER; uint16_t cmd = ZEBRA_IPSET_ENTRY_NOTIFY_OWNER;
if (!dplane_ctx_get_pbr_ipset_entry(ctx, &ipent)) dplane_ctx_get_pbr_ipset_entry(ctx, &ipent);
return;
dplane_ctx_get_pbr_ipset(ctx, &ipset); dplane_ctx_get_pbr_ipset(ctx, &ipset);
if (IS_ZEBRA_DEBUG_PACKET) if (IS_ZEBRA_DEBUG_PACKET)

View File

@ -2171,15 +2171,14 @@ void dplane_ctx_get_pbr_ipset(const struct zebra_dplane_ctx *ctx,
memcpy(ipset, &ctx->u.ipset, sizeof(struct zebra_pbr_ipset)); memcpy(ipset, &ctx->u.ipset, sizeof(struct zebra_pbr_ipset));
} }
bool dplane_ctx_get_pbr_ipset_entry(const struct zebra_dplane_ctx *ctx, void dplane_ctx_get_pbr_ipset_entry(const struct zebra_dplane_ctx *ctx,
struct zebra_pbr_ipset_entry *entry) struct zebra_pbr_ipset_entry *entry)
{ {
DPLANE_CTX_VALID(ctx); DPLANE_CTX_VALID(ctx);
if (!entry) assert(entry);
return false;
memcpy(entry, &ctx->u.ipset_entry.entry, sizeof(struct zebra_pbr_ipset_entry)); memcpy(entry, &ctx->u.ipset_entry.entry, sizeof(struct zebra_pbr_ipset_entry));
return true;
} }
/* /*
@ -5075,12 +5074,12 @@ static void kernel_dplane_log_detail(struct zebra_dplane_ctx *ctx)
case DPLANE_OP_IPSET_ENTRY_DELETE: { case DPLANE_OP_IPSET_ENTRY_DELETE: {
struct zebra_pbr_ipset_entry ipent; struct zebra_pbr_ipset_entry ipent;
if (dplane_ctx_get_pbr_ipset_entry(ctx, &ipent)) dplane_ctx_get_pbr_ipset_entry(ctx, &ipent);
zlog_debug("Dplane ipset entry update op %s, unique(%u), ctx %p", zlog_debug(
dplane_op2str(dplane_ctx_get_op(ctx)), "Dplane ipset entry update op %s, unique(%u), ctx %p",
ipent.unique, ctx); dplane_op2str(dplane_ctx_get_op(ctx)), ipent.unique,
ctx);
} break; } break;
case DPLANE_OP_NEIGH_TABLE_UPDATE: case DPLANE_OP_NEIGH_TABLE_UPDATE:
zlog_debug("Dplane neigh table op %s, ifp %s, family %s", zlog_debug("Dplane neigh table op %s, ifp %s, family %s",
dplane_op2str(dplane_ctx_get_op(ctx)), dplane_op2str(dplane_ctx_get_op(ctx)),

View File

@ -532,9 +532,8 @@ struct zebra_pbr_ipset;
void dplane_ctx_get_pbr_ipset(const struct zebra_dplane_ctx *ctx, void dplane_ctx_get_pbr_ipset(const struct zebra_dplane_ctx *ctx,
struct zebra_pbr_ipset *ipset); struct zebra_pbr_ipset *ipset);
struct zebra_pbr_ipset_entry; struct zebra_pbr_ipset_entry;
bool void dplane_ctx_get_pbr_ipset_entry(const struct zebra_dplane_ctx *ctx,
dplane_ctx_get_pbr_ipset_entry(const struct zebra_dplane_ctx *ctx, struct zebra_pbr_ipset_entry *entry);
struct zebra_pbr_ipset_entry *entry);
/* Accessors for bridge port information */ /* Accessors for bridge port information */
uint32_t dplane_ctx_get_br_port_flags(const struct zebra_dplane_ctx *ctx); uint32_t dplane_ctx_get_br_port_flags(const struct zebra_dplane_ctx *ctx);
uint32_t uint32_t

View File

@ -591,8 +591,7 @@ void zebra_pbr_process_ipset_entry(struct zebra_dplane_ctx *ctx)
else else
mode = 0; mode = 0;
if (!dplane_ctx_get_pbr_ipset_entry(ctx, &ipset_entry)) dplane_ctx_get_pbr_ipset_entry(ctx, &ipset_entry);
return;
dplane_ctx_get_pbr_ipset(ctx, &ipset); dplane_ctx_get_pbr_ipset(ctx, &ipset);
ipset_entry.backpointer = &ipset; ipset_entry.backpointer = &ipset;