[PATCH libnftnl] rule: add nftnl_rule_list_insert_at()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allow to add rule object before any existing rule.

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

diff --git a/include/libnftnl/rule.h b/include/libnftnl/rule.h
index 947994364bd8..765d2ce6e4ef 100644
--- a/include/libnftnl/rule.h
+++ b/include/libnftnl/rule.h
@@ -84,6 +84,7 @@ void nftnl_rule_list_free(struct nftnl_rule_list *list);
 int nftnl_rule_list_is_empty(const struct nftnl_rule_list *list);
 void nftnl_rule_list_add(struct nftnl_rule *r, struct nftnl_rule_list *list);
 void nftnl_rule_list_add_tail(struct nftnl_rule *r, struct nftnl_rule_list *list);
+void nftnl_rule_list_insert_at(struct nftnl_rule *r, struct nftnl_rule *pos);
 void nftnl_rule_list_del(struct nftnl_rule *r);
 int nftnl_rule_list_foreach(struct nftnl_rule_list *rule_list, int (*cb)(struct nftnl_rule *t, void *data), void *data);
 
diff --git a/src/libnftnl.map b/src/libnftnl.map
index a24fe9b4dae9..0d6b20c8f14b 100644
--- a/src/libnftnl.map
+++ b/src/libnftnl.map
@@ -342,3 +342,7 @@ LIBNFTNL_7 {
   nftnl_flowtable_list_foreach;
 
 } LIBNFTNL_6;
+
+LIBNFTNL_8 {
+  nftnl_rule_list_insert_at;
+} LIBNFTNL_7;
diff --git a/src/rule.c b/src/rule.c
index e4cba1f7a352..146b06ca91ef 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -986,6 +986,12 @@ void nftnl_rule_list_add(struct nftnl_rule *r, struct nftnl_rule_list *list)
 	list_add(&r->head, &list->list);
 }
 
+EXPORT_SYMBOL(nftnl_rule_list_insert_at);
+void nftnl_rule_list_insert_at(struct nftnl_rule *r, struct nftnl_rule *pos)
+{
+	list_add(&r->head, &pos->head);
+}
+
 EXPORT_SYMBOL(nftnl_rule_list_add_tail);
 void nftnl_rule_list_add_tail(struct nftnl_rule *r, struct nftnl_rule_list *list)
 {
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux