* [libnftnl PATCH] set{,_elem}: Drop nftnl_set{,_elem}_clone()
@ 2026-03-19 9:06 Phil Sutter
2026-03-19 9:18 ` Florian Westphal
0 siblings, 1 reply; 3+ messages in thread
From: Phil Sutter @ 2026-03-19 9:06 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel, Chloro Dose
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [libnftnl PATCH] set{,_elem}: Drop nftnl_set{,_elem}_clone()
2026-03-19 9:06 [libnftnl PATCH] set{,_elem}: Drop nftnl_set{,_elem}_clone() Phil Sutter
@ 2026-03-19 9:18 ` Florian Westphal
2026-03-19 9:32 ` Phil Sutter
0 siblings, 1 reply; 3+ messages in thread
From: Florian Westphal @ 2026-03-19 9:18 UTC (permalink / raw)
To: Phil Sutter; +Cc: Pablo Neira Ayuso, netfilter-devel, Chloro Dose
Phil Sutter <phil@nwl.cc> wrote:
> 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.
Acked-by: Florian Westphal <fw@strlen.de>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [libnftnl PATCH] set{,_elem}: Drop nftnl_set{,_elem}_clone()
2026-03-19 9:18 ` Florian Westphal
@ 2026-03-19 9:32 ` Phil Sutter
0 siblings, 0 replies; 3+ messages in thread
From: Phil Sutter @ 2026-03-19 9:32 UTC (permalink / raw)
To: Florian Westphal; +Cc: Pablo Neira Ayuso, netfilter-devel, Chloro Dose
On Thu, Mar 19, 2026 at 10:18:11AM +0100, Florian Westphal wrote:
> Phil Sutter <phil@nwl.cc> wrote:
> > 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.
>
> Acked-by: Florian Westphal <fw@strlen.de>
Patch applied! :)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-19 9:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 9:06 [libnftnl PATCH] set{,_elem}: Drop nftnl_set{,_elem}_clone() Phil Sutter
2026-03-19 9:18 ` Florian Westphal
2026-03-19 9:32 ` Phil Sutter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox