Skip to contentSkip to conversation

netfilter updates for net-next

PATCH In review Pablo Neira Ayuso 2 participants 3 messages Jan 10, 2014

Subsystems (3)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter updates for net-next

Hi David,

This batch contains one single patch with the l2tp match for xtables, from James Chapman.

You can pull these changes from:

git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master

Thanks!

----------------------------------------------------------------

You can pull these changes from:

The following changes since commit d0eb1f7e66dd53355746cd6a8e7e56c465dc6cde:

ip_tunnel: fix sparse non static symbol warning (2014-01-09 14:31:47 -0500)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master

for you to fetch changes up to 74f77a6b2b1c98d3f14364dccdd2353b99ecfeda:

netfilter: introduce l2tp match extension (2014-01-09 21:36:39 +0100)

----------------------------------------------------------------
James Chapman (1):
netfilter: introduce l2tp match extension

 include/uapi/linux/netfilter/Kbuild    |    1 +
 include/uapi/linux/netfilter/xt_l2tp.h |   27 +++
 net/netfilter/Kconfig                  |   10 +
 net/netfilter/Makefile                 |    1 +
 net/netfilter/xt_l2tp.c                |  354 ++++++++++++++++++++++++++++++++
 5 files changed, 393 insertions(+)
 create mode 100644 include/uapi/linux/netfilter/xt_l2tp.h
 create mode 100644 net/netfilter/xt_l2tp.c
author maintainer
#1 lore raw

PATCH 1/1 netfilter: introduce l2tp match extension

From: James Chapman <[email protected]>

Introduce an xtables add-on for matching L2TP packets. Supports L2TPv2 and L2TPv3 over IPv4 and IPv6. As well as filtering on L2TP tunnel-id and session-id, the filtering decision can also include the L2TP packet type (control or data), protocol version (2 or 3) and encapsulation type (UDP or IP).

The most common use for this will likely be to filter L2TP data packets of individual L2TP tunnels or sessions. While a u32 match can be used, the L2TP protocol headers are such that field offsets differ depending on bits set in the header, making rules for matching generic L2TP connections cumbersome. This match extension takes care of all that.

---
 include/uapi/linux/netfilter/Kbuild    |    1 +
 include/uapi/linux/netfilter/xt_l2tp.h |   27 +++
 net/netfilter/Kconfig                  |   10 +
 net/netfilter/Makefile                 |    1 +
 net/netfilter/xt_l2tp.c                |  354 ++++++++++++++++++++++++++++++++
 5 files changed, 393 insertions(+)
 create mode 100644 include/uapi/linux/netfilter/xt_l2tp.h
 create mode 100644 net/netfilter/xt_l2tp.c
include/uapi/linux/netfilter/Kbuild +1 -0
index 2344f5a..1d973d2 100644
@@ -58,6 +58,7 @@ header-y += xt_helper.h
 header-y += xt_ipcomp.h
 header-y += xt_iprange.h
 header-y += xt_ipvs.h
+header-y += xt_l2tp.h
 header-y += xt_length.h
 header-y += xt_limit.h
 header-y += xt_mac.h
include/uapi/linux/netfilter/xt_l2tp.h new file +27 -0
new file mode 100644
index 0000000..7dccfa0
@@ -0,0 +1,27 @@
+#ifndef _LINUX_NETFILTER_XT_L2TP_H
+#define _LINUX_NETFILTER_XT_L2TP_H
+
+#include <linux/types.h>
+
+enum xt_l2tp_type {
+	XT_L2TP_TYPE_CONTROL,
+	XT_L2TP_TYPE_DATA,
+};
+
+/* L2TP matching stuff */
+struct xt_l2tp_info {
+	__u32 tid;			/* tunnel id */
+	__u32 sid;			/* session id */
+	__u8 version;			/* L2TP protocol version */
+	__u8 type;			/* L2TP packet type */
+	__u8 flags;			/* which fields to match */
+};
+
+enum {
+	XT_L2TP_TID	= (1 << 0),	/* match L2TP tunnel id */
+	XT_L2TP_SID	= (1 << 1),	/* match L2TP session id */
+	XT_L2TP_VERSION	= (1 << 2),	/* match L2TP protocol version */
+	XT_L2TP_TYPE	= (1 << 3),	/* match L2TP packet type */
+};
+
+#endif /* _LINUX_NETFILTER_XT_L2TP_H */
net/netfilter/Kconfig +10 -0
index c3b3b26..a1be47b 100644
@@ -1131,6 +1131,16 @@ config NETFILTER_XT_MATCH_IPVS
 
 	  If unsure, say N.
 
+config NETFILTER_XT_MATCH_L2TP
+	tristate '"l2tp" match support'
+	depends on NETFILTER_ADVANCED
+	default L2TP
+	---help---
+	This option adds an "L2TP" match, which allows you to match against
+	L2TP protocol header fields.
+
+	To compile it as a module, choose M here. If unsure, say N.
+
 config NETFILTER_XT_MATCH_LENGTH
 	tristate '"length" match support'
 	depends on NETFILTER_ADVANCED
net/netfilter/Makefile +1 -0
index 78b4e1c..b8bc5b8 100644
@@ -137,6 +137,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_HL) += xt_hl.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_IPCOMP) += xt_ipcomp.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_IPRANGE) += xt_iprange.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_IPVS) += xt_ipvs.o
+obj-$(CONFIG_NETFILTER_XT_MATCH_L2TP) += xt_l2tp.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_LENGTH) += xt_length.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_LIMIT) += xt_limit.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_MAC) += xt_mac.o
net/netfilter/xt_l2tp.c new file +354 -0

354 lines not on this page · raw message

Signature · 1 line
1.7.10.4
maintainer
#2 lore raw
In reply to Pablo Neira Ayuso

From: Pablo Neira Ayuso <[email protected]>
Date: Fri, 10 Jan 2014 19:55:57 +0100

Quoted 6 lines

This batch contains one single patch with the l2tp match for xtables, from James Chapman.

You can pull these changes from:

git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master

Pulled, thanks Pablo.