diff --git a/net/pptpd/Makefile b/net/pptpd/Makefile new file mode 100644 index 000000000..a2fb91fa9 --- /dev/null +++ b/net/pptpd/Makefile @@ -0,0 +1,69 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=pptpd +PKG_VERSION:=1.4.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/poptop +PKG_MD5SUM:=36f9f45c6ffa92bc3b6e24ae2d053505 + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +PKG_MAINTAINER:=Luka Perkov + +include $(INCLUDE_DIR)/package.mk + +define Package/pptpd + SECTION:=net + CATEGORY:=Network + DEPENDS:=+kmod-ppp +kmod-gre +kmod-mppe +ppp + TITLE:=PopTop pptp server + URL:=http://poptop.sourceforge.net/ + SUBMENU:=VPN +endef + +CONFIGURE_ARGS += \ + --enable-bcrelay \ + +CONFIGURE_VARS += \ + ac_cv_header_libintl_h=no \ + +MAKE_FLAGS += \ + COPTS="$(TARGET_CFLAGS)" \ + INSTALL="install" \ + +define Package/pptpd/conffiles +/etc/pptpd.conf +/etc/ppp/options.pptpd +/etc/config/pptpd +endef + +define Package/pptpd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) \ + $(PKG_INSTALL_DIR)/usr/sbin/bcrelay \ + $(PKG_INSTALL_DIR)/usr/sbin/pptpctrl \ + $(PKG_INSTALL_DIR)/usr/sbin/pptpd \ + $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/lib/pptpd + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pptpd/* $(1)/usr/lib/pptpd/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/pptpd.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/pptpd.init $(1)/etc/init.d/pptpd + $(INSTALL_DIR) $(1)/etc/ppp + $(INSTALL_DATA) ./files/options.pptpd $(1)/etc/ppp/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/pptpd.config $(1)/etc/config/pptpd +endef + +$(eval $(call BuildPackage,pptpd)) diff --git a/net/pptpd/files/options.pptpd b/net/pptpd/files/options.pptpd new file mode 100644 index 000000000..f73eeea23 --- /dev/null +++ b/net/pptpd/files/options.pptpd @@ -0,0 +1,22 @@ +#debug +#logfile /tmp/pptp-server.log +auth +name "pptp-server" +lcp-echo-failure 3 +lcp-echo-interval 60 +default-asyncmap +mtu 1482 +mru 1482 +nobsdcomp +nodeflate +#noproxyarp +#nomppc +mppe required,no40,no56,stateless +require-mschap-v2 +refuse-chap +refuse-mschap +refuse-eap +refuse-pap +#ms-dns 172.16.1.1 +#plugin radius.so +#radius-config-file /etc/radius.conf diff --git a/net/pptpd/files/pptpd.conf b/net/pptpd/files/pptpd.conf new file mode 100644 index 000000000..354745f59 --- /dev/null +++ b/net/pptpd/files/pptpd.conf @@ -0,0 +1,5 @@ +#debug +option /etc/ppp/options.pptpd +speed 115200 +stimeout 10 +#localip & remoteip are not needed, ip management is done by pppd diff --git a/net/pptpd/files/pptpd.config b/net/pptpd/files/pptpd.config new file mode 100644 index 000000000..b2d5df5d7 --- /dev/null +++ b/net/pptpd/files/pptpd.config @@ -0,0 +1,8 @@ +config service 'pptpd' + option 'enabled' '0' + option 'localip' '192.168.0.1' + option 'remoteip' '192.168.0.20-30' + +config 'login' + option 'username' 'youruser' + option 'password' 'yourpass' diff --git a/net/pptpd/files/pptpd.init b/net/pptpd/files/pptpd.init new file mode 100644 index 000000000..0d0639fee --- /dev/null +++ b/net/pptpd/files/pptpd.init @@ -0,0 +1,58 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +START=60 +BIN=/usr/sbin/pptpd +DEFAULT=/etc/default/$BIN +RUN_D=/var/run +PID_F=$RUN_D/$BIN.pid +CONFIG=/var/etc/pptpd.conf +CHAP_SECRETS=/var/etc/chap-secrets + +setup_login() { + local section="$1" + + config_get username "$section" username + config_get password "$section" password + [ -n "$username" ] || return 0 + [ -n "$password" ] || return 0 + + echo "$username pptp-server $password *" >> $CHAP_SECRETS +} + +setup_config() { + local section="$1" + + config_get enabled "$section" enabled + [ "$enabled" -eq 0 ] && return 1 + + mkdir -p /var/etc + cp /etc/pptpd.conf $CONFIG + + config_get localip "$section" localip + config_get remoteip "$section" remoteip + [ -n "$localip" ] && echo "localip $localip" >> $CONFIG + [ -n "$remoteip" ] && echo "remoteip $remoteip" >> $CONFIG + return 0 +} + +start_pptpd() { + [ -f $DEFAULT ] && . $DEFAULT + mkdir -p $RUN_D + for m in arc4 sha1_generic slhc crc-ccitt ppp_generic ppp_async ppp_mppe; do + insmod $m >/dev/null 2>&1 + done + ln -sfn $CHAP_SECRETS /etc/ppp/chap-secrets + service_start $BIN $OPTIONS -c $CONFIG +} + +start() { + config_load pptpd + setup_config pptpd || return + config_foreach setup_login login + start_pptpd +} + +stop() { + service_stop $BIN +} diff --git a/net/pptpd/patches/001-bad_pqueue_debug.patch b/net/pptpd/patches/001-bad_pqueue_debug.patch new file mode 100644 index 000000000..50d525284 --- /dev/null +++ b/net/pptpd/patches/001-bad_pqueue_debug.patch @@ -0,0 +1,18 @@ +--- a/pqueue.c ++++ b/pqueue.c +@@ -7,13 +7,11 @@ + #include "pqueue.h" + + #ifdef DEBUG_PQUEUE +-#define DEBUG_ON 1 ++#define DEBUG_CMD(_a) { _a } + #else +-#define DEBUG_ON 0 ++#define DEBUG_CMD(_a) + #endif + +-#define DEBUG_CMD(_a) if (DEBUG_ON) { _a } +- + #define MIN_CAPACITY 128 /* min allocated buffer for a packet */ + + static int pqueue_alloc (int seq, unsigned char *packet, int packlen, pqueue_t **new); diff --git a/net/pptpd/patches/002-makefile_fix.patch b/net/pptpd/patches/002-makefile_fix.patch new file mode 100644 index 000000000..74e333509 --- /dev/null +++ b/net/pptpd/patches/002-makefile_fix.patch @@ -0,0 +1,11 @@ +--- a/plugins/Makefile ++++ b/plugins/Makefile +@@ -18,7 +18,7 @@ all: $(PLUGINS) + %.so: %.c + $(CC) -o $@ $(LDFLAGS) $(CFLAGS) $^ $(LDADD) + +-LIBDIR ?= $(DESTDIR)$(prefix)/lib/pptpd ++LIBDIR = $(DESTDIR)$(prefix)/lib/pptpd + + install: $(PLUGINS) + $(INSTALL) -d $(LIBDIR) diff --git a/net/pptpd/patches/003-opt_flags.patch b/net/pptpd/patches/003-opt_flags.patch new file mode 100644 index 000000000..cc136c516 --- /dev/null +++ b/net/pptpd/patches/003-opt_flags.patch @@ -0,0 +1,11 @@ +--- a/Makefile.in ++++ b/Makefile.in +@@ -153,7 +153,7 @@ AUTOMAKE = @AUTOMAKE@ + AWK = @AWK@ + CC = @CC@ + CCDEPMODE = @CCDEPMODE@ +-CFLAGS = -O2 -fno-builtin -Wall -DSBINDIR='"$(sbindir)"' ++CFLAGS = $(COPTS) -fno-builtin -Wall -DSBINDIR='"$(sbindir)"' + CPP = @CPP@ + CPPFLAGS = @CPPFLAGS@ + CYGPATH_W = @CYGPATH_W@