netfilter: nf_tables: add last expression
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH v3 1/1 netfilter: nf_tables: add last expression
Add a new optional expression that allows you to know when last match on a given rule / set element.
Signed-off-by Pablo Neira Ayuso <[email protected]>
---
v3: add forward declaration to nf_tables_core.h
remove init/fini module functions
include/net/netfilter/nf_tables_core.h | 1 + include/uapi/linux/netfilter/nf_tables.h | 13 ++++ net/netfilter/Makefile | 2 +- net/netfilter/nf_tables_core.c | 1 + net/netfilter/nft_last.c | 75 ++++++++++++++++++++++++ 5 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 net/netfilter/nft_last.c
include/net/netfilter/nf_tables_core.h +1 -0
@@ -16,6 +16,7 @@ extern struct nft_expr_type nft_range_type;extern struct nft_expr_type nft_meta_type;extern struct nft_expr_type nft_rt_type;extern struct nft_expr_type nft_exthdr_type; +extern struct nft_expr_type nft_last_type;#ifdef CONFIG_NETWORK_SECMARK extern struct nft_object_type nft_secmark_obj_type;
include/uapi/linux/netfilter/nf_tables.h +13 -0
@@ -1195,6 +1195,19 @@ enum nft_counter_attributes { };#define NFTA_COUNTER_MAX (__NFTA_COUNTER_MAX - 1) +/** +* enum nft_last_attributes - nf_tables last expression netlink attributes +* +* @NFTA_LAST_MSECS: milliseconds since last update (NLA_U64) +*/ +enum nft_last_attributes { +NFTA_LAST_UNSPEC , +NFTA_LAST_MSECS , +NFTA_LAST_PAD , + __NFTA_LAST_MAX +}; +#define NFTA_LAST_MAX (__NFTA_LAST_MAX - 1) +/** * enum nft_log_attributes - nf_tables log expression netlink attributes *
net/netfilter/Makefile +1 -1
@@ -74,7 +74,7 @@ obj-$(CONFIG_NF_DUP_NETDEV) += nf_dup_netdev.o nf_tables-objs := nf_tables_core.o nf_tables_api.o nft_chain_filter.o \ nf_tables_trace.o nft_immediate.o nft_cmp.o nft_range.o \ nft_bitwise.o nft_byteorder.o nft_payload.o nft_lookup.o \ - nft_dynset.o nft_meta.o nft_rt.o nft_exthdr.o \ + nft_dynset.o nft_meta.o nft_rt.o nft_exthdr.o nft_last.o \ nft_chain_route.o nf_tables_offload.o \ nft_set_hash.o nft_set_bitmap.o nft_set_rbtree.o \ nft_set_pipapo.o
net/netfilter/nf_tables_core.c +1 -0
@@ -268,6 +268,7 @@ static struct nft_expr_type *nft_basic_types[] = { &nft_meta_type, &nft_rt_type, &nft_exthdr_type, + &nft_last_type, }; static struct nft_object_type *nft_basic_objects[] = {
net/netfilter/nft_last.c new file +75 -0
75 lines not on this page · raw message
Signature · 1 line
2.30.2