Blob Blame History Raw
From 36faead4c4a8ab0a87ee766bab6a062e8610067a Mon Sep 17 00:00:00 2001
From: Phil Sutter <psutter@redhat.com>
Date: Tue, 29 Jan 2019 18:14:56 +0100
Subject: [PATCH] src: chain: Add missing nftnl_chain_rule_del()

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1666495
Upstream Status: libnftnl commit de5a23d26828a

commit de5a23d26828a1e1f2d3351b0414925857546496
Author: Phil Sutter <phil@nwl.cc>
Date:   Sun Dec 30 17:02:13 2018 +0100

    src: chain: Add missing nftnl_chain_rule_del()

    Although identical to nftnl_rule_list_del(), this function adheres to
    the common naming style of per chain rule list routines introduced
    earlier, therefore helps with deprecating the global rule list API at a
    later point.

    Fixes: e33798478176f ("chain: Support per chain rules list")
    Signed-off-by: Phil Sutter <phil@nwl.cc>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/libnftnl/chain.h | 1 +
 src/chain.c              | 6 ++++++
 src/libnftnl.map         | 1 +
 3 files changed, 8 insertions(+)

diff --git a/include/libnftnl/chain.h b/include/libnftnl/chain.h
index 64e10e9..163a824 100644
--- a/include/libnftnl/chain.h
+++ b/include/libnftnl/chain.h
@@ -56,6 +56,7 @@ int32_t nftnl_chain_get_s32(const struct nftnl_chain *c, uint16_t attr);
 uint64_t nftnl_chain_get_u64(const struct nftnl_chain *c, uint16_t attr);
 
 void nftnl_chain_rule_add(struct nftnl_rule *rule, struct nftnl_chain *c);
+void nftnl_chain_rule_del(struct nftnl_rule *rule);
 void nftnl_chain_rule_add_tail(struct nftnl_rule *rule, struct nftnl_chain *c);
 void nftnl_chain_rule_insert_at(struct nftnl_rule *rule, struct nftnl_rule *pos);
 
diff --git a/src/chain.c b/src/chain.c
index ae074fd..6dc8f36 100644
--- a/src/chain.c
+++ b/src/chain.c
@@ -429,6 +429,12 @@ void nftnl_chain_rule_add(struct nftnl_rule *rule, struct nftnl_chain *c)
 	list_add(&rule->head, &c->rule_list);
 }
 
+EXPORT_SYMBOL(nftnl_chain_rule_del);
+void nftnl_chain_rule_del(struct nftnl_rule *r)
+{
+	list_del(&r->head);
+}
+
 EXPORT_SYMBOL(nftnl_chain_rule_add_tail);
 void nftnl_chain_rule_add_tail(struct nftnl_rule *rule, struct nftnl_chain *c)
 {
diff --git a/src/libnftnl.map b/src/libnftnl.map
index 0d3be32..0dad6a2 100644
--- a/src/libnftnl.map
+++ b/src/libnftnl.map
@@ -340,6 +340,7 @@ local: *;
 LIBNFTNL_12 {
   nftnl_chain_rule_add;
   nftnl_chain_rule_add_tail;
+  nftnl_chain_rule_del;
   nftnl_chain_rule_insert_at;
   nftnl_rule_foreach;
   nftnl_rule_iter_create;
-- 
1.8.3.1