Browse Source

pptpd: import from old packages

Signed-off-by: Luka Perkov <luka@openwrt.org>
Luka Perkov 9 years ago
parent
commit
264b65a41b

+ 69
- 0
net/pptpd/Makefile View File

@@ -0,0 +1,69 @@
1
+#
2
+# Copyright (C) 2006-2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=pptpd
11
+PKG_VERSION:=1.4.0
12
+PKG_RELEASE:=1
13
+
14
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15
+PKG_SOURCE_URL:=@SF/poptop
16
+PKG_MD5SUM:=36f9f45c6ffa92bc3b6e24ae2d053505
17
+
18
+PKG_INSTALL:=1
19
+PKG_BUILD_PARALLEL:=1
20
+
21
+PKG_MAINTAINER:=Luka Perkov <luka@openwrt.org>
22
+
23
+include $(INCLUDE_DIR)/package.mk
24
+
25
+define Package/pptpd
26
+  SECTION:=net
27
+  CATEGORY:=Network
28
+  DEPENDS:=+kmod-ppp +kmod-gre +kmod-mppe +ppp
29
+  TITLE:=PopTop pptp server
30
+  URL:=http://poptop.sourceforge.net/
31
+  SUBMENU:=VPN
32
+endef
33
+
34
+CONFIGURE_ARGS += \
35
+	--enable-bcrelay \
36
+
37
+CONFIGURE_VARS += \
38
+	ac_cv_header_libintl_h=no \
39
+
40
+MAKE_FLAGS += \
41
+	COPTS="$(TARGET_CFLAGS)" \
42
+	INSTALL="install" \
43
+
44
+define Package/pptpd/conffiles
45
+/etc/pptpd.conf
46
+/etc/ppp/options.pptpd
47
+/etc/config/pptpd
48
+endef
49
+
50
+define Package/pptpd/install
51
+	$(INSTALL_DIR) $(1)/usr/sbin
52
+	$(CP) \
53
+		$(PKG_INSTALL_DIR)/usr/sbin/bcrelay \
54
+		$(PKG_INSTALL_DIR)/usr/sbin/pptpctrl \
55
+		$(PKG_INSTALL_DIR)/usr/sbin/pptpd \
56
+		$(1)/usr/sbin/
57
+	$(INSTALL_DIR) $(1)/usr/lib/pptpd
58
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pptpd/* $(1)/usr/lib/pptpd/
59
+	$(INSTALL_DIR) $(1)/etc
60
+	$(INSTALL_DATA) ./files/pptpd.conf $(1)/etc/
61
+	$(INSTALL_DIR) $(1)/etc/init.d
62
+	$(INSTALL_BIN) ./files/pptpd.init $(1)/etc/init.d/pptpd
63
+	$(INSTALL_DIR) $(1)/etc/ppp
64
+	$(INSTALL_DATA) ./files/options.pptpd $(1)/etc/ppp/
65
+	$(INSTALL_DIR) $(1)/etc/config
66
+	$(INSTALL_DATA) ./files/pptpd.config $(1)/etc/config/pptpd
67
+endef
68
+
69
+$(eval $(call BuildPackage,pptpd))

+ 22
- 0
net/pptpd/files/options.pptpd View File

@@ -0,0 +1,22 @@
1
+#debug
2
+#logfile /tmp/pptp-server.log
3
+auth
4
+name "pptp-server"
5
+lcp-echo-failure 3
6
+lcp-echo-interval 60
7
+default-asyncmap
8
+mtu 1482
9
+mru 1482
10
+nobsdcomp
11
+nodeflate
12
+#noproxyarp
13
+#nomppc
14
+mppe required,no40,no56,stateless
15
+require-mschap-v2
16
+refuse-chap
17
+refuse-mschap
18
+refuse-eap
19
+refuse-pap
20
+#ms-dns 172.16.1.1
21
+#plugin radius.so
22
+#radius-config-file /etc/radius.conf

+ 5
- 0
net/pptpd/files/pptpd.conf View File

@@ -0,0 +1,5 @@
1
+#debug
2
+option /etc/ppp/options.pptpd
3
+speed 115200
4
+stimeout 10
5
+#localip & remoteip are not needed, ip management is done by pppd

+ 8
- 0
net/pptpd/files/pptpd.config View File

@@ -0,0 +1,8 @@
1
+config service 'pptpd'
2
+	option 'enabled' '0'
3
+	option 'localip' '192.168.0.1'
4
+	option 'remoteip' '192.168.0.20-30'
5
+
6
+config 'login'
7
+	option 'username' 'youruser'
8
+	option 'password' 'yourpass'

+ 58
- 0
net/pptpd/files/pptpd.init View File

@@ -0,0 +1,58 @@
1
+#!/bin/sh /etc/rc.common
2
+# Copyright (C) 2006 OpenWrt.org
3
+
4
+START=60
5
+BIN=/usr/sbin/pptpd
6
+DEFAULT=/etc/default/$BIN
7
+RUN_D=/var/run
8
+PID_F=$RUN_D/$BIN.pid
9
+CONFIG=/var/etc/pptpd.conf
10
+CHAP_SECRETS=/var/etc/chap-secrets
11
+
12
+setup_login() {
13
+	local section="$1"
14
+
15
+	config_get username "$section" username
16
+	config_get password "$section" password
17
+	[ -n "$username" ] || return 0
18
+	[ -n "$password" ] || return 0
19
+
20
+	echo "$username pptp-server $password *" >> $CHAP_SECRETS
21
+}
22
+
23
+setup_config() {
24
+	local section="$1"
25
+
26
+	config_get enabled "$section" enabled
27
+	[ "$enabled" -eq 0 ] && return 1
28
+
29
+	mkdir -p /var/etc
30
+	cp /etc/pptpd.conf $CONFIG
31
+
32
+	config_get localip "$section" localip
33
+	config_get remoteip "$section" remoteip
34
+	[ -n "$localip" ] && echo "localip  $localip" >> $CONFIG
35
+	[ -n "$remoteip" ] && echo "remoteip  $remoteip" >> $CONFIG
36
+	return 0
37
+}
38
+
39
+start_pptpd() {
40
+	[ -f $DEFAULT ] && . $DEFAULT
41
+	mkdir -p $RUN_D
42
+	for m in arc4 sha1_generic slhc crc-ccitt ppp_generic ppp_async ppp_mppe; do
43
+		insmod $m >/dev/null 2>&1
44
+	done
45
+	ln -sfn $CHAP_SECRETS /etc/ppp/chap-secrets
46
+	service_start $BIN $OPTIONS -c $CONFIG
47
+}
48
+
49
+start() {
50
+	config_load pptpd
51
+	setup_config pptpd || return
52
+	config_foreach setup_login login
53
+	start_pptpd
54
+}
55
+
56
+stop() {
57
+	service_stop $BIN
58
+}

+ 18
- 0
net/pptpd/patches/001-bad_pqueue_debug.patch View File

@@ -0,0 +1,18 @@
1
+--- a/pqueue.c
2
++++ b/pqueue.c
3
+@@ -7,13 +7,11 @@
4
+ #include "pqueue.h"
5
+ 
6
+ #ifdef DEBUG_PQUEUE
7
+-#define DEBUG_ON 1
8
++#define DEBUG_CMD(_a) { _a }
9
+ #else
10
+-#define DEBUG_ON 0
11
++#define DEBUG_CMD(_a)
12
+ #endif
13
+ 
14
+-#define DEBUG_CMD(_a) if (DEBUG_ON) { _a }
15
+-
16
+ #define MIN_CAPACITY 128 /* min allocated buffer for a packet */
17
+ 
18
+ static int pqueue_alloc (int seq, unsigned char *packet, int packlen, pqueue_t **new);

