Blame SOURCES/0016-src-pass-struct-nft_ctx-through-struct-eval_ctx.patch

34625f
From 09a890d3653a87e3752a3ebfc3f5de597a679cc5 Mon Sep 17 00:00:00 2001
34625f
From: Pablo Neira Ayuso <pablo@netfilter.org>
34625f
Date: Mon, 22 Oct 2018 12:38:35 +0200
34625f
Subject: [PATCH] src: pass struct nft_ctx through struct eval_ctx
34625f
34625f
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
34625f
(cherry picked from commit 00f777bfc414af1e1384a213adc91ae4ecf6cbdf)
34625f
34625f
Conflicts:
34625f
	src/evaluate.c
34625f
-> Missing osf support
34625f
34625f
Signed-off-by: Phil Sutter <psutter@redhat.com>
34625f
---
34625f
 include/rule.h     |   5 +-
34625f
 src/evaluate.c     | 128 ++++++++++++++++++++++-----------------------
34625f
 src/parser_bison.y |   5 +-
34625f
 3 files changed, 66 insertions(+), 72 deletions(-)
34625f
34625f
diff --git a/include/rule.h b/include/rule.h
34625f
index 909ff36db80c1..b1d15c8725813 100644
34625f
--- a/include/rule.h
34625f
+++ b/include/rule.h
34625f
@@ -556,16 +556,13 @@ extern void cmd_free(struct cmd *cmd);
34625f
  * @pctx:	payload context
34625f
  */
34625f
 struct eval_ctx {
34625f
-	struct mnl_socket	*nf_sock;
34625f
+	struct nft_ctx		*nft;
34625f
 	struct list_head	*msgs;
34625f
 	struct cmd		*cmd;
34625f
 	struct table		*table;
34625f
 	struct rule		*rule;
34625f
 	struct set		*set;
34625f
 	struct stmt		*stmt;
34625f
-	struct nft_cache	*cache;
34625f
-	struct output_ctx	*octx;
34625f
-	unsigned int		debug_mask;
34625f
 	struct expr_ctx		ectx;
34625f
 	struct proto_ctx	pctx;
34625f
 };
34625f
diff --git a/src/evaluate.c b/src/evaluate.c
34625f
index d18af34341b0d..5e9c6328fc692 100644
34625f
--- a/src/evaluate.c
34625f
+++ b/src/evaluate.c
34625f
@@ -156,7 +156,7 @@ static struct table *table_lookup_global(struct eval_ctx *ctx)
34625f
 	if (ctx->table != NULL)
34625f
 		return ctx->table;
34625f
 
34625f
-	table = table_lookup(&ctx->cmd->handle, ctx->cache);
34625f
+	table = table_lookup(&ctx->cmd->handle, &ctx->nft->cache);
34625f
 	if (table == NULL)
34625f
 		return NULL;
34625f
 
34625f
@@ -184,8 +184,8 @@ static int expr_evaluate_symbol(struct eval_ctx *ctx, struct expr **expr)
34625f
 		}
34625f
 		break;
34625f
 	case SYMBOL_SET:
34625f
-		ret = cache_update(ctx->nf_sock, ctx->cache, ctx->cmd->op,
34625f
-				   ctx->msgs, ctx->debug_mask, ctx->octx);
34625f
+		ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, ctx->cmd->op,
34625f
+				   ctx->msgs, ctx->nft->debug_mask, &ctx->nft->output);
34625f
 		if (ret < 0)
34625f
 			return ret;
34625f
 
34625f
@@ -1731,13 +1731,13 @@ static int expr_evaluate_variable(struct eval_ctx *ctx, struct expr **exprp)
34625f
 
34625f
 static int expr_evaluate(struct eval_ctx *ctx, struct expr **expr)
