summaryrefslogtreecommitdiff
path: root/zebra/zebra_pbr.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_pbr.c')
-rw-r--r--zebra/zebra_pbr.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/zebra/zebra_pbr.c b/zebra/zebra_pbr.c
index 62cbcbda4b..c5a7795273 100644
--- a/zebra/zebra_pbr.c
+++ b/zebra/zebra_pbr.c
@@ -131,7 +131,7 @@ void zebra_pbr_rules_free(void *arg)
rule = (struct zebra_pbr_rule *)arg;
- (void)kernel_del_pbr_rule(rule);
+ (void)dplane_pbr_rule_delete(rule);
XFREE(MTYPE_TMP, rule);
}
@@ -460,7 +460,7 @@ void zebra_pbr_add_rule(struct zebra_pbr_rule *rule)
/* If found, this is an update */
if (found) {
- (void)kernel_update_pbr_rule(found, rule);
+ (void)dplane_pbr_rule_update(found, rule);
if (pbr_rule_release(found))
zlog_debug(
@@ -468,12 +468,12 @@ void zebra_pbr_add_rule(struct zebra_pbr_rule *rule)
__PRETTY_FUNCTION__);
} else
- (void)kernel_add_pbr_rule(rule);
+ (void)dplane_pbr_rule_add(rule);
}
void zebra_pbr_del_rule(struct zebra_pbr_rule *rule)
{
- (void)kernel_del_pbr_rule(rule);
+ (void)dplane_pbr_rule_delete(rule);
if (pbr_rule_release(rule))
zlog_debug("%s: Rule being deleted we know nothing about",
@@ -486,7 +486,7 @@ static void zebra_pbr_cleanup_rules(struct hash_bucket *b, void *data)
int *sock = data;
if (rule->sock == *sock) {
- (void)kernel_del_pbr_rule(rule);
+ (void)dplane_pbr_rule_delete(rule);
if (hash_release(zrouter.rules_hash, rule))
XFREE(MTYPE_TMP, rule);
else
@@ -735,25 +735,29 @@ void zebra_pbr_del_iptable(struct zebra_pbr_iptable *iptable)
/*
* Handle success or failure of rule (un)install in the kernel.
*/
-void kernel_pbr_rule_add_del_status(struct zebra_pbr_rule *rule,
- enum zebra_dplane_status res)
+void zebra_pbr_dplane_result(struct zebra_dplane_ctx *ctx)
{
- switch (res) {
- case ZEBRA_DPLANE_INSTALL_SUCCESS:
- zsend_rule_notify_owner(rule, ZAPI_RULE_INSTALLED);
- break;
- case ZEBRA_DPLANE_INSTALL_FAILURE:
- zsend_rule_notify_owner(rule, ZAPI_RULE_FAIL_INSTALL);
- break;
- case ZEBRA_DPLANE_DELETE_SUCCESS:
- zsend_rule_notify_owner(rule, ZAPI_RULE_REMOVED);
- break;
- case ZEBRA_DPLANE_DELETE_FAILURE:
- zsend_rule_notify_owner(rule, ZAPI_RULE_FAIL_REMOVE);
- break;
- case ZEBRA_DPLANE_STATUS_NONE:
- break;
- }
+ enum zebra_dplane_result res;
+ enum dplane_op_e op;
+
+ res = dplane_ctx_get_status(ctx);
+ op = dplane_ctx_get_op(ctx);
+ if (op == DPLANE_OP_RULE_ADD || op == DPLANE_OP_RULE_UPDATE)
+ zsend_rule_notify_owner(ctx, res == ZEBRA_DPLANE_REQUEST_SUCCESS
+ ? ZAPI_RULE_INSTALLED
+ : ZAPI_RULE_FAIL_INSTALL);
+ else if (op == DPLANE_OP_RULE_DELETE)
+ zsend_rule_notify_owner(ctx, res == ZEBRA_DPLANE_REQUEST_SUCCESS
+ ? ZAPI_RULE_REMOVED
+ : ZAPI_RULE_FAIL_REMOVE);
+ else
+ flog_err(
+ EC_ZEBRA_PBR_RULE_UPDATE,
+ "Context received in pbr rule dplane result handler with incorrect OP code (%u)",
+ op);
+
+
+ dplane_ctx_fini(&ctx);
}
/*