Blame SOURCES/0083-libnftables-call-nft_cmd_expand-only-with-CMD_ADD.patch

f96c59
From 34a7632a4d72c16d2a087fcc6450d1a783858124 Mon Sep 17 00:00:00 2001
f96c59
From: Phil Sutter <psutter@redhat.com>
f96c59
Date: Thu, 28 Apr 2022 14:14:39 +0200
f96c59
Subject: [PATCH] libnftables: call nft_cmd_expand() only with CMD_ADD
f96c59
f96c59
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2073287
f96c59
Upstream Status: nftables commit b81519f1641b5
f96c59
f96c59
commit b81519f1641b508c289ddfefc800b2c20ab243e6
f96c59
Author: Pablo Neira Ayuso <pablo@netfilter.org>
f96c59
Date:   Fri May 8 14:44:02 2020 +0200
f96c59
f96c59
    libnftables: call nft_cmd_expand() only with CMD_ADD
f96c59
f96c59
    Restrict the expansion logic to the CMD_ADD command which is where this
f96c59
    is only required.
f96c59
f96c59
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
f96c59
---
f96c59
 src/libnftables.c | 6 +++++-
f96c59
 1 file changed, 5 insertions(+), 1 deletion(-)
f96c59
f96c59
diff --git a/src/libnftables.c b/src/libnftables.c
f96c59
index cd2fcf2..ab01909 100644
f96c59
--- a/src/libnftables.c
f96c59
+++ b/src/libnftables.c
f96c59
@@ -421,8 +421,12 @@ static int nft_evaluate(struct nft_ctx *nft, struct list_head *msgs,
f96c59
 	if (nft->state->nerrs)
f96c59
 		return -1;
f96c59
 
f96c59
-	list_for_each_entry(cmd, cmds, list)
f96c59
+	list_for_each_entry(cmd, cmds, list) {
f96c59
+		if (cmd->op != CMD_ADD)
f96c59
+			continue;
f96c59
+
f96c59
 		nft_cmd_expand(cmd);
f96c59
+	}
f96c59
 
f96c59
 	return 0;
f96c59
 }
f96c59
-- 
f96c59
2.34.1
f96c59