Skip to contentSkip to conversation

set: Export nftnl_set_list_lookup_byname()

PATCH In review Phil Sutter 2 participants 2 messages Oct 8, 2019 – Oct 9, 2019 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH v2 1/1 set: Export nftnl_set_list_lookup_byname()

Rename and optimize internal function nftnl_set_lookup() for external use. Just like with nftnl_chain_list, use a hash table for fast set name lookups.

---
Changes since v1:
- Adjust LIBVERSION according to libtool documentation.

---
 Make_global.am         |  2 +-
 include/libnftnl/set.h |  2 ++
 include/set.h          |  1 +
 src/libnftnl.map       |  4 ++++
 src/set.c              | 53 +++++++++++++++++++++++++++---------------
 5 files changed, 42 insertions(+), 20 deletions(-)
Make_global.am +1 -1
index d0394b3700671..ea848fdabae7c 100644
@@ -18,7 +18,7 @@
 # set age to 0.
 # </snippet>
 #
-LIBVERSION=12:0:1
+LIBVERSION=13:0:2
 
 AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_srcdir}/include ${LIBMNL_CFLAGS} ${LIBMXML_CFLAGS}
 AM_CFLAGS = ${regular_CFLAGS} ${GCC_FVISIBILITY_HIDDEN}
include/libnftnl/set.h +2 -0
index 67c54e9ae12c6..6640ad929f346 100644
@@ -75,6 +75,8 @@ void nftnl_set_list_add(struct nftnl_set *s, struct nftnl_set_list *list);
 void nftnl_set_list_add_tail(struct nftnl_set *s, struct nftnl_set_list *list);
 void nftnl_set_list_del(struct nftnl_set *s);
 int nftnl_set_list_foreach(struct nftnl_set_list *set_list, int (*cb)(struct nftnl_set *t, void *data), void *data);
+struct nftnl_set *nftnl_set_list_lookup_byname(struct nftnl_set_list *set_list,
+					       const char *set);
 
 struct nftnl_set_list_iter;
 struct nftnl_set_list_iter *nftnl_set_list_iter_create(const struct nftnl_set_list *l);
include/set.h +1 -0
index 3bcec7c8c1b39..446acd24ca7cc 100644
@@ -5,6 +5,7 @@
 
 struct nftnl_set {
 	struct list_head	head;
+	struct hlist_node	hnode;
 
 	uint32_t		family;
 	uint32_t		set_flags;
src/libnftnl.map +4 -0
index 3c6f8631c1e60..3ddb9468c96c3 100644
@@ -351,3 +351,7 @@ LIBNFTNL_12 {
   nftnl_chain_list_lookup_byname;
   nftnl_rule_lookup_byindex;
 } LIBNFTNL_11;
+
+LIBNFTNL_13 {
+  nftnl_set_list_lookup_byname;
+} LIBNFTNL_12;
src/set.c +34 -19

116 lines not on this page · raw message

Signature · 1 line
2.23.0