Blame SOURCES/0010-set_elem-missing-set-and-build-for-NFTNL_SET_ELEM_EX.patch

b95e04
From e04405f86a93185e4843b4e8c0644a4c66683fac Mon Sep 17 00:00:00 2001
b95e04
From: Phil Sutter <psutter@redhat.com>
b95e04
Date: Thu, 13 Jan 2022 20:10:27 +0100
b95e04
Subject: [PATCH] set_elem: missing set and build for NFTNL_SET_ELEM_EXPR
b95e04
b95e04
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2040478
b95e04
Upstream Status: libnftnl commit 92705574380f7
b95e04
b95e04
commit 92705574380f7ffd9f244b4cb69422a85269ab41
b95e04
Author: Pablo Neira Ayuso <pablo@netfilter.org>
b95e04
Date:   Wed Mar 11 14:23:33 2020 +0100
b95e04
b95e04
    set_elem: missing set and build for NFTNL_SET_ELEM_EXPR
b95e04
b95e04
    Extend nftnl_set_elem_set() and nftnl_set_elem_nlmsg_build_payload() to
b95e04
    support for the NFTNL_SET_ELEM_EXPR attribute.
b95e04
b95e04
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
b95e04
---
b95e04
 src/set_elem.c | 13 +++++++++++++
b95e04
 1 file changed, 13 insertions(+)
b95e04
b95e04
diff --git a/src/set_elem.c b/src/set_elem.c
b95e04
index 2203193..4421322 100644
b95e04
--- a/src/set_elem.c
b95e04
+++ b/src/set_elem.c
b95e04
@@ -162,6 +162,12 @@ int nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr,
b95e04
 		if (!s->objref)
b95e04
 			return -1;
b95e04
 		break;
b95e04
+	case NFTNL_SET_ELEM_EXPR:
b95e04
+		if (s->flags & (1 << NFTNL_SET_ELEM_EXPR))
b95e04
+			nftnl_expr_free(s->expr);
b95e04
+
b95e04
+		s->expr = (void *)data;
b95e04
+		break;
b95e04
 	}
b95e04
 	s->flags |= (1 << attr);
b95e04
 	return 0;
b95e04
@@ -326,6 +332,13 @@ void nftnl_set_elem_nlmsg_build_payload(struct nlmsghdr *nlh,
b95e04
 		mnl_attr_put(nlh, NFTA_SET_ELEM_USERDATA, e->user.len, e->user.data);
b95e04
 	if (e->flags & (1 << NFTNL_SET_ELEM_OBJREF))
b95e04
 		mnl_attr_put_strz(nlh, NFTA_SET_ELEM_OBJREF, e->objref);
b95e04
+	if (e->flags & (1 << NFTNL_SET_ELEM_EXPR)) {
b95e04
+		struct nlattr *nest1;
b95e04
+
b95e04
+		nest1 = mnl_attr_nest_start(nlh, NFTA_SET_ELEM_EXPR);
b95e04
+		nftnl_expr_build_payload(nlh, e->expr);
b95e04
+		mnl_attr_nest_end(nlh, nest1);
b95e04
+	}
b95e04
 }
b95e04
 
b95e04
 static void nftnl_set_elem_nlmsg_build_def(struct nlmsghdr *nlh,
b95e04
-- 
b95e04
2.31.1
b95e04