From 89561721635655f34b446a885bdd0f2ede45bc95 Mon Sep 17 00:00:00 2001 From: gshep Date: Fri, 16 Apr 2010 22:05:37 -0400 Subject: [PATCH] network/xl2tpd: Added (L2TP daemon) --- network/xl2tpd/README | 21 +++++++ network/xl2tpd/doinst.sh | 17 ++++++ network/xl2tpd/makefile.patch | 44 +++++++++++++++ network/xl2tpd/slack-desc | 19 +++++++ network/xl2tpd/xl2tpd.SlackBuild | 96 ++++++++++++++++++++++++++++++++ network/xl2tpd/xl2tpd.info | 10 ++++ 6 files changed, 207 insertions(+) create mode 100644 network/xl2tpd/README create mode 100644 network/xl2tpd/doinst.sh create mode 100644 network/xl2tpd/makefile.patch create mode 100644 network/xl2tpd/slack-desc create mode 100644 network/xl2tpd/xl2tpd.SlackBuild create mode 100644 network/xl2tpd/xl2tpd.info diff --git a/network/xl2tpd/README b/network/xl2tpd/README new file mode 100644 index 0000000000..212a1a374f --- /dev/null +++ b/network/xl2tpd/README @@ -0,0 +1,21 @@ +xl2tpd is an implementation of the Layer 2 Tunnelling Protocol (RFC 2661). +L2TP allows you to tunnel PPP over UDP. Some ISPs use L2TP to tunnel user +sessions from dial-in servers (modem banks, ADSL DSLAMs) to back-end PPP +servers. Another important application is Virtual Private Networks where +the IPsec protocol is used to secure the L2TP connection (L2TP/IPsec, +RFC 3193). The L2TP/IPsec protocol is mainly used by Windows and +Mac OS X clients. On Linux, xl2tpd can be used in combination with IPsec +implementations such as Openswan. +Example configuration files for such a setup are included in this RPM. + +xl2tpd works by opening a pseudo-tty for communicating with pppd. +It runs completely in userspace but supports kernel mode L2TP. + +xl2tpd supports IPsec SA Reference tracking to enable overlapping internak +NAT'ed IP's by different clients (eg all clients connecting from their +linksys internal IP 192.168.1.101) as well as multiple clients behind +the same NAT router. + +xl2tpd supports the pppol2tp kernel mode operations on 2.6.23 or higher, +or via a patch in contrib for 2.4.x kernels. Note that kernel mode and +IPsec SA Reference tracking do not yet work together. diff --git a/network/xl2tpd/doinst.sh b/network/xl2tpd/doinst.sh new file mode 100644 index 0000000000..c20744d1a0 --- /dev/null +++ b/network/xl2tpd/doinst.sh @@ -0,0 +1,17 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +config etc/xl2tpd/xl2tpd.conf.new +config etc/ppp/options.xl2tpd.new +config etc/ppp/chap-secrets.new + diff --git a/network/xl2tpd/makefile.patch b/network/xl2tpd/makefile.patch new file mode 100644 index 0000000000..5e46047ea4 --- /dev/null +++ b/network/xl2tpd/makefile.patch @@ -0,0 +1,44 @@ +--- Makefile-orig 2010-04-09 20:02:02.000000000 +0400 ++++ Makefile 2010-04-09 20:02:39.000000000 +0400 +@@ -53,8 +53,8 @@ + # but we use a local copy if we don't find it. + # + #KERNELSRC=/lib/modules/`uname -r`/build/ +-KERNELSRC?=./linux +-OSFLAGS?= -DLINUX -I$(KERNELSRC)/include/ ++KERNELSRC=/usr/src/linux ++OSFLAGS= -DLINUX -I$(KERNELSRC)/include/ + # + # Uncomment the following to use the kernel interface under Linux + # This requires the pppol2tp-linux-2.4.27.patch patch from contrib +@@ -62,7 +62,7 @@ + # are packages seperately (eg kernel-headers on Fedora) + # Note: 2.6.23+ support still needs some changes in the xl2tpd source + # +-#OSFLAGS+= -DUSE_KERNEL ++OSFLAGS+= -DUSE_KERNEL + # + # + # Uncomment the next line for FreeBSD +@@ -97,10 +97,10 @@ + #LIBS= $(OSLIBS) # -lefence # efence for malloc checking + EXEC=xl2tpd + +-PREFIX?=/usr/local ++PREFIX?=/usr + SBINDIR?=$(DESTDIR)${PREFIX}/sbin + BINDIR?=$(DESTDIR)${PREFIX}/bin +-MANDIR?=$(DESTDIR)${PREFIX}/share/man ++MANDIR?=$(DESTDIR)${PREFIX}/man + + + all: $(EXEC) pfc +@@ -113,7 +113,7 @@ + + pfc: + $(CC) $(CFLAGS) -c contrib/pfc.c +- $(CC) $(LDFLAGS) -lpcap $(LDLIBS) -o pfc pfc.o ++ $(CC) pfc.o $(LDFLAGS) -lpcap $(LDLIBS) -o pfc + + romfs: + $(ROMFSINST) /bin/$(EXEC) diff --git a/network/xl2tpd/slack-desc b/network/xl2tpd/slack-desc new file mode 100644 index 0000000000..39a49bc557 --- /dev/null +++ b/network/xl2tpd/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +xl2tpd: xl2tpd (L2TP daemon) +xl2tpd: +xl2tpd: Xelerance Corporation currently maintains a version of the Layer 2 +xl2tpd: Tunneling Protocol (L2TP) daemon. +xl2tpd: +xl2tpd: This version contains many patches that have not yet been integrated +xl2tpd: into the mainstream release. These patches are needed to run on +xl2tpd: modern distributions with DEVFS, or to support L2TP over IPsec, when +xl2tpd: used in conjunction with Openswan. +xl2tpd: +xl2tpd: Homepage: http://www.xelerance.com/software/xl2tpd/ diff --git a/network/xl2tpd/xl2tpd.SlackBuild b/network/xl2tpd/xl2tpd.SlackBuild new file mode 100644 index 0000000000..53ba7c73c8 --- /dev/null +++ b/network/xl2tpd/xl2tpd.SlackBuild @@ -0,0 +1,96 @@ +#!/bin/sh + +PRGNAM=xl2tpd +VERSION=1.2.4 +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +# patching make file +patch -p0 -i $CWD/makefile.patch + +# build the program +make +make install DESTDIR=$PKG + +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +( cd $PKG/usr/man + find . -type f -exec gzip -9 {} \; + for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done +) + +# Add some sample config files +mkdir -p $PKG/etc/{xl2tpd,ppp} +cat examples/xl2tpd.conf > $PKG/etc/xl2tpd/xl2tpd.conf.new +cat examples/ppp-options.xl2tpd > $PKG/etc/ppp/options.xl2tpd.new +cat examples/chapsecrets.sample > $PKG/etc/ppp/chap-secrets.new + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +DOCFILES=`ls --color=never examples/xl2tpd-L2TP*`; +if [ "$?" = "0" ]; then + mkdir $PKG/usr/doc/$PRGNAM-$VERSION/examples + for doc_file in $DOCFILES; do + if [ -f $doc_file ]; then + cat $doc_file > $PKG/usr/doc/$PRGNAM-$VERSION/$doc_file + fi + done +fi + +cd doc +DOCFILES="ipsecsaref.png l2tp.png l2tp.svg l2tpd.conf.sample \ +l2tp-secrets.sample origREADME README.passwordfd README.patents rfc2661.txt" +for doc_file in $DOCFILES; do + if [ -f $doc_file ]; then + cp -a $doc_file $PKG/usr/doc/$PRGNAM-$VERSION/ + fi +done +cd .. + +DOCFILES="BUGS CHANGES CREDITS LICENSE README.xl2tpd TODO" +for doc_file in $DOCFILES; do + if [ -f $doc_file ]; then + cp -a $doc_file $PKG/usr/doc/$PRGNAM-$VERSION/ + fi +done + +find $PKG/usr/doc -type f -exec chmod 0644 {} \; + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/network/xl2tpd/xl2tpd.info b/network/xl2tpd/xl2tpd.info new file mode 100644 index 0000000000..9f7f172d55 --- /dev/null +++ b/network/xl2tpd/xl2tpd.info @@ -0,0 +1,10 @@ +PRGNAM="xl2tpd" +VERSION="1.2.4" +HOMEPAGE="http://www.xelerance.com/software/xl2tpd/" +DOWNLOAD="http://www.xelerance.com/software/xl2tpd/xl2tpd-1.2.4.tar.gz" +MD5SUM="d94fc8a13596f12a561240dfcea9f977" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="gshep" +EMAIL="shepelev.georgy@googlemail.com" +APPROVED="dsomero"