struct zebra_pbr_ipset ipset;
uint16_t cmd = ZEBRA_IPSET_NOTIFY_OWNER;
- if (!dplane_ctx_get_pbr_ipset(ctx, &ipset))
- return;
+ dplane_ctx_get_pbr_ipset(ctx, &ipset);
if (IS_ZEBRA_DEBUG_PACKET)
zlog_debug("%s: Notifying %s id %u note %u", __func__,
if (!dplane_ctx_get_pbr_ipset_entry(ctx, &ipent))
return;
- if (!dplane_ctx_get_pbr_ipset(ctx, &ipset))
- return;
+ dplane_ctx_get_pbr_ipset(ctx, &ipset);
if (IS_ZEBRA_DEBUG_PACKET)
zlog_debug("%s: Notifying %s id %u note %u", __func__,
return true;
}
-bool 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)
{
DPLANE_CTX_VALID(ctx);
- if (!ipset)
- return false;
+ assert(ipset);
+
if (ctx->zd_op == DPLANE_OP_IPSET_ENTRY_ADD ||
ctx->zd_op == DPLANE_OP_IPSET_ENTRY_DELETE) {
memset(ipset, 0, sizeof(struct zebra_pbr_ipset));
ZEBRA_IPSET_NAME_SIZE);
} else
memcpy(ipset, &ctx->u.ipset, sizeof(struct zebra_pbr_ipset));
- return true;
}
bool dplane_ctx_get_pbr_ipset_entry(const struct zebra_dplane_ctx *ctx,
case DPLANE_OP_IPSET_DELETE: {
struct zebra_pbr_ipset ipset;
- if (dplane_ctx_get_pbr_ipset(ctx, &ipset))
- zlog_debug("Dplane ipset update op %s, unique(%u), ctx %p",
- dplane_op2str(dplane_ctx_get_op(ctx)),
- ipset.unique, ctx);
+ dplane_ctx_get_pbr_ipset(ctx, &ipset);
+ zlog_debug("Dplane ipset update op %s, unique(%u), ctx %p",
+ dplane_op2str(dplane_ctx_get_op(ctx)), ipset.unique,
+ ctx);
} break;
case DPLANE_OP_IPSET_ENTRY_ADD:
case DPLANE_OP_IPSET_ENTRY_DELETE: {
dplane_ctx_get_pbr_iptable(const struct zebra_dplane_ctx *ctx,
struct zebra_pbr_iptable *table);
struct zebra_pbr_ipset;
-bool
-dplane_ctx_get_pbr_ipset(const struct zebra_dplane_ctx *ctx,
- struct zebra_pbr_ipset *ipset);
+void dplane_ctx_get_pbr_ipset(const struct zebra_dplane_ctx *ctx,
+ struct zebra_pbr_ipset *ipset);
struct zebra_pbr_ipset_entry;
bool
dplane_ctx_get_pbr_ipset_entry(const struct zebra_dplane_ctx *ctx,
mode = 1;
else
mode = 0;
- if (dplane_ctx_get_pbr_ipset(ctx, &ipset)) {
- ret = hook_call(zebra_pbr_ipset_update, mode, &ipset);
- if (ret)
- dplane_ctx_set_status(ctx,
- ZEBRA_DPLANE_REQUEST_SUCCESS);
- }
- if (!ret)
+
+ dplane_ctx_get_pbr_ipset(ctx, &ipset);
+
+ ret = hook_call(zebra_pbr_ipset_update, mode, &ipset);
+ if (ret)
+ dplane_ctx_set_status(ctx, ZEBRA_DPLANE_REQUEST_SUCCESS);
+ else
dplane_ctx_set_status(ctx, ZEBRA_DPLANE_REQUEST_FAILURE);
}
if (!dplane_ctx_get_pbr_ipset_entry(ctx, &ipset_entry))
return;
- if (!dplane_ctx_get_pbr_ipset(ctx, &ipset))
- return;
+ dplane_ctx_get_pbr_ipset(ctx, &ipset);
+
ipset_entry.backpointer = &ipset;
ret = hook_call(zebra_pbr_ipset_entry_update, mode, &ipset_entry);