PPP-over-L2TP kernel support, new patch for review
Subsystems (4)
James Chapman
maintainerAttached is a revised version of the new PPP over L2TP support for review. Thanks DaveM and Herbert for comments so far. The following comments have been addressed in this new version:
- use Linux list macros for all lists
- split sockaddr_pppox into separate sockaddr_pppoe and sockaddr_pppol2tp structs
I've split the patch into 3 diffs:
1. sockaddr_pppoe.diff - fix sockaddr_pppox issue
2. if_pppox.h_ws.diff - fixup whitespace formatting
3. pppol2tp-2.diff - add PPPoL2TP
Please also check the following FIXMEs in pppol2tp.c. If these aren't issues, I'll remove the FIXMEs and submit a new patch.
- pppol2tp_data_ready()
lock the socket when walking sk->sk_receive_queue?
- pppol2tp_build_l2tp_header()
unaligned accesses?
- pppol2tp_xmit()
handle skb fragments?
- pppol2tp_create()
sk_set_owner() - what is the real problem here?
- pppol2tp_session_setsockopt()
change ppp channel's hdrlen on the fly?
Also, since submitting the previous version, I've made a few internal L2TP changes which are included in the pppol2tp patch. Most relevant is the addition of a using_ipsec flag - I'm trying to return a read-only indicator to userspace whether the L2TP tunnel is protected by IPSEC. Is this the right way to do it?
/james
drivers/net/pppoe.c +13 -13
@@ -201,9 +201,9 @@return po; } -static inline struct pppox_opt *get_item_by_addr (struct sockaddr_pppox *sp) +static inline struct pppox_opt *get_item_by_addr (struct sockaddr_pppoe *sp) { -return get_item (sp->sa_addr.pppoe.sid, sp->sa_addr.pppoe.remote); +return get_item (sp->pppoe.sid, sp->pppoe.remote); }static inline int set_item (struct pppox_opt *po)
@@ -572,7 +572,7 @@ {struct sock *sk = sock->sk;struct net_device *dev =NULL ; -struct sockaddr_pppox *sp = (struct sockaddr_pppox *) uservaddr; +struct sockaddr_pppoe *sp = (struct sockaddr_pppoe *) uservaddr;struct pppox_opt *po =pppox_sk (sk);int error;
@@ -584,12 +584,12 @@/* Check for already bound sockets */ error = -EBUSY ; -if ((sk->sk_state &PPPOX_CONNECTED ) && sp->sa_addr.pppoe.sid) +if ((sk->sk_state &PPPOX_CONNECTED ) && sp->pppoe.sid) goto end;/* Check for already disconnected sockets, on attempts to disconnect */ error = -EALREADY ; -if ((sk->sk_state &PPPOX_DEAD ) && !sp->sa_addr.pppoe.sid ) +if ((sk->sk_state &PPPOX_DEAD ) && !sp->pppoe.sid ) goto end; error =0 ;
@@ -609,8 +609,8 @@ }/* Don't re-bind if sid==0 */ -if (sp->sa_addr.pppoe.sid !=0 ) { - dev =dev_get_by_name (sp->sa_addr.pppoe.dev); +if (sp->pppoe.sid !=0 ) { + dev =dev_get_by_name (sp->pppoe.dev); error = -ENODEV ;if (!dev)
@@ -622,7 +622,7 @@ goto err_put;memcpy (&po->pppoe_pa, - &sp->sa_addr.pppoe, + &sp->pppoe,sizeof (struct pppoe_addr )); error =set_item (po);
@@ -642,7 +642,7 @@ sk->sk_state =PPPOX_CONNECTED ; } - po->num = sp->sa_addr.pppoe.sid; + po->num = sp->pppoe.sid; end:release_sock (sk);
@@ -659,12 +659,12 @@static int pppoe_getname (struct socket *sock,struct sockaddr *uaddr,int *usockaddr_len,int peer) { -int len =sizeof (struct sockaddr_pppox ); -struct sockaddr_pppox sp; +int len =sizeof (struct sockaddr_pppoe ); +struct sockaddr_pppoe sp; sp.sa_family =AF_PPPOX ; sp.sa_protocol =PX_PROTO_OE ; -memcpy (&sp.sa_addr.pppoe, &pppox_sk (sock->sk)->pppoe_pa, +memcpy (&sp.pppoe, &pppox_sk (sock->sk)->pppoe_pa,sizeof (struct pppoe_addr ));memcpy (uaddr, &sp, len);
@@ -740,7 +740,7 @@ err = -EFAULT ;if (copy_from_user (&po->pppoe_relay, (void __user *)arg, -sizeof (struct sockaddr_pppox ))) +sizeof (struct sockaddr_pppoe )))break ; err = -EINVAL ;
include/linux/if_pppox.h +14 -3
@@ -51,15 +51,26 @@*/ #define PX_PROTO_OE 0/* Currently just PPPoE */ #define PX_MAX_PROTO 1 - + +/* The use of a union isn't viable because the size of this struct +* must stay fixed over time -- applications use sizeof(struct +* sockaddr_pppox) to fill it. Use protocol specific sockaddr types +* instead. +*/ struct sockaddr_pppox {sa_family_t sa_family;/* address family, AF_PPPOX */ unsigned int sa_protocol;/* protocol identifier */ union {struct pppoe_addr pppoe; }sa_addr; -}__attribute__ ((packed)); +}__attribute__ ((packed))__deprecated ; +/* Must be binary-compatible with sockaddr_pppox for backwards compatabilty */ +struct sockaddr_pppoe { +sa_family_t sa_family;/* address family, AF_PPPOX */ +unsigned int sa_protocol;/* protocol identifier */ +struct pppoe_addr pppoe; +}__attribute__ ((packed));/********************************************************************* *
@@ -115,7 +126,7 @@struct pppoe_opt {struct net_device *dev;/* device associated with socket*/ struct pppoe_addr pa;/* what this socket is bound to*/ -struct sockaddr_pppox relay;/* what socket data will be +struct sockaddr_pppoe relay;/* what socket data will be relayed to (PPPoE relaying) */ };
include/linux/if_pppox.h +41 -41
125 lines not on this page · raw message
drivers/net/Kconfig +13 -0
@@ -2481,6 +2481,19 @@ which can lead to bad results if the ATM peer loses state and changes its encapsulation unilaterally. +config PPPOL2TP + tristate "PPP over L2TP (EXPERIMENTAL)" + depends on EXPERIMENTAL && PPP + help + Support for PPP-over-L2TP socket family. L2TP is a protocol + used by ISPs and enterprises to tunnel PPP traffic over UDP + tunnels. L2TP is replacing PPTP for VPN uses. + + This kernel component handles only L2TP data packets: a + userland daemon handles L2TP the control protocol (tunnel + and session setup). One such daemon is OpenL2TP + (http://openl2tp.sourceforge.net/). + config SLIP tristate "SLIP (serial line) support" depends on NETDEVICES
drivers/net/Makefile +1 -0
@@ -101,6 +101,7 @@ obj-$(CONFIG_PPP_DEFLATE) += ppp_deflate.o obj-$(CONFIG_PPP_BSDCOMP) += bsd_comp.o obj-$(CONFIG_PPPOE) += pppox.o pppoe.o +obj-$(CONFIG_PPPOL2TP) += pppox.o pppol2tp.o obj-$(CONFIG_SLIP) += slip.o ifeq ($(CONFIG_SLIP_COMPRESSED),y)
drivers/net/pppol2tp.c +2275 -0
2,275 lines not on this page · raw message
include/linux/if_ppp.h +16 -0
@@ -107,6 +107,21 @@struct ppp_comp_stats stats; }; +/* For PPPIOCGL2TPSTATS */ +struct pppol2tp_ioc_stats { +__u16 tunnel_id;/* redundant */ +__u16 session_id;/* if zero, get tunnel stats */ +__u32 tx_packets; +__u32 tx_bytes; +__u32 tx_errors; +__u32 rx_packets; +__u32 rx_bytes; +__u32 rx_seq_discards; +__u32 rx_oos_packets; +__u32 rx_errors; +int using_ipsec;/* valid only for session_id == 0 */ +}; +#define ifr__name b.ifr_ifrn.ifrn_name#define stats_ptr b.ifr_ifru.ifru_data
@@ -143,6 +158,7 @@#define PPPIOCDISCONN _IO('t', 57)/* disconnect channel */ #define PPPIOCATTCHAN _IOW('t', 56, int)/* attach to ppp channel */ #define PPPIOCGCHAN _IOR('t', 55, int)/* get ppp channel number */ +#define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats)#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0)#define SIOCGPPPVER (SIOCDEVPRIVATE + 1)/* NEVER change this!! */
include/linux/if_pppol2tp.h +65 -0
65 lines not on this page · raw message
include/linux/if_pppox.h +9 -1
@@ -27,6 +27,7 @@#include <asm/semaphore.h> #include <linux/ppp_channel.h> #endif /* __KERNEL__ */ +#include <linux/if_pppol2tp.h> /* For user-space programs to pick up these definitions * which they wouldn't get otherwise without defining __KERNEL__
@@ -50,7 +51,8 @@* Protocols supported by AF_PPPOX */ #define PX_PROTO_OE 0/* Currently just PPPoE */ -#define PX_MAX_PROTO 1 +#define PX_PROTO_OL2TP 1/* Now L2TP also */ +#define PX_MAX_PROTO 2/* The use of a union isn't viable because the size of this struct * must stay fixed over time -- applications use sizeof(struct
@@ -72,6 +74,12 @@struct pppoe_addr pppoe; }__attribute__ ((packed)); +struct sockaddr_pppol2tp { +sa_family_t sa_family;/* address family, AF_PPPOX */ +unsigned int sa_protocol;/* protocol identifier */ +struct pppol2tp_addr pppol2tp; +}__attribute__ ((packed)); +/********************************************************************* * * ioctl interface for defining forwarding of connections
include/linux/socket.h +1 -0
@@ -268,6 +268,7 @@#define SOL_IRDA 266#define SOL_NETBEUI 267#define SOL_LLC 268 +#define SOL_PPPOL2TP 269/* IPX options */ #define IPX_TYPE 1
MAINTAINERS +5 -0
@@ -1694,6 +1694,11 @@ M: [email protected] S: Maintained +PPP OVER L2TP +P: Martijn van Oosterhout +M: [email protected] +S: Maintained + PREEMPTIBLE KERNEL P: Robert Love M: [email protected]
David S. Miller
maintainerQuoted 3 lines · On Mon, 20 Sep 2004 22:11:44 +0100 James Chapman <[email protected]> wrote:
Attached is a revised version of the new PPP over L2TP support for review. Thanks DaveM and Herbert for comments so far. The following comments have been addressed in this new version:
What relation does your work have to the L2TP implementation being worked on by Ben LaHaise? See:
http://marc.theaimsgroup.com/?l=linux-netdev&m=109375044707414&w=2
Do we have two people working on this thing. :-/
Ben didn't post any pointers to his work so I couldn't do the comparison myself.
James Chapman
maintainerQuoting "David S. Miller" <[email protected]>:
Quoted 10 lines
Quoted 3 lines · On Mon, 20 Sep 2004 22:11:44 +0100 James Chapman <[email protected]> wrote:
Attached is a revised version of the new PPP over L2TP support for review. Thanks DaveM and Herbert for comments so far. The following comments have been addressed in this new version:
What relation does your work have to the L2TP implementation being worked on by Ben LaHaise? See:
Quoted 7 lines
http://marc.theaimsgroup.com/?l=linux-netdev&m=109375044707414&w=2
Do we have two people working on this thing. :-/
Ben didn't post any pointers to his work so I couldn't do the comparison myself.
Ben and I are working on separate projects. I was unaware of his work until I saw his netdev post a few weeks ago and mailed him privately to find out more. He's using the old Babylon (Spellcaster) proprietary PPP stack that has now been GPL'd.
Unfortunately I haven't seen Ben's code yet either so I can't give a direct comparison. Ben? I did have a look at the Babylon stuff (1.6-pre3), although I've no idea how much of it Ben has changed. Here's a summary, fyi.
Babylon:-
- Architecture seems to be using char devices for communication with the kernel and all the PPP datapath is handled by custom virtual net_devices; the generic PPP kernel code isn't used as far as I can tell. Unfortunately it is very old (linux-2.0 era I think) but Ben has probably updated it.
- Some form of L2TP support is there but it is very basic. Userspace sends data through char devices (read()/write() which the kernel char driver converts to skbs and passes on. Nasty.
- PPP stack supports multiple PPP sessions in one daemon (unlike pppd).
- Unlikely to integrate with the new native IPSEC stuff.
OpenL2TP:-
- Communication with kernel is through a new PPPoL2TP socket family. There's one socket per L2TP session so MAX_FILES limits max sessions. Works with the new native IPSEC kernel code.
- Comprehensive userspace L2TP protocol implementation written from scratch, targetted specifically for enterprise VPN and embedded networking products. Efficient kernel datapath was deemed essential for this environment.
- Plugin architecture allows different PPP implementations to be used. Only pppd supported so far (limits max sessions still further due to process overhead) but I'm working on a daemon to support multiple sessions -- still early stages, evaluating alternatives. Babylon or hacking pppd or start again...
rp-l2tp:-
- No kernel datapath (all data copied into userspace through ptys). However, it could be modified to use the socket based kernel driver.
I think for general Linux L2TP support, a socket architecture makes more sense. But maybe I'm biased... :)
If you want to find out more about OpenL2TP, checkout the online man pages at http://openl2tp.sourceforge.net/.
BTW, I asked on linux-ppp if anyone was working on a single daemon PPP to handle multiple sessions but got zero response. Anyone on this list know of any work in this area?
I hope this was useful.
/james
Quoted 5 lines · James Chapman
Unfortunately I haven't seen Ben's code yet either so I can't give a direct comparison. Ben? I did have a look at the Babylon stuff (1.6-pre3), although I've no idea how much of it Ben has changed. Here's a summary, fyi.
Quoted 7 lines
Babylon:-
- Architecture seems to be using char devices for communication with the kernel and all the PPP datapath is handled by custom virtual
net_devices; the generic PPP kernel code isn't used as far as I can tell. Unfortunately it is very old (linux-2.0 era I think) but Ben has probably updated it.
I've updated it. The current build is at http://www.kvack.org/~bcrl/babylon/
and is 1.6-pre3-bcrl8. The L2TP support is approaching beta, with the only real todo items being proper retransmit with congestion control, plus the kernel side of multihop support, and some locking fixes for smp and preempt. Plus the api needs to be made into something more paletable (it abuses a mix of ioctl, bind & connect to create l2tp sessions). No flames please, but patches that keep the scaling characteristics and make the interface more paletable gladly accepted.
Quoted 3 lines
- Some form of L2TP support is there but it is very basic. Userspace sends data through char devices (read()/write() which the kernel char driver converts to skbs and passes on. Nasty.
That old code was completely tossed.
Quoted 3 lines
- PPP stack supports multiple PPP sessions in one daemon (unlike pppd).
- Unlikely to integrate with the new native IPSEC stuff.
L2TP over IPSEC? Are you insane? You'd not be able to terminate more than a couple of dozen connections over it. =-)
Quoted 2 lines
I think for general Linux L2TP support, a socket architecture makes more sense. But maybe I'm biased... :)
The current babylon code is using sockets. The l2tp sockets passes all packets for a given tunnel through a single file descriptor. This seems like the best tradeoff for being able to scale to decent numbers of sessions.
-ben
Signature · 1 line
"Time is what keeps everything from happening all at once." -- John Wheeler
Quoted 5 lines · Benjamin LaHaise
Quoted 2 lines
- Unlikely to integrate with the new native IPSEC stuff.
L2TP over IPSEC? Are you insane? You'd not be able to terminate more than a couple of dozen connections over it. =-)
Why not? L2TP over IPsec is the only reason I'm looking at L2TP at all.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt-----BEGIN PGP SIGNED MESSAGE-----
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
"Herbert" == Herbert Xu <[email protected]> writes:
- Unlikely to integrate with the new native IPSEC stuff.
L2TP over IPSEC? Are you insane? You'd not be able to terminate more than a couple of dozen connections over it. =-)
Herbert> Why not? L2TP over IPsec is the only reason I'm looking at Herbert> L2TP at all.
Stupidly, it is the only way for a Microsoft XP native stack to be
"auto-configured". Sad. sad stupid crap that I wish could be thrown out.
- --
] "Elmo went to the wrong fundraiser" - The Simpson | firewalls [ ] Michael Richardson, Xelerance Corporation, Ottawa, ON |net architect[ ] [email protected] http://www.sandelman.ottawa.on.ca/mcr/ |device driver[
] panic("Just another Debian GNU/Linux using, kernel hacking, security guy"); [
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Finger me for keys
iQCVAwUBQVDAg4qHRg3pndX9AQElfQP/aSfT8/pNvtwaYQyAgin9vI9eAEQmI1uk VlhrzJB8SajEiYg9oQxuiBTqhxjUhG1/9Cp8m3NEofeW9D1YLZwv6TEhN/M+TLrI cIG8H4qvu+//L64Zxa8P+X7ZsM3+5tFkpu+QFE374VuoGaiEMUCMl4WLTTST1YnJ VEpnvhotGSs=
=8O9W
-----END PGP SIGNATURE-----
Quoted 8 lines · Herbert Xu
Quoted 5 lines · Benjamin LaHaise
Quoted 2 lines
- Unlikely to integrate with the new native IPSEC stuff.
L2TP over IPSEC? Are you insane? You'd not be able to terminate more than a couple of dozen connections over it. =-)
Why not? L2TP over IPsec is the only reason I'm looking at L2TP at all.
CPU load. The main reason I was forced to revisit L2TP (imo, it's a horrible protocol that suffers from too many bad decisions) was in its role for terminating DSL. In this case one expects to be able to have tens of thousands of connections terminated by a single box, which means pushing hundreds of megabits of traffic. The overhead of crypto operations in such a scenario makes it a far too costly choice.
-ben
David S. Miller
maintainerQuoted 8 lines · On Tue, 21 Sep 2004 21:14:21 -0400 Benjamin LaHaise <[email protected]> wrote:
Quoted 7 lines · Herbert Xu
Quoted 5 lines · Benjamin LaHaise
Quoted 2 lines
- Unlikely to integrate with the new native IPSEC stuff.
L2TP over IPSEC? Are you insane? You'd not be able to terminate more than a couple of dozen connections over it. =-)
Quoted 8 lines
Quoted 1 line
Why not? L2TP over IPsec is the only reason I'm looking at L2TP at all.
CPU load. The main reason I was forced to revisit L2TP (imo, it's a horrible protocol that suffers from too many bad decisions) was in its role for terminating DSL. In this case one expects to be able to have tens of thousands of connections terminated by a single box, which means pushing hundreds of megabits of traffic. The overhead of crypto operations in such a scenario makes it a far too costly choice.
I've heard of usage of both types described by Herbert and yourself, and both are valid.
Therefore it's great that your scheme scales so well Ben, but it has to support IPSEC properly as well.
Quoted 9 lines · Benjamin LaHaise
On Wed, Sep 22, 2004 at 09:07:06AM +1000, Herbert Xu wrote:
CPU load.
The main reason I was forced to revisit L2TP (imo, it's a horrible protocol that suffers from too many bad decisions) was in its role for terminating DSL. In this case one expects to be able to have tens of thousands of connections terminated by a single box, which means pushing hundreds of megabits of traffic. The overhead of crypto operations in such a scenario makes it a far too costly choice.
Bad excuse ;->
So use a crypto chip or do less connections and scale by distributing etc. I have a feeling tehres nothing inherent in your code that stops you from intergrating into ipsec.
cheers,
jamal
James Chapman
maintainerAlthough Ben and I are both working on L2TP projects, I think we're targetting two totally different usage scenarios.
Time for some ASCII art...
1. ISP scenario
+----+
---+ D |
---| S | +--------+ +-------+
---| L |======| LAC |==============| LNS |
---| A | | | | |
---| M | +--------+ +-------+
---| |
---| |
---| |
+----+
thousands PPPoA each PPP session
of PPP or tunneled thru
clients PPPoE L2TP session to LNS2. VPN scenario
+---+ +------+
|LAC+----------------------------------| |
+---+ | |
+---+ | |
|LAC+----------------------------------| LNS |
+---+ | |
+---+ | |
|LAC+----------------------------------| |
+---+ | |
+------+
PPP client Terminates
in each LAC. multiple tunnels Typically 1
session per tunnel
Ben is addressing the ISP case, where client PPP sessions are terminated only temporarily at the LAC while it authenticates the PPP users to decide how to tunnel them. Each PPP session is then tunneled straight through the LAC via an L2TP session (inside an L2TP tunnel) to the LNS. Scalability is important here, which Ben has addressed.
I'm addressing the VPN case, where multiple clients (M$ L2TP/IPSEC or rp-l2tp/openl2tp clients) connect to an enterprise VPN server. Current solutions involve userspace pty hacks in the datapath, shunting data in and out of pppd ttys. The proposed driver moves the datapath into the kernel where it should be. The driver integrates with existing PPP and IPSEC kernel subsystems and will handle hundreds of sessions today.
The biggest difference in our approaches is that Martijn and I use a PPPoL2TP socket per session bound through a plain AF_INET UDP tunnel socket while Ben uses a new AF_L2TP tunnel socket and no separate socket per session. Both have their merits.
If I can put the case for our driver, Linux really needs a good VPN solution. I know of two companies that run their offices with Linux servers yet they both retain a Microsoft server _only_ to provide VPN access to off-site workers. Including this driver in the kernel will enable us to build binary packages for OpenL2TP and perhaps other L2TP solutions like rp-l2tp would be updated to use it too. Being able to handle hundreds (not thousands) of sessions is more than adequate in this case.
Where do we go from here then? Perhaps both approaches are equally valid and could even co-exist in the Linux kernel distribution?
/james
Quoting Benjamin LaHaise <[email protected]>:
Quoted 8 lines
Quoted 5 lines
- Architecture seems to be using char devices for communication with the kernel and all the PPP datapath is handled by custom virtual
net_devices; the generic PPP kernel code isn't used as far as I can tell. Unfortunately it is very old (linux-2.0 era I think) but Ben has probably updated it.I've updated it. The current build is at http://www.kvack.org/~bcrl/babylon/
and is 1.6-pre3-bcrl8.
[snip]
Quoted 5 lines · James Chapman
The biggest difference in our approaches is that Martijn and I use a PPPoL2TP socket per session bound through a plain
AF_INETUDP tunnel socket while Ben uses a newAF_L2TPtunnel socket and no separate socket per session. Both have their merits.
Can you elaborate on the merits of having a socket? It would seem to me that not having a socket is a lot more scalable. After all IPsec doesn't carry a socket around per session.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtJames Chapman
maintainerHi Herbert,
Quoting Herbert Xu <[email protected]>:
Quoted 10 lines
Quoted 5 lines · James Chapman
The biggest difference in our approaches is that Martijn and I use a PPPoL2TP socket per session bound through a plain
AF_INETUDP tunnel socket while Ben uses a newAF_L2TPtunnel socket and no separate socket per session. Both have their merits.Can you elaborate on the merits of having a socket? It would seem to me that not having a socket is a lot more scalable. After all IPsec doesn't carry a socket around per session.
What I meant by "both have their merits" is that both general approaches have their merits. It's a shame Martijn isn't available right now (he's moving home to a new country) as he came up with the initial kernel driver concept. Anyway, I'm sure he'll chime in later.
We could have implemented this thing by hooking specific UDP ports out in udp.c or adding to the UDP encap framework that you use for IPsec. Neither seem ideal for this case -- modifying core code in udp.c to add support for a new UDP protocol just seemed wrong. IPsec is special -- it is a core technology that the IP stack should know about. L2TP isn't special at all.
There are several reasons why I think the approach taken is a reasonable compromise:-
- No changes to core kernel code needed. The new L2TP support can be loaded as a module into current 2.4 and 2.6 Linux distributions.
- It fits well into the existing PPPoX framework. This is, after all, PPP over L2TP.
- Implementing a new socket address family for the tunnel socket instead of using a plain UDP socket meant cloning a lot of UDP code. We thought it might break IPsec assumptions and having code that did almost the same thing as other components of the kernel was not ideal. It also seemed to set the wrong precedent for adding a new UDP protocol.
- Having PPP create a socket and bind it to the L2TP tunnel UDP socket gave us all the packet hooks we needed to implement the L2TP datapath. And using a per-session socket made it trivial to add control and status APIs for userspace. Also, for handling L2TP (optional) data packet reordering, the socket buffer would help when holding packets for their predecessors, preventing one bad session from breaking others in the tunnel.
- For VPN usage scenarios where 50 or so L2TP sessions would be unusually large, the extra socket overhead didn't seem to matter that much when weighed up against all its advantages. Since in the VPN case, PPP sessions are locally terminated, there's also a net_device per session. Are we going to get rid of that too?
We keep coming back to the scalability issue. Sure this driver wouldn't work when handling thousands of sessions, but I just don't think it's an issue in the VPN case. People will be nailing up their VPNs directly with hardware-assisted IPsec or even MPLS well before we hear users complaining that they want Linux's L2TP to support thousands of sessions for VPN use.
Please don't get me wrong, I'm not saying that scalability doesn't matter. But I do think we're getting hung up on the need to support thousands of L2TP sessions carrying non-terminated PPP sessions as a typical Linux use case. Linux systems, especially those built from the core kernel source distribution, are much more likely to be using L2TP for VPNs, terminating PPP locally.
There are many problems to solve first in order to handle thousands of sessions before our proposed driver's limitations become an issue, i.e. single daemon pppd and how to handle each PPP interface without a net_device. Ben's Babylon-based solution does this but it won't solve the VPN problem.
I really want to see an end to those userspace pty pppd hacks being used by current L2TP, PPTP and PPPoE solutions. I think the proposed driver solves that problem well for L2TP and because it can be installed in current Linux installations with little effort (as a module), it stands a reasonable chance.
I'll shut up now, I've gone on long enough. Thanks for reading this far! :)
/james
Quoted 4 lines · James Chapman
We keep coming back to the scalability issue. Sure this driver wouldn't work when handling thousands of sessions, but I just don't think it's an issue in the VPN case. People will be nailing up their
That's where I disagree. We don't want to end up with two L2TP implementations in the kernel, one geared towards large installations and one geared towards IPsec setups.
So I think both Ben and James need to work out how they can best absorb the advantages of each other's stack.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 11 lines · James Chapman
Hi Herbert,
Quoting Herbert Xu <[email protected]>:
Quoted 7 lines
Quoted 5 lines · James Chapman
The biggest difference in our approaches is that Martijn and I use a PPPoL2TP socket per session bound through a plain
AF_INETUDP tunnel socket while Ben uses a newAF_L2TPtunnel socket and no separate socket per session. Both have their merits.
Quoted 8 lines
Quoted 3 lines
Can you elaborate on the merits of having a socket? It would seem to me that not having a socket is a lot more scalable. After all IPsec doesn't carry a socket around per session.
What I meant by "both have their merits" is that both general approaches have their merits. It's a shame Martijn isn't available right now (he's moving home to a new country) as he came up with the initial kernel driver concept. Anyway, I'm sure he'll chime in later.
Ok, I've just cut off the power connector of my laptop and whacked a new one on, so I'm just beginning ot catch up. I'd just like to comment that the socket-per-connection is part of the kernel generic-PPP support. The PPP packets not handled by the kernel need to be transported somewhere and I guess the decision was made to pass it though a PPPoX socket.
If you want to get away from the one socket per session model, you can't use PPPoX sockets. You need something in the kernel to hold the ppp generic data structure. I imagine Ben's uses an array in the kernel and passes stuff to userspace in a way so the user-space daemon can identify the session it belongs to.
I don't see why this PPPoX solution won't scale to thousands of sessions. Sure, you get one socket per session plus one socket per tunnel, but IRC servers run with thousands of sockets and the costs here aren't much more. Sure, someone needs to write a PPP daemon that can handle multiple simultaneous connections, but that's orthoginal to the issue at hand.
If you want to remove the one socket per session requirement, someone needs to redo the PPPoX support. In fact, the whole PPPoX idea seems to have been a bit of a dud since even with it there it seems to be better to just invent your own character device/protocal family/etc than use it. When I started I just used the PPPoX stuff since I figured that was going to be the "supported" way to use the in-kernel PPP stuff.
Also, if Ben's stuff is handling the case of taking seperate L2TP sessions and merging them through to another LNS server, then it is a completely orthoginal system, since that doesn't require full PPP support anyway...
Have a nice day,
Signature · 1 line
Martijn van Oosterhout <[email protected]> http://svana.org/kleptog/
Quoted 3 lines
Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a tool for doing 5% of the work and then sitting around waiting for someone else to do the other 95% so you can sue them.
Quoted 2 lines · David S. Miller
Ben didn't post any pointers to his work so I couldn't do the comparison myself.
It's still alpha and ugly, but... See src/mkifaces.cc for the microbench that shows the scaling issues with lots of interfaces. I'd hoped to have time to test it on the weekend, but other stuff got in the way. The quick guide to setup is:
./configure --with-l2tp make insmod kernel/kern.o insmod drivers/l2tp/l2tp_k.o make -C src mkifaces src/mkifaces <num>
Although I'm not sure if this works on 2.6 in this build as most of my development was done on 2.4 over the summer. Cheers,
-ben
Signature · 1 line
"Time is what keeps everything from happening all at once." -- John Wheeler