Skip to contentSkip to conversation

netfilter: nftables: netlink support for several set element expressions

PATCH New Pablo Neira Ayuso 1 participant 1 message Dec 9, 2020

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH v2 5/5 netfilter: nftables: netlink support for several set element expressions

This patch adds three new netlink attribute to encapsulate a list of expressions per set elements:

- NFTA_SET_EXPRESSIONS: this attribute provides the set definition in terms of expressions. New set elements get attached the list of expressions that is specified by this new netlink attribute.
- NFTA_SET_ELEM_EXPRESSIONS: this attribute allows users to restore (or initialize) the stateful information of set elements when adding an element to the set.
- NFTA_DYNSET_EXPRESSIONS: this attribute specifies the list of expressions that the set element gets when it is inserted from the packet path.

---
v2: missing check for NFTA_DYNSET_EXPRESSION (Florian)
Remove unnecessary nest attribute in NFTA_SET_ELEM_EXPR, use NFTA_LIST_ITEM instead.

 include/uapi/linux/netfilter/nf_tables.h |  3 +
 net/netfilter/nf_tables_api.c            | 88 +++++++++++++++++++++++-
 net/netfilter/nft_dynset.c               | 43 +++++++++++-
 3 files changed, 128 insertions(+), 6 deletions(-)
include/uapi/linux/netfilter/nf_tables.h +3 -0
index 98272cb5f617..42e4c4cb0daa 100644
@@ -381,6 +381,7 @@ enum nft_set_attributes {
 	NFTA_SET_OBJ_TYPE,
 	NFTA_SET_HANDLE,
 	NFTA_SET_EXPR,
+	NFTA_SET_EXPRESSIONS,
 	__NFTA_SET_MAX
 };
 #define NFTA_SET_MAX		(__NFTA_SET_MAX - 1)
@@ -419,6 +420,7 @@ enum nft_set_elem_attributes {
 	NFTA_SET_ELEM_PAD,
 	NFTA_SET_ELEM_OBJREF,
 	NFTA_SET_ELEM_KEY_END,
+	NFTA_SET_ELEM_EXPRESSIONS,
 	__NFTA_SET_ELEM_MAX
 };
 #define NFTA_SET_ELEM_MAX	(__NFTA_SET_ELEM_MAX - 1)
@@ -725,6 +727,7 @@ enum nft_dynset_attributes {
 	NFTA_DYNSET_SREG_DATA,
 	NFTA_DYNSET_TIMEOUT,
 	NFTA_DYNSET_EXPR,
+	NFTA_DYNSET_EXPRESSIONS,
 	NFTA_DYNSET_PAD,
 	NFTA_DYNSET_FLAGS,
 	__NFTA_DYNSET_MAX,
net/netfilter/nf_tables_api.c +85 -3

150 lines not on this page · raw message

net/netfilter/nft_dynset.c +40 -3

70 lines not on this page · raw message

Signature · 1 line
2.20.1