netfilter: nf_tables: support for multiple devices per netdev hook
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH v2 5/5 netfilter: nf_tables: support for multiple devices per netdev hook
This patch allows you to register one netdev basechain to multiple devices. This adds a new NFTA_HOOK_DEVS netlink attribute to specify the list of netdevices. Basechains store a list of hooks.
Signed-off-by Pablo Neira Ayuso <[email protected]>
---
v2: update nft_flow_offload_chain() and nft_flow_block_chain() to deal with
this list of hooks.
include/net/netfilter/nf_tables.h | 4 +- include/uapi/linux/netfilter/nf_tables.h | 2 + net/netfilter/nf_tables_api.c | 296 ++++++++++++++++++++++++------- net/netfilter/nf_tables_offload.c | 44 +++-- net/netfilter/nft_chain_filter.c | 45 +++-- 5 files changed, 293 insertions(+), 98 deletions(-)
include/net/netfilter/nf_tables.h +2 -2
@@ -973,21 +973,21 @@ struct nft_hook {* struct nft_base_chain - nf_tables base chain * * @ops: netfilter hook ops +* @hook_list: list of netfilter hooks (for NFPROTO_NETDEV family) * @type: chain type * @policy: default policy * @stats: per-cpu chain stats * @chain: the chain -* @dev_name: device name that this base chain is attached to (if any) * @flow_block: flow block (for hardware offload) */ struct nft_base_chain {struct nf_hook_ops ops; +struct list_head hook_list;const struct nft_chain_type *type;u8 policy;u8 flags;struct nft_stats __percpu *stats;struct nft_chain chain; -char dev_name[IFNAMSIZ ];struct flow_block flow_block; };
include/uapi/linux/netfilter/nf_tables.h +2 -0
@@ -144,12 +144,14 @@ enum nft_list_attributes {* @NFTA_HOOK_HOOKNUM: netfilter hook number (NLA_U32) * @NFTA_HOOK_PRIORITY: netfilter hook priority (NLA_U32) * @NFTA_HOOK_DEV: netdevice name (NLA_STRING) +* @NFTA_HOOK_DEVS: list of netdevices (NLA_NESTED) */ enum nft_hook_attributes {NFTA_HOOK_UNSPEC ,NFTA_HOOK_HOOKNUM ,NFTA_HOOK_PRIORITY ,NFTA_HOOK_DEV , +NFTA_HOOK_DEVS , __NFTA_HOOK_MAX };#define NFTA_HOOK_MAX (__NFTA_HOOK_MAX - 1)
net/netfilter/nf_tables_api.c +232 -64
433 lines not on this page · raw message
net/netfilter/nf_tables_offload.c +31 -13
83 lines not on this page · raw message
net/netfilter/nft_chain_filter.c +26 -19
54 lines not on this page · raw message
Signature · 1 line
2.11.0