netfilter: nf_tables: add last expression
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH 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]>
--- include/uapi/linux/netfilter/nf_tables.h | 13 ++++ net/netfilter/Kconfig | 6 ++ net/netfilter/Makefile | 1 + net/netfilter/nft_last.c | 94 ++++++++++++++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 net/netfilter/nft_last.c
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: number of bytes (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/Kconfig +6 -0
@@ -509,6 +509,12 @@ config NFT_CONNLIMIT This option adds the "connlimit" expression that you can use to ratelimit rule matchings per connections. +config NFT_LAST + tristate "Netfilter nf_tables last module" + help + This option adds the "last" expression that you can use to know + when this rule has matched last time. + config NFT_LOG tristate "Netfilter nf_tables log module" help
net/netfilter/Makefile +1 -0
@@ -100,6 +100,7 @@ obj-$(CONFIG_NFT_REJECT_INET) += nft_reject_inet.o obj-$(CONFIG_NFT_REJECT_NETDEV) += nft_reject_netdev.o obj-$(CONFIG_NFT_TUNNEL) += nft_tunnel.o obj-$(CONFIG_NFT_COUNTER) += nft_counter.o +obj-$(CONFIG_NFT_LAST) += nft_last.o obj-$(CONFIG_NFT_LOG) += nft_log.o obj-$(CONFIG_NFT_MASQ) += nft_masq.o obj-$(CONFIG_NFT_REDIR) += nft_redir.o
net/netfilter/nft_last.c new file +94 -0
94 lines not on this page · raw message
Signature · 1 line
2.20.1
Florian Westphal
maintainerQuoted 2 lines · Pablo Neira Ayuso
Add a new optional expression that allows you to know when last match on a given rule / set element.
I think this is small enough to build this into nf_tables itself rather than a module.
Pablo Neira Ayuso
maintainerQuoted 6 lines · Florian Westphal
Quoted 2 lines · Pablo Neira Ayuso
Add a new optional expression that allows you to know when last match on a given rule / set element.
I think this is small enough to build this into
nf_tablesitself rather than a module.
I'll make it built-in.