34625f
 {
34625f
-	if (ctx->debug_mask & NFT_DEBUG_EVALUATION) {
34625f
+	if (ctx->nft->debug_mask & NFT_DEBUG_EVALUATION) {
34625f
 		struct error_record *erec;
34625f
 		erec = erec_create(EREC_INFORMATIONAL, &(*expr)->location,
34625f
 				   "Evaluate %s", (*expr)->ops->name);
34625f
-		erec_print(ctx->octx, erec, ctx->debug_mask);
34625f
-		expr_print(*expr, ctx->octx);
34625f
-		nft_print(ctx->octx, "\n\n");
34625f
+		erec_print(&ctx->nft->output, erec, ctx->nft->debug_mask);
34625f
+		expr_print(*expr, &ctx->nft->output);
34625f
+		nft_print(&ctx->nft->output, "\n\n");
34625f
 		erec_destroy(erec);
34625f
 	}
34625f
 
34625f
@@ -2717,13 +2717,13 @@ static int stmt_evaluate_objref(struct eval_ctx *ctx, struct stmt *stmt)
34625f
 
34625f
 int stmt_evaluate(struct eval_ctx *ctx, struct stmt *stmt)
34625f
 {
34625f
-	if (ctx->debug_mask & NFT_DEBUG_EVALUATION) {
34625f
+	if (ctx->nft->debug_mask & NFT_DEBUG_EVALUATION) {
34625f
 		struct error_record *erec;
34625f
 		erec = erec_create(EREC_INFORMATIONAL, &stmt->location,
34625f
 				   "Evaluate %s", stmt->ops->name);
34625f
-		erec_print(ctx->octx, erec, ctx->debug_mask);
34625f
-		stmt_print(stmt, ctx->octx);
34625f
-		nft_print(ctx->octx, "\n\n");
34625f
+		erec_print(&ctx->nft->output, erec, ctx->nft->debug_mask);
34625f
+		stmt_print(stmt, &ctx->nft->output);
34625f
+		nft_print(&ctx->nft->output, "\n\n");
34625f
 		erec_destroy(erec);
34625f
 	}
34625f
 
34625f
@@ -2895,12 +2895,12 @@ static int rule_translate_index(struct eval_ctx *ctx, struct rule *rule)
34625f
 	int ret;
34625f
 
34625f
 	/* update cache with CMD_LIST so that rules are fetched, too */
34625f
-	ret = cache_update(ctx->nf_sock, ctx->cache, CMD_LIST,
34625f
-			ctx->msgs, ctx->debug_mask, ctx->octx);
34625f
+	ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, CMD_LIST,
34625f
+			ctx->msgs, ctx->nft->debug_mask, &ctx->nft->output);
34625f
 	if (ret < 0)
34625f
 		return ret;
34625f
 
34625f
-	table = table_lookup(&rule->handle, ctx->cache);
34625f
+	table = table_lookup(&rule->handle, &ctx->nft->cache);
34625f
 	if (!table)
34625f
 		return cmd_error(ctx, &rule->handle.table.location,
34625f
 				"Could not process rule: %s",
34625f
@@ -2931,7 +2931,7 @@ static int rule_evaluate(struct eval_ctx *ctx, struct rule *rule)
34625f
 	struct stmt *stmt, *tstmt = NULL;
34625f
 	struct error_record *erec;
34625f
 
34625f
-	proto_ctx_init(&ctx->pctx, rule->handle.family, ctx->debug_mask);
34625f
+	proto_ctx_init(&ctx->pctx, rule->handle.family, ctx->nft->debug_mask);
34625f
 	memset(&ctx->ectx, 0, sizeof(ctx->ectx));
34625f
 
34625f
 	ctx->rule = rule;
34625f
@@ -3047,13 +3047,13 @@ static int table_evaluate(struct eval_ctx *ctx, struct table *table)
34625f
 	struct chain *chain;
34625f
 	struct set *set;
34625f
 
34625f
-	if (table_lookup(&ctx->cmd->handle, ctx->cache) == NULL) {
34625f
+	if (table_lookup(&ctx->cmd->handle, &ctx->nft->cache) == NULL) {
34625f
 		if (table == NULL) {
34625f
 			table = table_alloc();
34625f
 			handle_merge(&table->handle, &ctx->cmd->handle);
34625f
-			table_add_hash(table, ctx->cache);
34625f
+			table_add_hash(table, &ctx->nft->cache);
34625f
 		} else {
34625f
-			table_add_hash(table_get(table), ctx->cache);
34625f
+			table_add_hash(table_get(table), &ctx->nft->cache);
34625f
 		}
34625f
 	}
34625f
 
34625f
@@ -3088,15 +3088,15 @@ static int cmd_evaluate_add(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 
34625f
 	switch (cmd->obj) {
34625f
 	case CMD_OBJ_SETELEM:
34625f
-		ret = cache_update(ctx->nf_sock, ctx->cache, cmd->op,
34625f
-				   ctx->msgs, ctx->debug_mask, ctx->octx);
34625f
+		ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op,
34625f
+				   ctx->msgs, ctx->nft->debug_mask, &ctx->nft->output);
34625f
 		if (ret < 0)
34625f
 			return ret;
34625f
 
34625f
 		return setelem_evaluate(ctx, &cmd->expr);
34625f
 	case CMD_OBJ_SET:
34625f
-		ret = cache_update(ctx->nf_sock, ctx->cache, cmd->op,
34625f
-				   ctx->msgs, ctx->debug_mask, ctx->octx);
34625f
+		ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op,
34625f
+				   ctx->msgs, ctx->nft->debug_mask, &ctx->nft->output);
34625f
 		if (ret < 0)
34625f
 			return ret;
34625f
 
34625f
@@ -3106,8 +3106,8 @@ static int cmd_evaluate_add(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 		handle_merge(&cmd->rule->handle, &cmd->handle);
34625f
 		return rule_evaluate(ctx, cmd->rule);
34625f
 	case CMD_OBJ_CHAIN:
34625f
-		ret = cache_update(ctx->nf_sock, ctx->cache, cmd->op,
34625f
-				   ctx->msgs, ctx->debug_mask, ctx->octx);
34625f
+		ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op,
34625f
+				   ctx->msgs, ctx->nft->debug_mask, &ctx->nft->output);
34625f
 		if (ret < 0)
34625f
 			return ret;
34625f
 
34625f
@@ -3115,8 +3115,8 @@ static int cmd_evaluate_add(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 	case CMD_OBJ_TABLE:
34625f
 		return table_evaluate(ctx, cmd->table);
34625f
 	case CMD_OBJ_FLOWTABLE:
34625f
-		ret = cache_update(ctx->nf_sock, ctx->cache, cmd->op,
34625f
-				   ctx->msgs, ctx->debug_mask, ctx->octx);
34625f
+		ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op,
34625f
+				   ctx->msgs, ctx->nft->debug_mask, &ctx->nft->output);
34625f
 		if (ret < 0)
34625f
 			return ret;
34625f
 
34625f
@@ -3138,8 +3138,8 @@ static int cmd_evaluate_delete(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 
34625f
 	switch (cmd->obj) {
34625f
 	case CMD_OBJ_SETELEM:
34625f
-		ret = cache_update(ctx->nf_sock, ctx->cache, cmd->op,
34625f
-				   ctx->msgs, ctx->debug_mask, ctx->octx);
34625f
+		ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op,
34625f
+				   ctx->msgs, ctx->nft->debug_mask, &ctx->nft->output);
34625f
 		if (ret < 0)
34625f
 			return ret;
34625f
 
34625f
@@ -3165,14 +3165,14 @@ static int cmd_evaluate_get(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 	struct set *set;
34625f
 	int ret;
34625f
 
34625f
-	ret = cache_update(ctx->nf_sock, ctx->cache, cmd->op, ctx->msgs,
34625f
-			   ctx->debug_mask, ctx->octx);
34625f
+	ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op, ctx->msgs,
34625f
+			   ctx->nft->debug_mask, &ctx->nft->output);
34625f
 	if (ret < 0)
34625f
 		return ret;
34625f
 
34625f
 	switch (cmd->obj) {
34625f
 	case CMD_OBJ_SETELEM:
34625f
-		table = table_lookup(&cmd->handle, ctx->cache);
34625f
+		table = table_lookup(&cmd->handle, &ctx->nft->cache);
34625f
 		if (table == NULL)
34625f
 			return cmd_error(ctx, &ctx->cmd->handle.table.location,
34625f
 					 "Could not process rule: %s",
34625f
@@ -3197,7 +3197,7 @@ static int cmd_evaluate_list_obj(struct eval_ctx *ctx, const struct cmd *cmd,
34625f
 	if (obj_type == NFT_OBJECT_UNSPEC)
34625f
 		obj_type = NFT_OBJECT_COUNTER;
34625f
 
34625f
-	table = table_lookup(&cmd->handle, ctx->cache);
34625f
+	table = table_lookup(&cmd->handle, &ctx->nft->cache);
34625f
 	if (table == NULL)
34625f
 		return cmd_error(ctx, &cmd->handle.table.location,
34625f
 				 "Could not process rule: %s",
34625f
@@ -3215,8 +3215,8 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 	struct set *set;
34625f
 	int ret;
34625f
 
34625f
-	ret = cache_update(ctx->nf_sock, ctx->cache, cmd->op, ctx->msgs,
34625f
-			   ctx->debug_mask, ctx->octx);
34625f
+	ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op, ctx->msgs,
34625f
+			   ctx->nft->debug_mask, &ctx->nft->output);
34625f
 	if (ret < 0)
34625f
 		return ret;
34625f
 
34625f
@@ -3225,14 +3225,14 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 		if (cmd->handle.table.name == NULL)
34625f
 			return 0;
34625f
 
34625f
-		table = table_lookup(&cmd->handle, ctx->cache);
34625f
+		table = table_lookup(&cmd->handle, &ctx->nft->cache);
34625f
 		if (table == NULL)
34625f
 			return cmd_error(ctx, &cmd->handle.table.location,
34625f
 					 "Could not process rule: %s",
34625f
 					 strerror(ENOENT));
34625f
 		return 0;
34625f
 	case CMD_OBJ_SET:
34625f
-		table = table_lookup(&cmd->handle, ctx->cache);
34625f
+		table = table_lookup(&cmd->handle, &ctx->nft->cache);
34625f
 		if (table == NULL)
34625f
 			return cmd_error(ctx, &cmd->handle.table.location,
34625f
 					 "Could not process rule: %s",
34625f
@@ -3244,7 +3244,7 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 					 strerror(ENOENT));
34625f
 		return 0;
34625f
 	case CMD_OBJ_METER:
34625f
-		table = table_lookup(&cmd->handle, ctx->cache);
34625f
+		table = table_lookup(&cmd->handle, &ctx->nft->cache);
34625f
 		if (table == NULL)
34625f
 			return cmd_error(ctx, &cmd->handle.table.location,
34625f
 					 "Could not process rule: %s",
34625f
@@ -3256,7 +3256,7 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 					 strerror(ENOENT));
34625f
 		return 0;
34625f
 	case CMD_OBJ_MAP:
34625f
-		table = table_lookup(&cmd->handle, ctx->cache);
34625f
+		table = table_lookup(&cmd->handle, &ctx->nft->cache);
34625f
 		if (table == NULL)
34625f
 			return cmd_error(ctx, &cmd->handle.table.location,
34625f
 					 "Could not process rule: %s",
34625f
@@ -3268,7 +3268,7 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 					 strerror(ENOENT));
34625f
 		return 0;
34625f
 	case CMD_OBJ_CHAIN:
34625f
-		table = table_lookup(&cmd->handle, ctx->cache);
34625f
+		table = table_lookup(&cmd->handle, &ctx->nft->cache);
34625f
 		if (table == NULL)
34625f
 			return cmd_error(ctx, &cmd->handle.table.location,
34625f
 					 "Could not process rule: %s",
34625f
@@ -3294,7 +3294,7 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 	case CMD_OBJ_FLOWTABLES:
34625f
 		if (cmd->handle.table.name == NULL)
34625f
 			return 0;
34625f
-		if (table_lookup(&cmd->handle, ctx->cache) == NULL)
34625f
+		if (table_lookup(&cmd->handle, &ctx->nft->cache) == NULL)
34625f
 			return cmd_error(ctx, &cmd->handle.table.location,
34625f
 					 "Could not process rule: %s",
34625f
 					 strerror(ENOENT));
34625f
@@ -3313,8 +3313,8 @@ static int cmd_evaluate_reset(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 {
34625f
 	int ret;
34625f
 
34625f
-	ret = cache_update(ctx->nf_sock, ctx->cache, cmd->op, ctx->msgs,
34625f
-			   ctx->debug_mask, ctx->octx);
34625f
+	ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op, ctx->msgs,
34625f
+			   ctx->nft->debug_mask, &ctx->nft->output);
34625f
 	if (ret < 0)
34625f
 		return ret;
34625f
 
34625f
@@ -3325,7 +3325,7 @@ static int cmd_evaluate_reset(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 	case CMD_OBJ_QUOTAS:
34625f
 		if (cmd->handle.table.name == NULL)
34625f
 			return 0;
34625f
-		if (table_lookup(&cmd->handle, ctx->cache) == NULL)
34625f
+		if (table_lookup(&cmd->handle, &ctx->nft->cache) == NULL)
34625f
 			return cmd_error(ctx, &cmd->handle.table.location,
34625f
 					 "Could not process rule: %s",
34625f
 					 strerror(ENOENT));
34625f
@@ -3343,8 +3343,8 @@ static int cmd_evaluate_flush(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 
34625f
 	switch (cmd->obj) {
34625f
 	case CMD_OBJ_RULESET:
34625f
-		cache_flush(ctx->nf_sock, ctx->cache, cmd->op, ctx->msgs,
34625f
-			    ctx->debug_mask, ctx->octx);
34625f
+		cache_flush(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op, ctx->msgs,
34625f
+			    ctx->nft->debug_mask, &ctx->nft->output);
34625f
 		break;
34625f
 	case CMD_OBJ_TABLE:
34625f
 		/* Flushing a table does not empty the sets in the table nor remove
34625f
@@ -3354,12 +3354,12 @@ static int cmd_evaluate_flush(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 		/* Chains don't hold sets */
34625f
 		break;
34625f
 	case CMD_OBJ_SET:
34625f
-		ret = cache_update(ctx->nf_sock, ctx->cache, cmd->op, ctx->msgs,
34625f
-				   ctx->debug_mask, ctx->octx);
34625f
+		ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op, ctx->msgs,
34625f
+				   ctx->nft->debug_mask, &ctx->nft->output);
34625f
 		if (ret < 0)
34625f
 			return ret;
34625f
 
34625f
-		table = table_lookup(&cmd->handle, ctx->cache);
34625f
+		table = table_lookup(&cmd->handle, &ctx->nft->cache);
34625f
 		if (table == NULL)
34625f
 			return cmd_error(ctx, &cmd->handle.table.location,
34625f
 					 "Could not process rule: %s",
34625f
@@ -3371,12 +3371,12 @@ static int cmd_evaluate_flush(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 					 strerror(ENOENT));
34625f
 		return 0;
34625f
 	case CMD_OBJ_MAP:
34625f
-		ret = cache_update(ctx->nf_sock, ctx->cache, cmd->op, ctx->msgs,
34625f
-				   ctx->debug_mask, ctx->octx);
34625f
+		ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op, ctx->msgs,
34625f
+				   ctx->nft->debug_mask, &ctx->nft->output);
34625f
 		if (ret < 0)
34625f
 			return ret;
34625f
 
34625f
-		table = table_lookup(&cmd->handle, ctx->cache);
34625f
+		table = table_lookup(&cmd->handle, &ctx->nft->cache);
34625f
 		if (table == NULL)
34625f
 			return cmd_error(ctx, &ctx->cmd->handle.table.location,
34625f
 					 "Could not process rule: %s",
34625f
@@ -3388,12 +3388,12 @@ static int cmd_evaluate_flush(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 					 strerror(ENOENT));
34625f
 		return 0;
34625f
 	case CMD_OBJ_METER:
34625f
-		ret = cache_update(ctx->nf_sock, ctx->cache, cmd->op, ctx->msgs,
34625f
-				   ctx->debug_mask, ctx->octx);
34625f
+		ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op, ctx->msgs,
34625f
+				   ctx->nft->debug_mask, &ctx->nft->output);
34625f
 		if (ret < 0)
34625f
 			return ret;
34625f
 
34625f
-		table = table_lookup(&cmd->handle, ctx->cache);
34625f
+		table = table_lookup(&cmd->handle, &ctx->nft->cache);
34625f
 		if (table == NULL)
34625f
 			return cmd_error(ctx, &ctx->cmd->handle.table.location,
34625f
 					 "Could not process rule: %s",
34625f
@@ -3417,12 +3417,12 @@ static int cmd_evaluate_rename(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 
34625f
 	switch (cmd->obj) {
34625f
 	case CMD_OBJ_CHAIN:
34625f
-		ret = cache_update(ctx->nf_sock, ctx->cache, cmd->op,
34625f
-				   ctx->msgs, ctx->debug_mask, ctx->octx);
34625f
+		ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op,
34625f
+				   ctx->msgs, ctx->nft->debug_mask, &ctx->nft->output);
34625f
 		if (ret < 0)
34625f
 			return ret;
34625f
 
34625f
-		table = table_lookup(&ctx->cmd->handle, ctx->cache);
34625f
+		table = table_lookup(&ctx->cmd->handle, &ctx->nft->cache);
34625f
 		if (table == NULL)
34625f
 			return cmd_error(ctx, &ctx->cmd->handle.table.location,
34625f
 					 "Could not process rule: %s",
34625f
@@ -3517,8 +3517,8 @@ static int cmd_evaluate_monitor(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 	uint32_t event;
34625f
 	int ret;
34625f
 
34625f
-	ret = cache_update(ctx->nf_sock, ctx->cache, cmd->op, ctx->msgs,
34625f
-			   ctx->debug_mask, ctx->octx);
34625f
+	ret = cache_update(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op, ctx->msgs,
34625f
+			   ctx->nft->debug_mask, &ctx->nft->output);
34625f
 	if (ret < 0)
34625f
 		return ret;
34625f
 
34625f
@@ -3543,8 +3543,8 @@ static int cmd_evaluate_export(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 		return cmd_error(ctx, &cmd->location,
34625f
 				 "this output type is not supported");
34625f
 
34625f
-	return cache_update(ctx->nf_sock, ctx->cache, cmd->op, ctx->msgs,
34625f
-			    ctx->debug_mask, ctx->octx);
34625f
+	return cache_update(ctx->nft->nf_sock, &ctx->nft->cache, cmd->op, ctx->msgs,
34625f
+			    ctx->nft->debug_mask, &ctx->nft->output);
34625f
 }
34625f
 
34625f
 static int cmd_evaluate_import(struct eval_ctx *ctx, struct cmd *cmd)
34625f
@@ -3582,13 +3582,13 @@ static const char *cmd_op_to_name(enum cmd_ops op)
34625f
 
34625f
 int cmd_evaluate(struct eval_ctx *ctx, struct cmd *cmd)
34625f
 {
34625f
-	if (ctx->debug_mask & NFT_DEBUG_EVALUATION) {
34625f
+	if (ctx->nft->debug_mask & NFT_DEBUG_EVALUATION) {
34625f
 		struct error_record *erec;
34625f
 
34625f
 		erec = erec_create(EREC_INFORMATIONAL, &cmd->location,
34625f
 				   "Evaluate %s", cmd_op_to_name(cmd->op));
34625f
-		erec_print(ctx->octx, erec, ctx->debug_mask);
34625f
-		nft_print(ctx->octx, "\n\n");
34625f
+		erec_print(&ctx->nft->output, erec, ctx->nft->debug_mask);
34625f
+		nft_print(&ctx->nft->output, "\n\n");
34625f
 		erec_destroy(erec);
34625f
 	}
34625f
 
34625f
diff --git a/src/parser_bison.y b/src/parser_bison.y
34625f
index 33915ed8702a6..d75cd50fa29b9 100644
34625f
--- a/src/parser_bison.y
34625f
+++ b/src/parser_bison.y
34625f
@@ -44,11 +44,8 @@ void parser_init(struct nft_ctx *nft, struct parser_state *state,
34625f
 	state->msgs = msgs;
34625f
 	state->cmds = cmds;
34625f
 	state->scopes[0] = scope_init(&state->top_scope, NULL);
34625f
-	state->ectx.cache = &nft->cache;
34625f
+	state->ectx.nft = nft;
34625f
 	state->ectx.msgs = msgs;
34625f
-	state->ectx.nf_sock = nft->nf_sock;
34625f
-	state->ectx.debug_mask = nft->debug_mask;
34625f
-	state->ectx.octx = &nft->output;
34625f
 }
34625f
 
34625f
 static void yyerror(struct location *loc, struct nft_ctx *nft, void *scanner,
34625f
-- 
34625f
2.19.0
34625f