+ 11
- 0
net/pptpd/patches/002-makefile_fix.patch View File

@@ -0,0 +1,11 @@
1
+--- a/plugins/Makefile
2
++++ b/plugins/Makefile
3
+@@ -18,7 +18,7 @@ all:	$(PLUGINS)
4
+ %.so: %.c
5
+ 	$(CC) -o $@ $(LDFLAGS) $(CFLAGS) $^ $(LDADD)
6
+ 
7
+-LIBDIR	?= $(DESTDIR)$(prefix)/lib/pptpd
8
++LIBDIR	= $(DESTDIR)$(prefix)/lib/pptpd
9
+ 
10
+ install: $(PLUGINS)
11
+ 	$(INSTALL) -d $(LIBDIR)

+ 11
- 0
net/pptpd/patches/003-opt_flags.patch View File

@@ -0,0 +1,11 @@
1
+--- a/Makefile.in
2
++++ b/Makefile.in
3
+@@ -153,7 +153,7 @@ AUTOMAKE = @AUTOMAKE@
4
+ AWK = @AWK@
5
+ CC = @CC@
6
+ CCDEPMODE = @CCDEPMODE@
7
+-CFLAGS = -O2 -fno-builtin -Wall -DSBINDIR='"$(sbindir)"'
8
++CFLAGS = $(COPTS) -fno-builtin -Wall -DSBINDIR='"$(sbindir)"'
9
+ CPP = @CPP@
10
+ CPPFLAGS = @CPPFLAGS@
11
+ CYGPATH_W = @CYGPATH_W@