Port l2tpd to -ng
git-svn-id: svn://svn.openwrt.org/openwrt/packages@4416 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
4064673f34
commit
d13b0441bf
56
net/l2tpd/Makefile
Normal file
56
net/l2tpd/Makefile
Normal file
@ -0,0 +1,56 @@
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=l2tpd
|
||||
PKG_VERSION:=0.70pre
|
||||
PKG_UPSTREAM_VERSION:=0.70-pre20031121
|
||||
PKG_RELEASE:=4.1
|
||||
PKG_MD5SUM:=3f2707b6e16a8cb72e7bf64f574202fa
|
||||
|
||||
PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/l/l2tpd
|
||||
PKG_SOURCE:=$(PKG_NAME)_$(PKG_UPSTREAM_VERSION).orig.tar.gz
|
||||
PKG_CAT:=zcat
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).orig
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/l2tpd
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=An L2TP (Layer 2 Tunneling Protocol) daemon
|
||||
DESCRIPTION:=A layer 2 tunneling protocol implementation.\\\
|
||||
l2tpd is the open source implementation of the L2TP tunneling\\\
|
||||
protocol (RFC2661). It does implement both LAC and LNS role\\\
|
||||
in a L2TP networking architecture. The main goal of this protocol is\\\
|
||||
to tunnel PPP frame trough an ip network.\\\
|
||||
URL:=http://l2tpd.sourceforge.net/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CC=$(TARGET_CC) \
|
||||
CFLAGS="$(TARGET_CFLAGS) -I. -DLINUX -DSANITY -DIP_ALLOCATION"
|
||||
endef
|
||||
|
||||
define Package/l2tpd/install
|
||||
install -d -m0755 $(1)/etc/l2tpd
|
||||
install -m0644 ./files/l2tpd.conf $(1)/etc/l2tpd/
|
||||
install -d -m0755 $(1)/etc/ppp
|
||||
install -m0644 ./files/options.l2tpd $(1)/etc/ppp/
|
||||
install -d -m0755 $(1)/etc/init.d
|
||||
install -m0755 ./files/l2tpd.init $(1)/etc/init.d/l2tpd
|
||||
install -d -m0755 $(1)/usr/sbin
|
||||
install -m0755 $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,l2tpd))
|
||||
|
29
net/l2tpd/files/l2tpd.conf
Normal file
29
net/l2tpd/files/l2tpd.conf
Normal file
@ -0,0 +1,29 @@
|
||||
;
|
||||
; This is a minimal sample l2tpd configuration file for use
|
||||
; with L2TP over IPsec.
|
||||
;
|
||||
; The idea is to provide an L2TP daemon to which remote Windows L2TP/IPsec
|
||||
; clients connect. In this example, the internal (protected) network
|
||||
; is 192.168.1.0/24. A special IP range within this network is reserved
|
||||
; for the remote clients: 192.168.1.128/25
|
||||
; (i.e. 192.168.1.128 ... 192.168.1.254)
|
||||
;
|
||||
; The listen-addr parameter can be used if you want to bind the L2TP daemon
|
||||
; to a specific IP address instead of to all interfaces. For instance,
|
||||
; you could bind it to the interface of the internal LAN (e.g. 192.168.1.98
|
||||
; in the example below). Yet another IP address (local ip, e.g. 192.168.1.99)
|
||||
; will be used by l2tpd as its address on pppX interfaces.
|
||||
|
||||
[global]
|
||||
; listen-addr = 192.168.1.98
|
||||
|
||||
[lns default]
|
||||
ip range = 192.168.1.128-192.168.1.254
|
||||
local ip = 192.168.1.99
|
||||
require chap = yes
|
||||
refuse pap = yes
|
||||
require authentication = yes
|
||||
name = LinuxVPNserver
|
||||
ppp debug = yes
|
||||
pppoptfile = /etc/ppp/options.l2tpd
|
||||
length bit = yes
|
21
net/l2tpd/files/l2tpd.init
Normal file
21
net/l2tpd/files/l2tpd.init
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
BIN=l2tpd
|
||||
DEFAULT=/etc/default/$BIN
|
||||
RUN_D=/var/run
|
||||
PID_F=$RUN_D/$BIN.pid
|
||||
[ -f $DEFAULT ] && . $DEFAULT
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
$BIN $OPTIONS
|
||||
;;
|
||||
stop)
|
||||
[ -f $PID_F ] && kill $(cat $PID_F)
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 (start|stop)"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
17
net/l2tpd/files/options.l2tpd
Normal file
17
net/l2tpd/files/options.l2tpd
Normal file
@ -0,0 +1,17 @@
|
||||
ipcp-accept-local
|
||||
ipcp-accept-remote
|
||||
ms-dns 192.168.1.1
|
||||
ms-dns 192.168.1.3
|
||||
ms-wins 192.168.1.2
|
||||
ms-wins 192.168.1.4
|
||||
noccp
|
||||
auth
|
||||
crtscts
|
||||
idle 1800
|
||||
mtu 1410
|
||||
mru 1410
|
||||
nodefaultroute
|
||||
debug
|
||||
lock
|
||||
proxyarp
|
||||
connect-delay 5000
|
3394
net/l2tpd/patches/01-debian-2.patch
Normal file
3394
net/l2tpd/patches/01-debian-2.patch
Normal file
File diff suppressed because it is too large
Load Diff
21
net/l2tpd/patches/02-debian-2-pty-rev.patch
Normal file
21
net/l2tpd/patches/02-debian-2-pty-rev.patch
Normal file
@ -0,0 +1,21 @@
|
||||
diff -ruN l2tpd-0.70pre-old/l2tpd.c l2tpd-0.70pre-new/l2tpd.c
|
||||
--- l2tpd-0.70pre-old/l2tpd.c 2005-12-16 12:02:02.000000000 +0100
|
||||
+++ l2tpd-0.70pre-new/l2tpd.c 2005-12-16 12:14:24.000000000 +0100
|
||||
@@ -336,17 +336,10 @@
|
||||
tcgetattr (c->fd, &ptyconf);
|
||||
*(c->oldptyconf) = ptyconf;
|
||||
ptyconf.c_cflag &= ~(ICANON | ECHO);
|
||||
- ptyconf.c_lflag &= ~ECHO;
|
||||
tcsetattr (c->fd, TCSANOW, &ptyconf);
|
||||
|
||||
snprintf (tty, sizeof (tty), "/dev/tty%c%c", a, b);
|
||||
fd2 = open (tty, O_RDWR);
|
||||
- if(!fd2)
|
||||
- log(LOG_WARN, "unable to open tty %s", tty);
|
||||
-
|
||||
- /* XXX JEF: CHECK ME */
|
||||
- stropt[pos++] = strdup(tty);
|
||||
- stropt[pos] = NULL;
|
||||
|
||||
#ifdef USE_KERNEL
|
||||
}
|
1194
net/l2tpd/patches/03-jacco-pty.patch
Normal file
1194
net/l2tpd/patches/03-jacco-pty.patch
Normal file
File diff suppressed because it is too large
Load Diff
12
net/l2tpd/patches/04-gcc4.patch
Normal file
12
net/l2tpd/patches/04-gcc4.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -urN ../tmp-orig/l2tpd-0.70-pre20031121/aaa.c ./aaa.c
|
||||
--- ../tmp-orig/l2tpd-0.70-pre20031121/aaa.c 2004-12-09 09:54:10.159417376 +0100
|
||||
+++ ./aaa.c 2004-12-09 09:54:01.918670160 +0100
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
/* FIXME: Accounting? */
|
||||
|
||||
-static struct addr_ent *uaddr[ADDR_HASH_SIZE];
|
||||
+struct addr_ent *uaddr[ADDR_HASH_SIZE];
|
||||
|
||||
void init_addr ()
|
||||
{
|
26
net/l2tpd/patches/04-nonblock.patch
Normal file
26
net/l2tpd/patches/04-nonblock.patch
Normal file
@ -0,0 +1,26 @@
|
||||
--- l2tpd-0.70-pre20031121.orig/l2tpd.c.orig 2006-04-05 13:28:36.000000000 +0100
|
||||
+++ l2tpd-0.70-pre20031121.orig/l2tpd.c 2006-04-05 13:33:39.000000000 +0100
|
||||
@@ -289,6 +289,8 @@
|
||||
#endif
|
||||
struct termios ptyconf;
|
||||
char *str;
|
||||
+ int flags;
|
||||
+
|
||||
p = opts;
|
||||
stropt[0] = strdup (PPPD);
|
||||
while (p)
|
||||
@@ -347,6 +349,14 @@
|
||||
close(c->fd);
|
||||
return -EINVAL;
|
||||
}
|
||||
+ flags = fcntl(c->fd, F_GETFL);
|
||||
+ if (flags < 0 || fcntl(c->fd, F_SETFL, flags | O_NONBLOCK) < 0)
|
||||
+ {
|
||||
+ log (LOG_WARN, "%s: unable to fcntl(O_NONBLOCK) on pty\n",
|
||||
+ __FUNCTION__);
|
||||
+ close(c->fd);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
tty = ptsname(c->fd);
|
||||
if (tty == NULL)
|
||||
{
|
25
net/l2tpd/patches/05-df-disable.patch
Normal file
25
net/l2tpd/patches/05-df-disable.patch
Normal file
@ -0,0 +1,25 @@
|
||||
Patch to stop l2tpd setting the DF bit on each of the packets it sends.
|
||||
Apart from not being useful with L2TP, this also prevents interoperating
|
||||
with Cisco IOS over IPSEC.
|
||||
|
||||
--- l2tpd-0.70-pre20031121.orig/network.c.orig 2006-04-11 08:50:38.000000000 +0100
|
||||
+++ l2tpd-0.70-pre20031121.orig/network.c 2006-04-11 08:58:18.000000000 +0100
|
||||
@@ -56,6 +56,18 @@
|
||||
__FUNCTION__);
|
||||
return -EINVAL;
|
||||
};
|
||||
+#ifdef IP_MTU_DISCOVER
|
||||
+#ifdef IP_PMTUDISC_DONT
|
||||
+ {
|
||||
+ /* Don't set DF bit on outbound packets */
|
||||
+ int val = IP_PMTUDISC_DONT;
|
||||
+ if (setsockopt(server_socket, IPPROTO_IP, IP_MTU_DISCOVER, &val, sizeof(val)) < 0)
|
||||
+ {
|
||||
+ log (LOG_LOG, "Failed to disable PMTU discovery\n");
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+#endif
|
||||
/* L2TP/IPSec: Set up SA for listening port here? NTB 20011015
|
||||
*/
|
||||
if (bind (server_socket, (struct sockaddr *) &server, sizeof (server)))
|
Loading…
x
Reference in New Issue
Block a user