Blame SOURCES/0012-set-expose-nftnl_set_elem_nlmsg_build.patch

54a5e4
From 3fb9a2e1b66e931453b18b022b0a364a66699580 Mon Sep 17 00:00:00 2001
54a5e4
From: Phil Sutter <psutter@redhat.com>
54a5e4
Date: Fri, 21 Jan 2022 13:48:20 +0100
54a5e4
Subject: [PATCH] set: expose nftnl_set_elem_nlmsg_build()
54a5e4
54a5e4
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2040754
54a5e4
Upstream Status: libnftnl commit 8d74a15d941c6
54a5e4
Conflicts: Adjusted symbol version name to avoid confusion with upstream
54a5e4
           versions.
54a5e4
54a5e4
commit 8d74a15d941c69b7d0f5961be1e56b87ca3235d0
54a5e4
Author: Pablo Neira Ayuso <pablo@netfilter.org>
54a5e4
Date:   Thu Nov 4 14:09:44 2021 +0100
54a5e4
54a5e4
    set: expose nftnl_set_elem_nlmsg_build()
54a5e4
54a5e4
    Expose a function to build one single set element netlink message.
54a5e4
54a5e4
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
54a5e4
---
54a5e4
 include/libnftnl/set.h | 2 ++
54a5e4
 src/libnftnl.map       | 4 ++++
54a5e4
 src/set_elem.c         | 9 +++++----
54a5e4
 3 files changed, 11 insertions(+), 4 deletions(-)
54a5e4
54a5e4
diff --git a/include/libnftnl/set.h b/include/libnftnl/set.h
54a5e4
index 6843adf..99d692e 100644
54a5e4
--- a/include/libnftnl/set.h
54a5e4
+++ b/include/libnftnl/set.h
54a5e4
@@ -135,6 +135,8 @@ bool nftnl_set_elem_is_set(const struct nftnl_set_elem *s, uint16_t attr);
54a5e4
 #define nftnl_set_elem_nlmsg_build_hdr	nftnl_nlmsg_build_hdr
54a5e4
 void nftnl_set_elems_nlmsg_build_payload(struct nlmsghdr *nlh, struct nftnl_set *s);
54a5e4
 void nftnl_set_elem_nlmsg_build_payload(struct nlmsghdr *nlh, struct nftnl_set_elem *e);
54a5e4
+struct nlattr *nftnl_set_elem_nlmsg_build(struct nlmsghdr *nlh,
54a5e4
+					  struct nftnl_set_elem *elem, int i);
54a5e4
 
54a5e4
 int nftnl_set_elem_parse(struct nftnl_set_elem *e, enum nftnl_parse_type type,
54a5e4
 		       const char *data, struct nftnl_parse_err *err);
54a5e4
diff --git a/src/libnftnl.map b/src/libnftnl.map
54a5e4
index 8230d15..0799570 100644
54a5e4
--- a/src/libnftnl.map
54a5e4
+++ b/src/libnftnl.map
54a5e4
@@ -359,3 +359,7 @@ LIBNFTNL_13 {
54a5e4
   nftnl_obj_set_data;
54a5e4
   nftnl_flowtable_set_data;
54a5e4
 } LIBNFTNL_12;
54a5e4
+
54a5e4
+LIBNFTNL_RHEL_14 {
54a5e4
+  nftnl_set_elem_nlmsg_build;
54a5e4
+} LIBNFTNL_13;
54a5e4
diff --git a/src/set_elem.c b/src/set_elem.c
54a5e4
index 4421322..ce1a976 100644
54a5e4
--- a/src/set_elem.c
54a5e4
+++ b/src/set_elem.c
54a5e4
@@ -352,8 +352,9 @@ static void nftnl_set_elem_nlmsg_build_def(struct nlmsghdr *nlh,
54a5e4
 		mnl_attr_put_strz(nlh, NFTA_SET_ELEM_LIST_TABLE, s->table);
54a5e4
 }
54a5e4
 
54a5e4
-static struct nlattr *nftnl_set_elem_build(struct nlmsghdr *nlh,
54a5e4
-					      struct nftnl_set_elem *elem, int i)
54a5e4
+EXPORT_SYMBOL(nftnl_set_elem_nlmsg_build);
54a5e4
+struct nlattr *nftnl_set_elem_nlmsg_build(struct nlmsghdr *nlh,
54a5e4
+					  struct nftnl_set_elem *elem, int i)
54a5e4
 {
54a5e4
 	struct nlattr *nest2;
54a5e4
 
54a5e4
@@ -378,7 +379,7 @@ void nftnl_set_elems_nlmsg_build_payload(struct nlmsghdr *nlh, struct nftnl_set
54a5e4
 
54a5e4
 	nest1 = mnl_attr_nest_start(nlh, NFTA_SET_ELEM_LIST_ELEMENTS);
54a5e4
 	list_for_each_entry(elem, &s->element_list, head)
54a5e4
-		nftnl_set_elem_build(nlh, elem, ++i);
54a5e4
+		nftnl_set_elem_nlmsg_build(nlh, elem, ++i);
54a5e4
 
54a5e4
 	mnl_attr_nest_end(nlh, nest1);
54a5e4
 }
54a5e4
@@ -818,7 +819,7 @@ int nftnl_set_elems_nlmsg_build_payload_iter(struct nlmsghdr *nlh,
54a5e4
 	nest1 = mnl_attr_nest_start(nlh, NFTA_SET_ELEM_LIST_ELEMENTS);
54a5e4
 	elem = nftnl_set_elems_iter_next(iter);
54a5e4
 	while (elem != NULL) {
54a5e4
-		nest2 = nftnl_set_elem_build(nlh, elem, ++i);
54a5e4
+		nest2 = nftnl_set_elem_nlmsg_build(nlh, elem, ++i);
54a5e4
 		if (nftnl_attr_nest_overflow(nlh, nest1, nest2)) {
54a5e4
 			/* Go back to previous not to miss this element */
54a5e4
 			iter->cur = list_entry(iter->cur->head.prev,
54a5e4
-- 
54a5e4
2.31.1
54a5e4