Skip to contentSkip to conversation

netfilter: nf_tables: add vlan support

PATCH In review [email protected] 2 participants 2 messages Oct 18, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 netfilter: nf_tables: add vlan support

From: wenxu <[email protected]>

This patch implements the vlan expr type that can be used to configure vlan tci and vlan proto

---
 include/uapi/linux/netfilter/nf_tables.h |  24 +++++
 net/netfilter/Kconfig                    |   6 ++
 net/netfilter/Makefile                   |   1 +
 net/netfilter/nft_vlan.c                 | 161 +++++++++++++++++++++++++++++++
 4 files changed, 192 insertions(+)
 create mode 100644 net/netfilter/nft_vlan.c
include/uapi/linux/netfilter/nf_tables.h +24 -0
index ed8881a..d4bc13c 100644
@@ -1794,4 +1794,28 @@ enum nft_tunnel_attributes {
 };
 #define NFTA_TUNNEL_MAX	(__NFTA_TUNNEL_MAX - 1)
 
+enum nft_vlan_action {
+	NFT_VLAN_ACTION_PUSH,
+	NFT_VLAN_ACTION_POP,
+	NFT_VLAN_ACTION_MODIFY,
+	__NFT_VLAN_ACTION_MAX
+};
+#define NFT_VLAN_ACTION_MAX	(__NFT_VLAN_ACTION_MAX - 1)
+
+/**
+ * enum nft_vlan_attributes - nf_tables vlan expression netlink attributes
+ *
+ * @NFTA_VLAN_ACTION: vlan data item to load (NLA_U32: nft_vlan_action)
+ * @NFTA_VLAN_SREG: source register (NLA_U16)
+ * @NFTA_VLAN_SREG2: source register (NLA_U16)
+ */
+enum nft_vlan_attributes {
+	NFTA_VLAN_UNSPEC,
+	NFTA_VLAN_ACTION,
+	NFTA_VLAN_SREG,
+	NFTA_VLAN_SREG2,
+	__NFTA_VLAN_MAX
+};
+#define NFTA_VLAN_MAX		(__NFTA_VLAN_MAX - 1)
+
 #endif /* _LINUX_NF_TABLES_H */
net/netfilter/Kconfig +6 -0
index 91efae8..bd3cb26 100644
@@ -556,6 +556,12 @@ config NFT_TUNNEL
 	  This option adds the "tunnel" expression that you can use to set
 	  tunneling policies.
 
+config NFT_VLAN
+	tristate "Netfilter nf_tables vlan module"
+	help
+	  This option adds the "vlan" expression that you can use to set
+	  vlan policies.
+
 config NFT_OBJREF
 	tristate "Netfilter nf_tables stateful object reference module"
 	help
net/netfilter/Makefile +1 -0
index 4fc075b..e91f93e 100644
@@ -111,6 +111,7 @@ obj-$(CONFIG_NFT_OSF)		+= nft_osf.o
 obj-$(CONFIG_NFT_TPROXY)	+= nft_tproxy.o
 obj-$(CONFIG_NFT_XFRM)		+= nft_xfrm.o
 obj-$(CONFIG_NFT_SYNPROXY)	+= nft_synproxy.o
+obj-$(CONFIG_NFT_VLAN)		+= nft_vlan.o
 
 obj-$(CONFIG_NFT_NAT)		+= nft_chain_nat.o
 
net/netfilter/nft_vlan.c new file +161 -0

161 lines not on this page · raw message

Signature · 1 line
1.8.3.1