Skip to content

Commit a32e0ee

Browse files
cdelstondavem330
authored andcommitted
l2tp: introduce L2TPv3 IP encapsulation support for IPv6
L2TPv3 defines an IP encapsulation packet format where data is carried directly over IP (no UDP). The kernel already has support for L2TP IP encapsulation over IPv4 (l2tp_ip). This patch introduces support for L2TP IP encapsulation over IPv6. The implementation is derived from ipv6/raw and ipv4/l2tp_ip. Signed-off-by: Chris Elston <[email protected]> Signed-off-by: James Chapman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a495f83 commit a32e0ee

File tree

3 files changed

+812
-0
lines changed

3 files changed

+812
-0
lines changed

include/linux/l2tp.h

+17
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/socket.h>
1212
#ifdef __KERNEL__
1313
#include <linux/in.h>
14+
#include <linux/in6.h>
1415
#else
1516
#include <netinet/in.h>
1617
#endif
@@ -39,6 +40,22 @@ struct sockaddr_l2tpip {
3940
sizeof(__u32)];
4041
};
4142

43+
/**
44+
* struct sockaddr_l2tpip6 - the sockaddr structure for L2TP-over-IPv6 sockets
45+
* @l2tp_family: address family number AF_L2TPIP.
46+
* @l2tp_addr: protocol specific address information
47+
* @l2tp_conn_id: connection id of tunnel
48+
*/
49+
struct sockaddr_l2tpip6 {
50+
/* The first fields must match struct sockaddr_in6 */
51+
__kernel_sa_family_t l2tp_family; /* AF_INET6 */
52+
__be16 l2tp_unused; /* INET port number (unused) */
53+
__be32 l2tp_flowinfo; /* IPv6 flow information */
54+
struct in6_addr l2tp_addr; /* IPv6 address */
55+
__u32 l2tp_scope_id; /* scope id (new in RFC2553) */
56+
__u32 l2tp_conn_id; /* Connection ID of tunnel */
57+
};
58+
4259
/*****************************************************************************
4360
* NETLINK_GENERIC netlink family.
4461
*****************************************************************************/

net/l2tp/Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ obj-$(subst y,$(CONFIG_L2TP),$(CONFIG_L2TP_IP)) += l2tp_ip.o
1010
obj-$(subst y,$(CONFIG_L2TP),$(CONFIG_L2TP_V3)) += l2tp_netlink.o
1111
obj-$(subst y,$(CONFIG_L2TP),$(CONFIG_L2TP_ETH)) += l2tp_eth.o
1212
obj-$(subst y,$(CONFIG_L2TP),$(CONFIG_L2TP_DEBUGFS)) += l2tp_debugfs.o
13+
ifneq ($(CONFIG_IPV6),)
14+
obj-$(subst y,$(CONFIG_L2TP),$(CONFIG_L2TP_IP)) += l2tp_ip6.o
15+
endif

0 commit comments

Comments
 (0)