l2tp: add ac/pppoe driver
Subsystems (4)
cover l2tp: add ac/pppoe driver
L2TPv2 tunnels are often used as a part of a home broadband connection, using a PPP link to connect the subscriber network into the Internet Service Provider's network.
In this scenario, PPPoE is widely used between the L2TP Access Concentrator (LAC) and the subscriber. The LAC effectively acts as a PPPoE server, switching PPP frames from incoming PPPoE packets into an L2TP session. The PPP session is then terminated at the L2TP Network Server (LNS) on the edge of the ISP's IP network.
This patchset adds a driver to the L2TP subsystem to support this mode of operation.
The new driver, l2tp_ac_pppoe, adds support for the existing pseudowire type L2TP_PWTYPE_PPP_AC, and is instantiated using the existing L2TP netlink L2TP_CMD_SESSION_CREATE. It is expected to be used as follows:
* A userspace PPPoE daemon running on the LAC handles the PPPoE discovery process up to the point of assigning a PPPoE session ID and sending the PADS packet to the PPPoE peer to establish the PPPoE session.
* Userspace code running on the LAC then instantiates an L2TP tunnel and session with the LNS using the L2TP control protocol.
* Finally, the data path for PPPoE session frames through the L2TP session to the LAC is instantiated by sending a genetlink L2TP_CMD_SESSION_CREATE command to the kernel, including the PPPoE-specific metadata required for L2TP_PWTYPE_PPP_AC sessions (this is documented in the patch series commit comments).
Supporting this driver submission we have two examples of userspace projects which use L2TP_PWTYPE_PPP_AC:
* https://github.com/katalix/l2tp-ktest
This is a unit-test suite for the kernel L2TP subsystem which has been updated to include basic lifetime and datapath tests for l2tp_ac_pppoe.
The new tests are automatically enabled when l2tp_ac_pppoe availability is detected, and hence support for l2tp_ac_pppoe is on the master branch of the git repository.
* https://github.com/katalix/go-l2tp
This is a Go library for building L2TP applications on Linux, and includes a suite of example daemons which utilise the library.
The daemon kpppoed implements the PPPoE discovery protocol, and spawns an instance of a daemon kl2tpd which handles the L2TP control protocol and instantiates the kernel data path.
The code utilising l2tp_ac_pppoe is on the branch tp_002_pppoe_1 pending merge of this patchset in the kernel.
Notes on the patchset itself:
* Patches 1-4 lay groundwork for the addition of the new driver, making tweaks to the l2tp netlink code to allow l2tp_ac_pppoe to access the netlink attributes it requires.
* Patch 5 adds the new driver itself and hooks it into the kernel configuration and build system.
* Patch 6 updates the l2tp documentation under Documentation/ to include information about the new driver.
Tom Parkin (6):
l2tp: add netlink info to session create callback
l2tp: tweak netlink session create to allow L2TPv2 ac_pppoe
l2tp: allow v2 netlink session create to pass ifname attribute
l2tp: add netlink attributes for ac_ppp session creation
l2tp: add ac_pppoe pseudowire driver
docs: networking: update l2tp.rst to document PPP_AC pseudowires
Documentation/networking/l2tp.rst | 69 +++-- include/uapi/linux/l2tp.h | 2 + net/l2tp/Kconfig | 7 + net/l2tp/Makefile | 1 + net/l2tp/l2tp_ac_pppoe.c | 446 ++++++++++++++++++++++++++++++ net/l2tp/l2tp_core.h | 4 +- net/l2tp/l2tp_eth.c | 3 +- net/l2tp/l2tp_netlink.c | 20 +- net/l2tp/l2tp_ppp.c | 3 +- 9 files changed, 527 insertions(+), 28 deletions(-) create mode 100644 net/l2tp/l2tp_ac_pppoe.c
Signature · 1 line
2.17.1
PATCH 1/6 l2tp: add netlink info to session create callback
To support creating different types of pseudowire, l2tp's netlink commands for session create and destroy are implemented using callbacks into pseudowire-specific code.
The pseudowire types implemented so far (PPP and Ethernet) use common parameters which are extracted by l2tp_netlink into a session configuration structure.
Different pseudowires may require different parameters: rather than adding these to the common configuration structure, make the netlink info visible to the pseudowire code so that it can perform its own validation of the extra attributes it requires.
--- net/l2tp/l2tp_core.h | 4 +++- net/l2tp/l2tp_eth.c | 3 ++- net/l2tp/l2tp_netlink.c | 3 ++- net/l2tp/l2tp_ppp.c | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-)
net/l2tp/l2tp_core.h +3 -1
@@ -10,6 +10,7 @@#include <net/dst.h> #include <net/sock.h> +#include <net/genetlink.h> #ifdef CONFIG_XFRM #include <net/xfrm.h>
@@ -196,7 +197,8 @@ struct l2tp_nl_cmd_ops {*/ int (*session_create)(struct net *net,struct l2tp_tunnel *tunnel,u32 session_id,u32 peer_session_id, -struct l2tp_session_cfg *cfg); +struct l2tp_session_cfg *cfg, +struct genl_info *info);/* The pseudowire session delete callback is responsible for initiating the deletion * of a session instance.
net/l2tp/l2tp_eth.c +2 -1
@@ -243,7 +243,8 @@ static void l2tp_eth_adjust_mtu(struct l2tp_tunnel *tunnel,static int l2tp_eth_create (struct net *net,struct l2tp_tunnel *tunnel,u32 session_id,u32 peer_session_id, -struct l2tp_session_cfg *cfg) +struct l2tp_session_cfg *cfg, +struct genl_info *info) {unsigned char name_assign_type;struct net_device *dev;
net/l2tp/l2tp_netlink.c +2 -1
@@ -629,7 +629,8 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf ret = l2tp_nl_cmd_ops[cfg.pw_type]->session_create (net, tunnel, session_id, peer_session_id, - &cfg); + &cfg, + info);if (ret >=0 ) { session =l2tp_tunnel_get_session (tunnel, session_id);
net/l2tp/l2tp_ppp.c +2 -1
@@ -853,7 +853,8 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,/* Called when creating sessions via the netlink interface. */ static int pppol2tp_session_create (struct net *net,struct l2tp_tunnel *tunnel,u32 session_id,u32 peer_session_id, -struct l2tp_session_cfg *cfg) +struct l2tp_session_cfg *cfg, +struct genl_info *info) {int error;struct l2tp_session *session;
Signature · 1 line
2.17.1
PATCH 2/6 l2tp: tweak netlink session create to allow L2TPv2 ac_pppoe
In reply to Tom ParkinWhen creating a session in an L2TPv2 tunnel, l2tp_netlink performs some sanity checking of pseudowire type to prevent L2TPv3 pseudowires from being instantiated in L2TPv2 tunnels.
To support PPPoE access concentrator functionality the L2TP subsystem should allow PPP_AC pseudowires to be created in L2TPv2 tunnels.
Extend the l2tp_netlink sanity check to support PPP_AC.
--- net/l2tp/l2tp_netlink.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
net/l2tp/l2tp_netlink.c +8 -2
@@ -560,8 +560,14 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf goto out_tunnel; } -/* L2TPv2 only accepts PPP pseudo-wires */ -if (tunnel->version ==2 && cfg.pw_type !=L2TP_PWTYPE_PPP ) { +/* L2TPv2 only accepts PPP pseudowires, which may be identified as +* either L2TP_PWTYPE_PPP for locally-terminating PPP sessions, or +* L2TP_PWTYPE_PPP_AC for the Access Concentrator case where the PPP +* session is passed through the tunnel for remote termination. +*/ +if (tunnel->version ==2 && + cfg.pw_type !=L2TP_PWTYPE_PPP && + cfg.pw_type !=L2TP_PWTYPE_PPP_AC ) { ret = -EPROTONOSUPPORT ; goto out_tunnel; }
Signature · 1 line
2.17.1
PATCH 3/6 l2tp: allow v2 netlink session create to pass ifname attribute
In reply to Tom ParkinPreviously L2TP_ATTR_IFNAME was only applicable to an L2TPv3 session, since it was only used by l2tp_eth.
In order to implement an AC_PPP pseudowire in an L2TPv2 tunnel, it will be necessary to allow userspace to send an interface name in the session create message.
Allow the attribute to be handled by l2tp_netlink for L2TPv2 sessions.
--- net/l2tp/l2tp_netlink.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/l2tp/l2tp_netlink.c +3 -2
@@ -604,10 +604,11 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf cfg.peer_cookie_len = len;memcpy (&cfg.peer_cookie[0 ],nla_data (info->attrs[L2TP_ATTR_PEER_COOKIE ]), len); } -if (info->attrs[L2TP_ATTR_IFNAME ]) - cfg.ifname =nla_data (info->attrs[L2TP_ATTR_IFNAME ]); } +if (info->attrs[L2TP_ATTR_IFNAME ]) + cfg.ifname =nla_data (info->attrs[L2TP_ATTR_IFNAME ]); +if (info->attrs[L2TP_ATTR_RECV_SEQ ]) cfg.recv_seq =nla_get_u8 (info->attrs[L2TP_ATTR_RECV_SEQ ]);
Signature · 1 line
2.17.1
PATCH 4/6 l2tp: add netlink attributes for ac_ppp session creation
In reply to Tom ParkinThe AC PPPoE driver will require userspace to pass in both the PPPoE session ID and the PPPoE peer's MAC address.
Add netlink attributes to allow this to be conveyed in the session create command.
--- include/uapi/linux/l2tp.h | 2 ++ net/l2tp/l2tp_netlink.c | 2 ++ 2 files changed, 4 insertions(+)
include/uapi/linux/l2tp.h +2 -0
@@ -127,6 +127,8 @@ enum {L2TP_ATTR_UDP_ZERO_CSUM6_TX ,/* flag */ L2TP_ATTR_UDP_ZERO_CSUM6_RX ,/* flag */ L2TP_ATTR_PAD , +L2TP_ATTR_PPPOE_SESSION_ID ,/* u16 */ +L2TP_ATTR_PPPOE_PEER_MAC_ADDR ,/* 6 bytes */ __L2TP_ATTR_MAX, };
net/l2tp/l2tp_netlink.c +2 -0
@@ -920,6 +920,8 @@ static const struct nla_policy l2tp_nl_policy[L2TP_ATTR_MAX + 1] = { .type = NLA_BINARY, .len = 8, }, + [L2TP_ATTR_PPPOE_SESSION_ID] = { .type = NLA_U16, }, + [L2TP_ATTR_PPPOE_PEER_MAC_ADDR] = NLA_POLICY_ETH_ADDR, }; static const struct genl_ops l2tp_nl_ops[] = {
Signature · 1 line
2.17.1
PATCH 5/6 l2tp: add ac_pppoe pseudowire driver
In reply to Tom ParkinThe AC/PPPoE driver implements pseudowire type L2TP_PWTYPE_PPP_AC, for use in a PPPoE Access Concentrator configuration. Rather than terminating the PPP session locally, the AC/PPPoE driver forwards PPP packets over an L2TP tunnel for termination at the LNS.
l2tp_ac_pppoe provides a data path for PPPoE session packets, and should be instantiated once a userspace process has completed the PPPoE discovery process.
To create an instance of an L2TP_PWTYPE_PPP_AC pseudowire, userspace must use the L2TP_CMD_SESSION_CREATE netlink command, and pass the following attributes:
* L2TP_ATTR_IFNAME, to specify the name of the interface associated with the PPPoE session;
* L2TP_ATTR_PPPOE_SESSION_ID, to specify the PPPoE session ID assigned to the session;
* L2TP_ATTR_PPPOE_PEER_MAC_ADDR, to specify the MAC address of the PPPoE peer
--- net/l2tp/Kconfig | 7 + net/l2tp/Makefile | 1 + net/l2tp/l2tp_ac_pppoe.c | 446 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 454 insertions(+) create mode 100644 net/l2tp/l2tp_ac_pppoe.c
net/l2tp/Kconfig +7 -0
@@ -108,3 +108,10 @@ config L2TP_ETH To compile this driver as a module, choose M here. The module will be called l2tp_eth. + +config L2TP_AC_PPPOE + tristate "L2TP PPP Access Concentrator support" + depends on L2TP + help + Support for tunneling PPP frames from PPPoE sessions in an L2TP + session.
net/l2tp/Makefile +1 -0
@@ -16,3 +16,4 @@ obj-$(subst y,$(CONFIG_L2TP),$(CONFIG_L2TP_DEBUGFS)) += l2tp_debugfs.o ifneq ($(CONFIG_IPV6),) obj-$(subst y,$(CONFIG_L2TP),$(CONFIG_L2TP_IP)) += l2tp_ip6.o endif +obj-$(subst y,$(CONFIG_L2TP),$(CONFIG_L2TP_AC_PPPOE)) += l2tp_ac_pppoe.o
net/l2tp/l2tp_ac_pppoe.c new file +446 -0
446 lines not on this page · raw message
Signature · 1 line
2.17.1
Jakub Kicinski
maintainerRe: [PATCH net-next 5/6] l2tp: add ac_pppoe pseudowire driver
Quoted 13 lines · On Wed, 30 Sep 2020 22:07:06 +0100 Tom Parkin wrote:
The AC/PPPoE driver implements pseudowire type
L2TP_PWTYPE_PPP_AC, for use in a PPPoE Access Concentrator configuration. Rather than terminating the PPP session locally, the AC/PPPoE driver forwards PPP packets over an L2TP tunnel for termination at the LNS.
l2tp_ac_pppoeprovides a data path for PPPoE session packets, and should be instantiated once a userspace process has completed the PPPoE discovery process.To create an instance of an
L2TP_PWTYPE_PPP_ACpseudowire, userspace must use theL2TP_CMD_SESSION_CREATEnetlink command, and pass the following attributes:
Quoted 6 lines
*
L2TP_ATTR_IFNAME, to specify the name of the interface associated with the PPPoE session;
*L2TP_ATTR_PPPOE_SESSION_ID, to specify the PPPoE session ID assigned to the session;
*L2TP_ATTR_PPPOE_PEER_MAC_ADDR, to specify the MAC address of the PPPoE peer
C=1 generates:
net/l2tp/l2tp_ac_pppoe.c:234:20: warning: incorrect type in argument 1 (different address spaces)net/l2tp/l2tp_ac_pppoe.c:234:20: expected struct net_device *devnet/l2tp/l2tp_ac_pppoe.c:234:20: got struct net_device [noderef] __rcu *devnet/l2tp/l2tp_ac_pppoe.c:380:45: error: incompatible types in comparison expression (different address spaces):net/l2tp/l2tp_ac_pppoe.c:380:45: struct net_device [noderef] __rcu *net/l2tp/l2tp_ac_pppoe.c:380:45: struct net_device *
Re: [PATCH net-next 5/6] l2tp: add ac_pppoe pseudowire driver
Quoted 21 lines · Jakub Kicinski
Quoted 13 lines · On Wed, 30 Sep 2020 22:07:06 +0100 Tom Parkin wrote:
The AC/PPPoE driver implements pseudowire type
L2TP_PWTYPE_PPP_AC, for use in a PPPoE Access Concentrator configuration. Rather than terminating the PPP session locally, the AC/PPPoE driver forwards PPP packets over an L2TP tunnel for termination at the LNS.
l2tp_ac_pppoeprovides a data path for PPPoE session packets, and should be instantiated once a userspace process has completed the PPPoE discovery process.To create an instance of an
L2TP_PWTYPE_PPP_ACpseudowire, userspace must use theL2TP_CMD_SESSION_CREATEnetlink command, and pass the following attributes:Quoted 6 lines
*
L2TP_ATTR_IFNAME, to specify the name of the interface associated with the PPPoE session;
*L2TP_ATTR_PPPOE_SESSION_ID, to specify the PPPoE session ID assigned to the session;
*L2TP_ATTR_PPPOE_PEER_MAC_ADDR, to specify the MAC address of the PPPoE peer
Quoted 8 lines
C=1 generates:
net/l2tp/l2tp_ac_pppoe.c:234:20: warning: incorrect type in argument 1 (different address spaces)net/l2tp/l2tp_ac_pppoe.c:234:20: expected structnet_device*devnet/l2tp/l2tp_ac_pppoe.c:234:20: got structnet_device[noderef]__rcu*devnet/l2tp/l2tp_ac_pppoe.c:380:45: error: incompatible types in comparison expression (different address spaces):net/l2tp/l2tp_ac_pppoe.c:380:45: structnet_device[noderef]__rcu*net/l2tp/l2tp_ac_pppoe.c:380:45: structnet_device*
Thanks Jakub, and apologies for that slipping through. My Sparse installation on Ubuntu wasn't working -- I've updated it now and can see the error you reported.
PATCH 6/6 docs: networking: update l2tp.rst to document PPP_AC pseudowires
In reply to Tom ParkinAlongside this, add a bit more of a description of the PPP and ETH pseudowire types.
--- Documentation/networking/l2tp.rst | 69 ++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 20 deletions(-)
Documentation/networking/l2tp.rst +49 -20
@@ -119,6 +119,26 @@ l2tp" commands). If ``L2TP_ATTR_FD`` is given, it must be a socket fd that is already bound and connected. There is more information about unmanaged tunnels later in this document. +L2TP sessions, or pseudowires, may be of several different types. The +``L2TP_CMD_SESSION_CREATE`` command specifies the pseudowire type to +be created. + +================== ================================================== +Pseudowire type Description +================== ================================================== +ETH L2TPv3 only. Pseudowire carries Ethernet frames. + The session instance is associated with a virtual + network device ``l2tpethN``. +PPP Pseudowire carries PPP frames. The session instance + is associated with a virtual network device + ``pppN`` which terminates the PPP session locally. +PPP_AC Pseudowire carries PPP frames which are switched + from incoming PPPoE frames into the L2TP tunnel, + allowing the PPP session to be terminated at the + other end of the tunnel. There is no virtual + network device associated with the session instance. +================== ================================================== + ``L2TP_CMD_TUNNEL_CREATE`` attributes:- ================== ======== ===
@@ -177,26 +197,35 @@ CONN_ID N Identifies the tunnel id to be queried. ``L2TP_CMD_SESSION_CREATE`` attributes:- -================== ======== === -Attribute Required Use -================== ======== === -CONN_ID Y The parent tunnel id. -SESSION_ID Y Sets the session id. -PEER_SESSION_ID Y Sets the parent session id. -PW_TYPE Y Sets the pseudowire type. -DEBUG N Debug flags. -RECV_SEQ N Enable rx data sequence numbers. -SEND_SEQ N Enable tx data sequence numbers. -LNS_MODE N Enable LNS mode (auto-enable data sequence - numbers). -RECV_TIMEOUT N Timeout to wait when reordering received - packets. -L2SPEC_TYPE N Sets layer2-specific-sublayer type (L2TPv3 - only). -COOKIE N Sets optional cookie (L2TPv3 only). -PEER_COOKIE N Sets optional peer cookie (L2TPv3 only). -IFNAME N Sets interface name (L2TPv3 only). -================== ======== === +==================== ======== === +Attribute Required Use +==================== ======== === +CONN_ID Y The parent tunnel id. +SESSION_ID Y Sets the session id. +PEER_SESSION_ID Y Sets the parent session id. +PW_TYPE Y Sets the pseudowire type. +DEBUG N Debug flags. +RECV_SEQ N Enable rx data sequence numbers. +SEND_SEQ N Enable tx data sequence numbers. +LNS_MODE N Enable LNS mode (auto-enable data sequence + numbers). +RECV_TIMEOUT N Timeout to wait when reordering received + packets. +L2SPEC_TYPE N Sets layer2-specific-sublayer type (L2TPv3 + only). +COOKIE N Sets optional cookie (L2TPv3 only). +PEER_COOKIE N Sets optional peer cookie (L2TPv3 only). +IFNAME N Pseudowire-specific parameter: + + - For Ethernet, IFNAME sets the name to be assigned + to the L2TP session network interface. + - For AC/PPPoE, IFNAME specifies the name of the + interface associated with the PPPoE session. + - For PPP pseudowires, IFNAME is ignored. + +PPPOE_SESSION_ID N Sets the PPPoE session ID (L2TPv2 AC/PPPoE only). +PPPOE_PEER_MAC_ADDR N Sets the PPPoE peer MAC address (L2TPv2 AC/PPPoE only). +==================== ======== === For Ethernet session types, this will create an l2tpeth virtual interface which can then be configured as required. For PPP session
Signature · 1 line
2.17.1
Quoted 72 lines · Tom Parkin
L2TPv2 tunnels are often used as a part of a home broadband connection, using a PPP link to connect the subscriber network into the Internet Service Provider's network.
In this scenario, PPPoE is widely used between the L2TP Access Concentrator (LAC) and the subscriber. The LAC effectively acts as a PPPoE server, switching PPP frames from incoming PPPoE packets into an L2TP session. The PPP session is then terminated at the L2TP Network Server (LNS) on the edge of the ISP's IP network.
This patchset adds a driver to the L2TP subsystem to support this mode of operation.
The new driver,
l2tp_ac_pppoe, adds support for the existing pseudowire typeL2TP_PWTYPE_PPP_AC, and is instantiated using the existing L2TP netlinkL2TP_CMD_SESSION_CREATE. It is expected to be used as follows:* A userspace PPPoE daemon running on the LAC handles the PPPoE discovery process up to the point of assigning a PPPoE session ID and sending the PADS packet to the PPPoE peer to establish the PPPoE session.
* Userspace code running on the LAC then instantiates an L2TP tunnel and session with the LNS using the L2TP control protocol.
* Finally, the data path for PPPoE session frames through the L2TP session to the LAC is instantiated by sending a genetlinkL2TP_CMD_SESSION_CREATEcommand to the kernel, including the PPPoE-specific metadata required forL2TP_PWTYPE_PPP_ACsessions (this is documented in the patch series commit comments).Supporting this driver submission we have two examples of userspace projects which use
L2TP_PWTYPE_PPP_AC:* https://github.com/katalix/l2tp-ktest
This is a unit-test suite for the kernel L2TP subsystem which has been updated to include basic lifetime and datapath tests for
l2tp_ac_pppoe.The new tests are automatically enabled when
l2tp_ac_pppoeavailability is detected, and hence support forl2tp_ac_pppoeis on the master branch of the git repository.* https://github.com/katalix/go-l2tp
This is a Go library for building L2TP applications on Linux, and includes a suite of example daemons which utilise the library.
The daemon kpppoed implements the PPPoE discovery protocol, and spawns an instance of a daemon kl2tpd which handles the L2TP control protocol and instantiates the kernel data path.
The code utilising
l2tp_ac_pppoeis on the branchtp_002_pppoe_1pending merge of this patchset in the kernel.Notes on the patchset itself:
* Patches 1-4 lay groundwork for the addition of the new driver, making tweaks to the l2tp netlink code to allow
l2tp_ac_pppoeto access the netlink attributes it requires.
* Patch 5 adds the new driver itself and hooks it into the kernel configuration and build system.
* Patch 6 updates the l2tp documentation underDocumentation/to include information about the new driver.Tom Parkin (6):
l2tp: add netlink info to session create callback
l2tp: tweak netlink session create to allow L2TPv2ac_pppoe
l2tp: allow v2 netlink session create to pass ifname attribute
l2tp: add netlink attributes forac_pppsession creation
l2tp: addac_pppoepseudowire driver
docs: networking: updatel2tp.rstto documentPPP_ACpseudowires
Quoted 12 lines
Documentation/networking/l2tp.rst | 69 +++-- include/uapi/linux/l2tp.h | 2 + net/l2tp/Kconfig | 7 + net/l2tp/Makefile | 1 + net/l2tp/l2tp_ac_pppoe.c | 446 ++++++++++++++++++++++++++++++ net/l2tp/l2tp_core.h | 4 +- net/l2tp/l2tp_eth.c | 3 +- net/l2tp/l2tp_netlink.c | 20 +- net/l2tp/l2tp_ppp.c | 3 +- 9 files changed, 527 insertions(+), 28 deletions(-) create mode 100644 net/l2tp/l2tp_ac_pppoe.c
Quoted 4 lines · Tom Parkin
L2TPv2 tunnels are often used as a part of a home broadband connection, using a PPP link to connect the subscriber network into the Internet Service Provider's network.
Quoted 8 lines
In this scenario, PPPoE is widely used between the L2TP Access Concentrator (LAC) and the subscriber. The LAC effectively acts as a PPPoE server, switching PPP frames from incoming PPPoE packets into an L2TP session. The PPP session is then terminated at the L2TP Network Server (LNS) on the edge of the ISP's IP network.
This patchset adds a driver to the L2TP subsystem to support this mode of operation.
Hi Tom,
Nice to see someone working on this use case. However, have you considered other implementation approaches?
This new module reimplements PPPoE in net/l2tp (ouch!), so we'd now have two PPPoE implementations with two different packet handlers for ETH_P_PPP_SES. Also this implementation doesn't take into account other related use cases, like forwarding PPP frames between two L2TP sessions (not even talking about PPTP).
A much simpler and more general approach would be to define a new PPP ioctl, to "bridge" two PPP channels together. I discussed this with DaveM at netdevconf 2.2 (Seoul, 2017) and we agreed that it was probably the best way forward.
It's just a matter of extending struct channel (in ppp_generic.c) with a pointer to another channel, then testing this pointer in ppp_input(). If the pointer is NULL, use the classical path, if not, forward the PPP frame using the ->start_xmit function of the peer channel. There are a few details to take into account of course (crossing netns, locking), but nothing big (I could implement it the following night in my hotel room before leaving Seoul). This approach should work for forwarding PPP frames between any type of PPP transport.
I unfortunately didn't propose the code upstream at that time, because I didn't want to add this kernel feature without having a userspace implementation making use of it and ready to release (and I finally left the company before that happened). But I know that this implementation worked fine as it did receive quite a lot of testing.
Yet another way to implement this feature would to define virtual PPPoE and L2TP devices, working in external mode. In practice, one PPPoE and one L2TP network device would be enough for handling all the traffic. Then TC could be used to pass the PPP frames between PPPoE and L2TP.
Example (assuming flower and tunnel_key were extented to support PPPoE and L2TP):
# Forward PPPoE frames with Session-ID 5 to L2TP tunnel 1 session 1
$ tc filter add dev pppoe0 ingress flower pppoe_sid 5 \
action tunnel_key src_ip 192.0.2.1 dst_ip 192.0.2.2 \
l2tp_tid 1 l2tp_peertid 1 \
l2tp_sid 1 l2tp_peer_sid 1 \
action mirred egress redirect dev l2tp0# Reverse path
$ tc filter add dev l2tp0 ingress flower l2tp_tid 1 l2tp_sid 1 \
action tunnel_key dst_mac 02:00:00:00:00:01 src_mac 02:00:00:00:00:02 \
id 5 \
action mirred egress redirect dev pppoe0Of course the commands would be a bit longer in practice (one would probably want to match on the src and dst IP addresses in the reverse path, or set the L2TP version, etc.), but that's the general idea.
Such approach would probably not allow the use of L2TP sequence numbers though (which might not be a bad thing in the end). It'd also require more work, but would avoid going through the PPP layer and might even be offloadable (if a NIC vendor ever wants to support it).
Regards,
Guillaume
Quoted 25 lines · Guillaume Nault
Quoted 4 lines · Tom Parkin
L2TPv2 tunnels are often used as a part of a home broadband connection, using a PPP link to connect the subscriber network into the Internet Service Provider's network.
Quoted 8 lines
In this scenario, PPPoE is widely used between the L2TP Access Concentrator (LAC) and the subscriber. The LAC effectively acts as a PPPoE server, switching PPP frames from incoming PPPoE packets into an L2TP session. The PPP session is then terminated at the L2TP Network Server (LNS) on the edge of the ISP's IP network.
This patchset adds a driver to the L2TP subsystem to support this mode of operation.
Hi Tom,
Nice to see someone working on this use case. However, have you considered other implementation approaches?
This new module reimplements PPPoE in net/l2tp (ouch!), so we'd now have two PPPoE implementations with two different packet handlers for
ETH_P_PPP_SES. Also this implementation doesn't take into account other related use cases, like forwarding PPP frames between two L2TP sessions (not even talking about PPTP).
Quoted 4 lines
A much simpler and more general approach would be to define a new PPP ioctl, to "bridge" two PPP channels together. I discussed this with DaveM at netdevconf 2.2 (Seoul, 2017) and we agreed that it was probably the best way forward.
Hi Guillaume,
Thank you for reviewing the patchset.
I hadn't considered supporting this usecase in the ppp subsystem directly, so thank you for that suggestion. I can definitely see the appeal of avoiding reimplementing the PPPoE session packet handling. Having looked at the ppp code, I think it'd be a smaller change overall than this series, so that's also appealing.
I'll wait on a little to let any other review comments come in, but if doing as you suggest is still the preferred approach I'll happily look at implementing it -- assuming you don't have a patch ready to go?
Best regards,
Tom
Quoted 3 lines · Tom Parkin
I'll wait on a little to let any other review comments come in, but if doing as you suggest is still the preferred approach I'll happily look at implementing it -- assuming you don't have a patch ready to go?
I unfortunately don't. All I saved from my previous ongoing L2TP and PPP work is a (long) TODO list.