From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, Chloro Dose <chlorodose@gmail.com>
Subject: [libnftnl PATCH] set{,_elem}: Drop nftnl_set{,_elem}_clone()
Date: Thu, 19 Mar 2026 10:06:13 +0100 [thread overview]
Message-ID: <20260319090613.13874-1-phil@nwl.cc> (raw)
These functions were never exported and are not used internally anymore.
Maybe due to that, they became incorrect (e.g., they ignore expr_list)
so drop them altogether.
Fixes: 80077787f8f21 ("src: remove json support")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
include/libnftnl/set.h | 4 ----
src/set.c | 39 ---------------------------------------
src/set_elem.c | 22 ----------------------
3 files changed, 65 deletions(-)
diff --git a/include/libnftnl/set.h b/include/libnftnl/set.h
index f2edca20f9e07..c21079f123984 100644
--- a/include/libnftnl/set.h
+++ b/include/libnftnl/set.h
@@ -42,8 +42,6 @@ struct nftnl_set;
struct nftnl_set *nftnl_set_alloc(void);
void nftnl_set_free(const struct nftnl_set *s);
-struct nftnl_set *nftnl_set_clone(const struct nftnl_set *set);
-
bool nftnl_set_is_set(const struct nftnl_set *s, uint16_t attr);
void nftnl_set_unset(struct nftnl_set *s, uint16_t attr);
int nftnl_set_set(struct nftnl_set *s, uint16_t attr, const void *data) __attribute__((deprecated));
@@ -125,8 +123,6 @@ struct nftnl_set_elem;
struct nftnl_set_elem *nftnl_set_elem_alloc(void);
void nftnl_set_elem_free(struct nftnl_set_elem *s);
-struct nftnl_set_elem *nftnl_set_elem_clone(struct nftnl_set_elem *elem);
-
void nftnl_set_elem_add(struct nftnl_set *s, struct nftnl_set_elem *elem);
void nftnl_set_elem_unset(struct nftnl_set_elem *s, uint16_t attr);
diff --git a/src/set.c b/src/set.c
index 54674bca709fd..a017017e1fb6d 100644
--- a/src/set.c
+++ b/src/set.c
@@ -360,45 +360,6 @@ uint64_t nftnl_set_get_u64(const struct nftnl_set *s, uint16_t attr)
return val ? *val : 0;
}
-struct nftnl_set *nftnl_set_clone(const struct nftnl_set *set)
-{
- struct nftnl_set *newset;
- struct nftnl_set_elem *elem, *newelem;
-
- newset = nftnl_set_alloc();
- if (newset == NULL)
- return NULL;
-
- memcpy(newset, set, sizeof(*set));
-
- if (set->flags & (1 << NFTNL_SET_TABLE)) {
- newset->table = strdup(set->table);
- if (!newset->table)
- goto err;
- }
- if (set->flags & (1 << NFTNL_SET_NAME)) {
- newset->name = strdup(set->name);
- if (!newset->name)
- goto err;
- }
-
- INIT_LIST_HEAD(&newset->element_list);
- list_for_each_entry(elem, &set->element_list, head) {
- newelem = nftnl_set_elem_clone(elem);
- if (newelem == NULL)
- goto err;
-
- list_add_tail(&newelem->head, &newset->element_list);
- }
-
- newset->type = NULL;
-
- return newset;
-err:
- nftnl_set_free(newset);
- return NULL;
-}
-
static void nftnl_set_nlmsg_build_desc_size_payload(struct nlmsghdr *nlh,
struct nftnl_set *s)
{
diff --git a/src/set_elem.c b/src/set_elem.c
index 3e0ab0cf50876..83c65ee33548d 100644
--- a/src/set_elem.c
+++ b/src/set_elem.c
@@ -292,28 +292,6 @@ uint64_t nftnl_set_elem_get_u64(struct nftnl_set_elem *s, uint16_t attr)
return val;
}
-struct nftnl_set_elem *nftnl_set_elem_clone(struct nftnl_set_elem *elem)
-{
- struct nftnl_set_elem *newelem;
-
- newelem = nftnl_set_elem_alloc();
- if (newelem == NULL)
- return NULL;
-
- memcpy(newelem, elem, sizeof(*elem));
-
- if (elem->flags & (1 << NFTNL_SET_ELEM_CHAIN)) {
- newelem->data.chain = strdup(elem->data.chain);
- if (!newelem->data.chain)
- goto err;
- }
-
- return newelem;
-err:
- nftnl_set_elem_free(newelem);
- return NULL;
-}
-
EXPORT_SYMBOL(nftnl_set_elem_nlmsg_build_payload);
void nftnl_set_elem_nlmsg_build_payload(struct nlmsghdr *nlh,
struct nftnl_set_elem *e)
--
2.51.0
next reply other threads:[~2026-03-19 9:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 9:06 Phil Sutter [this message]
2026-03-19 9:18 ` [libnftnl PATCH] set{,_elem}: Drop nftnl_set{,_elem}_clone() Florian Westphal
2026-03-19 9:32 ` Phil Sutter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260319090613.13874-1-phil@nwl.cc \
--to=phil@nwl.cc \
--cc=chlorodose@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.