Skip to content

Commit c3480c5

Browse files
committed
Add L2TP support.
Patch from James Chapman. This patch adds support for L2TP. It allows pppd to interface with the pppol2tp driver in the Linux kernel. All data packets are handled by the Linux kernel in order that the datapath be as efficient as possible, while a userspace daemon implements the L2TP control protocol, handling tunnel/session setup and teardown. The implementation uses the PPPoX infrastructure; the architecture is similar to PPPoE/PPPoATM in that a userspace daemon spawns a pppd process per PPP session and uses a protocol-specific plugin to connect pppd with the kernel. The pppol2tp Linux kernel driver was integrated in the Linux kernel from 2.6.23. For earlier kernels, an out of tree driver is available from the pppol2tp-kmod package on the OpenL2TP project site at http://sourceforge.net/projects/openl2tp. Signed-off-by: James Chapman <[email protected]>
1 parent b82a6c7 commit c3480c5

File tree

5 files changed

+625
-3
lines changed

5 files changed

+625
-3
lines changed

README.pppol2tp

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
PPPoL2TP plugin
2+
===============
3+
4+
The pppol2tp plugin lets pppd use the Linux kernel driver pppol2tp.ko
5+
to pass PPP frames in L2TP tunnels. The driver was integrated into the
6+
kernel in the 2.6.23 release. For kernels before 2.6.23, an
7+
out-of-tree kernel module is available from the pppol2tp-kmod package
8+
in the OpenL2TP project.
9+
10+
Note that pppd receives only PPP control frames over the PPPoL2TP
11+
socket; data frames are handled entirely by the kernel.
12+
13+
The pppol2tp plugin adds extra arguments to pppd and uses the Linux kernel
14+
PPP-over-L2TP driver to set up each session's data path.
15+
16+
Arguments are:-
17+
18+
pppol2tp <fd> - FD for PPPoL2TP socket
19+
pppol2tp_lns_mode - PPPoL2TP LNS behavior. Default off.
20+
pppol2tp_send_seq - PPPoL2TP enable sequence numbers in
21+
transmitted data packets. Default off.
22+
pppol2tp_recv_seq - PPPoL2TP enforce sequence numbers in
23+
received data packets. Default off.
24+
pppol2tp_reorderto <millisecs> - PPPoL2TP data packet reorder timeout.
25+
Default 0 (no reordering).
26+
pppol2tp_debug_mask <mask> - PPPoL2TP debug mask. Bitwise OR of
27+
1 - verbose debug
28+
2 - control
29+
4 - kernel transport
30+
8 - ppp packet data
31+
Default: 0 (no debug).
32+
pppol2tp_ifname <ifname> - Name of PPP network interface visible
33+
to "ifconfig" and "ip link".
34+
Default: "pppN"
35+
pppol2tp_tunnel_id <id> - L2TP tunnel_id tunneling this PPP
36+
session.
37+
pppol2tp_session_id <id> - L2TP session_id of this PPP session.
38+
The tunnel_id/session_id pair is used
39+
when sending event messages to openl2tpd.
40+
41+
pppd will typically be started by an L2TP daemon for each L2TP sesion,
42+
supplying one or more of the above arguments as required. The pppd
43+
user will usually have no visibility of these arguments.
44+
45+
Two hooks are exported by this plugin.
46+
47+
void (*pppol2tp_send_accm_hook)(int tunnel_id, int session_id,
48+
uint32_t send_accm, uint32_t recv_accm);
49+
void (*pppol2tp_ip_updown_hook)(int tunnel_id, int session_id, int up);
50+
51+
Credits
52+
=======
53+
54+
This plugin was developed by Katalix Systems as part of the OpenL2TP
55+
project, http://openl2tp.sourceforge.net. OpenL2TP is a full-featured
56+
L2TP client-server, suitable for use as an enterprise L2TP VPN server
57+
or a VPN client.
58+
59+
Please copy problems to the OpenL2TP mailing list:
60+
61+
62+
Maintained by:
63+
James Chapman
64+
65+
Katalix Systems Ltd
66+
http://www.katalix.com

configure

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/sh
2-
# $Id: configure,v 1.37 2005/06/26 23:53:17 carlsonj Exp $
2+
# $Id: configure,v 1.38 2008/06/15 07:08:49 paulus Exp $
33

44
# Where to install stuff by default
55
DESTDIR=/usr/local
@@ -194,7 +194,8 @@ if [ -d "$ksrc" ]; then
194194
mkmkf $ksrc/Makefile.top Makefile
195195
mkmkf $ksrc/Makedefs$compiletype Makedefs.com
196196
for dir in pppd pppstats chat pppdump pppd/plugins pppd/plugins/rp-pppoe \
197-
pppd/plugins/radius pppd/plugins/pppoatm; do
197+
pppd/plugins/radius pppd/plugins/pppoatm \
198+
pppd/plugins/pppol2tp; do
198199
mkmkf $dir/Makefile.$makext $dir/Makefile
199200
done
200201
if [ -f $ksrc/Makefile.$makext$archvariant ]; then

pppd/plugins/Makefile.linux

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ BINDIR = $(DESTDIR)/sbin
99
MANDIR = $(DESTDIR)/share/man/man8
1010
LIBDIR = $(DESTDIR)/lib/pppd/$(VERSION)
1111

12-
SUBDIRS := rp-pppoe pppoatm
12+
SUBDIRS := rp-pppoe pppoatm pppol2tp
1313
# Uncomment the next line to include the radius authentication plugin
1414
SUBDIRS += radius
1515
PLUGINS := minconn.so passprompt.so passwordfd.so winbind.so

pppd/plugins/pppol2tp/Makefile.linux

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
CC = gcc
2+
COPTS = -O2 -g
3+
CFLAGS = $(COPTS) -I../.. -I../../../include -fPIC
4+
LDFLAGS = -shared
5+
INSTALL = install
6+
7+
#***********************************************************************
8+
9+
DESTDIR = @DESTDIR@
10+
LIBDIR = $(DESTDIR)/lib/pppd/$(VERSION)
11+
12+
VERSION = $(shell awk -F '"' '/VERSION/ { print $$2; }' ../../patchlevel.h)
13+
14+
PLUGINS := pppol2tp.so
15+
16+
all: $(PLUGINS)
17+
18+
%.so: %.o
19+
$(CC) $(CFLAGS) -o $@ -shared $^ $(LIBS)
20+
21+
install: all
22+
$(INSTALL) -d -m 755 $(LIBDIR)
23+
$(INSTALL) -c -m 4550 $(PLUGIN) $(LIBDIR)
24+
25+
clean:
26+
rm -f *.o *.so
27+
28+
%.o: %.c
29+
$(CC) $(CFLAGS) -c -o $@ $<

0 commit comments

Comments
 (0)