netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libnftnl] expr: add nftnl_rule_del_expr()
@ 2020-10-19 12:49 Pablo Neira Ayuso
  0 siblings, 0 replies; only message in thread
From: Pablo Neira Ayuso @ 2020-10-19 12:49 UTC (permalink / raw)
  To: netfilter-devel

Add a function to remove expression from the rule list.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/libnftnl/rule.h | 1 +
 src/libnftnl.map        | 1 +
 src/rule.c              | 6 ++++++
 3 files changed, 8 insertions(+)

diff --git a/include/libnftnl/rule.h b/include/libnftnl/rule.h
index e5d1ca0534b7..b6b93c62b840 100644
--- a/include/libnftnl/rule.h
+++ b/include/libnftnl/rule.h
@@ -51,6 +51,7 @@ uint32_t nftnl_rule_get_u32(const struct nftnl_rule *r, uint16_t attr);
 uint64_t nftnl_rule_get_u64(const struct nftnl_rule *r, uint16_t attr);
 
 void nftnl_rule_add_expr(struct nftnl_rule *r, struct nftnl_expr *expr);
+void nftnl_rule_del_expr(struct nftnl_expr *expr);
 
 struct nlmsghdr;
 
diff --git a/src/libnftnl.map b/src/libnftnl.map
index 7937e05b669d..2d35ace0355b 100644
--- a/src/libnftnl.map
+++ b/src/libnftnl.map
@@ -372,4 +372,5 @@ LIBNFTNL_14 {
 LIBNFTNL_15 {
   nftnl_obj_get_data;
   nftnl_expr_build_payload;
+  nftnl_rule_del_expr;
 } LIBNFTNL_14;
diff --git a/src/rule.c b/src/rule.c
index 8d7e0681cb42..480afc8ffc1b 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -330,6 +330,12 @@ void nftnl_rule_add_expr(struct nftnl_rule *r, struct nftnl_expr *expr)
 	list_add_tail(&expr->head, &r->expr_list);
 }
 
+EXPORT_SYMBOL(nftnl_rule_del_expr);
+void nftnl_rule_del_expr(struct nftnl_expr *expr)
+{
+	list_del(&expr->head);
+}
+
 static int nftnl_rule_parse_attr_cb(const struct nlattr *attr, void *data)
 {
 	const struct nlattr **tb = data;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-19 12:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 12:49 [PATCH libnftnl] expr: add nftnl_rule_del_expr() Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).