summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2005-04-05 02:03:37 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2005-04-05 02:03:37 +0000
commit5e2ca2a022b6d45461cbd859ce856fd2ab436188 (patch)
tree003a889a82be9f0beebd133b178e8d43920a671c
parentab074c6686e4c428164c943d9fb1037e3b7412cf (diff)
add openswan
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@565 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--openwrt/package/Config.in1
-rw-r--r--openwrt/package/Makefile2
-rw-r--r--openwrt/package/openswan/Config.in5
-rw-r--r--openwrt/package/openswan/Makefile79
-rw-r--r--openwrt/package/openswan/openswan.control7
-rw-r--r--openwrt/package/openswan/patches/pluto-includes.patch25
-rw-r--r--openwrt/package/openswan/patches/scripts.patch170
7 files changed, 289 insertions, 0 deletions
diff --git a/openwrt/package/Config.in b/openwrt/package/Config.in
index e7d9f28e99..7a04669c6f 100644
--- a/openwrt/package/Config.in
+++ b/openwrt/package/Config.in
@@ -44,6 +44,7 @@ source "package/aiccu/Config.in"
source "package/bwm/Config.in"
source "package/ntpclient/Config.in"
source "package/radvd/Config.in"
+source "package/openswan/Config.in"
comment "Libraries"
source "package/zlib/Config.in"
diff --git a/openwrt/package/Makefile b/openwrt/package/Makefile
index 4d3c85c266..99696770c1 100644
--- a/openwrt/package/Makefile
+++ b/openwrt/package/Makefile
@@ -31,6 +31,7 @@ package-$(BR2_PACKAGE_NFSD) += nfs-server
package-$(BR2_PACKAGE_NOCATSPLASH) += nocatsplash
package-$(BR2_PACKAGE_NTPCLIENT) += ntpclient
package-$(BR2_PACKAGE_OPENSSL) += openssl
+package-$(BR2_PACKAGE_OPENSWAN) += openswan
package-$(BR2_PACKAGE_OPENNTPD) += openntpd
package-$(BR2_PACKAGE_OPENVPN) += openvpn
package-$(BR2_PACKAGE_PCRE) += pcre
@@ -62,6 +63,7 @@ ifeq ($(BR2_PACKAGE_OPENVPN_LZO),y)
openvpn-compile: lzo-compile
endif
+openswan-compile: gmp-compile
nocatsplash-compile: glib-compile
arpwatch-compile: libpcap-compile
tcpdump-compile: libpcap-compile
diff --git a/openwrt/package/openswan/Config.in b/openwrt/package/openswan/Config.in
new file mode 100644
index 0000000000..56c4c4a619
--- /dev/null
+++ b/openwrt/package/openswan/Config.in
@@ -0,0 +1,5 @@
+config BR2_PACKAGE_OPENSWAN
+ tristate "Openswan"
+ default m
+ help
+ Openswan is an implementation of IPsec for Linux.
diff --git a/openwrt/package/openswan/Makefile b/openwrt/package/openswan/Makefile
new file mode 100644
index 0000000000..b652e1edaf
--- /dev/null
+++ b/openwrt/package/openswan/Makefile
@@ -0,0 +1,79 @@
+# $Id$
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=openswan
+PKG_VERSION:=2.3.1dr6
+PKG_RELEASE:=1
+PKG_MD5SUM:=x
+
+PKG_SOURCE_URL:=http://www.openswan.org/download
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_CAT:=zcat
+PKG_IPK:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
+PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg
+
+$(DL_DIR)/$(PKG_SOURCE):
+ $(SCRIPT_DIR)/download.pl $(DL_DIR) $(PKG_SOURCE) $(PKG_MD5SUM) $(PKG_SOURCE_URL)
+
+$(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE)
+ $(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ $(PATCH) $(PKG_BUILD_DIR) ./patches
+ touch $(PKG_BUILD_DIR)/.patched
+
+FLAGS := $(TARGET_CFLAGS) -I$(PKG_BUILD_DIR)/linux/include -L$(STAGING_DIR)/usr/lib -I$(STAGING_DIR)/usr/include
+
+$(PKG_BUILD_DIR)/$(PKG_NAME): $(PKG_BUILD_DIR)/.patched
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ $(TARGET_CONFIGURE_OPTS) \
+ KERNELSRC="$(LINUX_DIR)" \
+ ARCH="mips" \
+ USERCOMPILE="$(FLAGS)" \
+ module
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ $(TARGET_CONFIGURE_OPTS) \
+ KERNELSRC="$(LINUX_DIR)" \
+ ARCH="mips" \
+ USERCOMPILE="$(FLAGS)" \
+ EXTRA_INCLUDE="-I$(STAGING_DIR)/usr/include" \
+ EXTRA_LIBS="-L$(STAGING_DIR)/usr/lib" \
+ IPSECDIR="/usr/lib/ipsec" \
+ INC_USRLOCAL="/usr" \
+ programs
+
+$(PKG_IPK): $(PKG_BUILD_DIR)/$(PKG_NAME)
+ $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ $(TARGET_CONFIGURE_OPTS) \
+ DESTDIR="$(PKG_IPK_DIR)" \
+ KERNELSRC="$(LINUX_DIR)" \
+ ARCH="mips" \
+ USERCOMPILE="$(FLAGS)" \
+ IPSECDIR="/usr/lib/ipsec" \
+ INC_USRLOCAL="/usr" \
+ install
+ -$(STRIP) $(PKG_IPK_DIR)/usr/lib/ipsec/*
+ -$(STRIP) $(PKG_IPK_DIR)/usr/libexec/ipsec/*
+ rm -rf $(PKG_IPK_DIR)/usr/share
+ rm -rf $(PKG_IPK_DIR)/usr/man
+ rm -rf $(PKG_IPK_DIR)/etc/rc.d/rc*.d
+ mkdir -p $(PKG_IPK_DIR)/etc/init.d
+ ln -sf ../rc.d/init.d/ipsec $(PKG_IPK_DIR)/etc/init.d/S60ipsec
+ mkdir -p $(PKG_IPK_DIR)/lib/modules/$(LINUX_VERSION)
+ cp $(PKG_BUILD_DIR)/modobj/ipsec.o $(PKG_IPK_DIR)/lib/modules/$(LINUX_VERSION)/
+ mkdir -p $(PACKAGE_DIR)
+ find $(PKG_BUILD_DIR) -name \*.old | xargs rm -rf
+ $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR)
+
+$(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK)
+ $(IPKG) install $(PKG_IPK)
+
+source: $(DL_DIR)/$(PKG_SOURCE)
+prepare: $(PKG_BUILD_DIR)/.patched
+compile: $(PKG_IPK)
+install: $(IPKG_STATE_DIR)/info/$(PKG_NAME).list
+
+clean:
+ rm -rf $(PKG_BUILD_DIR)
+ rm -f $(PKG_IPK)
diff --git a/openwrt/package/openswan/openswan.control b/openwrt/package/openswan/openswan.control
new file mode 100644
index 0000000000..1f039c50b0
--- /dev/null
+++ b/openwrt/package/openswan/openswan.control
@@ -0,0 +1,7 @@
+Package: openswan
+Section: base
+Priority: optional
+Maintainer: Felix Fietkau <nbd@vd-s.ath.cx>
+Source: buildroot internal
+Depends: libgmp
+Description: Openswan IPSec software
diff --git a/openwrt/package/openswan/patches/pluto-includes.patch b/openwrt/package/openswan/patches/pluto-includes.patch
new file mode 100644
index 0000000000..d189c1f4a8
--- /dev/null
+++ b/openwrt/package/openswan/patches/pluto-includes.patch
@@ -0,0 +1,25 @@
+diff -urN openswan-2.3.1dr6.old/programs/pluto/Makefile openswan-2.3.1dr6/programs/pluto/Makefile
+--- openswan-2.3.1dr6.old/programs/pluto/Makefile 2005-03-27 22:21:41.000000000 +0200
++++ openswan-2.3.1dr6/programs/pluto/Makefile 2005-04-05 02:58:42.000000000 +0200
+@@ -66,7 +66,7 @@
+
+ # where to find klips headers and Openswan headers
+ # and 2.6 kernel's <rtnetlink.h> and <xfrm.h>
+-HDRDIRS = -I${OPENSWANSRCDIR}/programs/pluto/linux26 -I${OPENSWANSRCDIR}/include -I$(KLIPSINC)
++HDRDIRS = -I${OPENSWANSRCDIR}/programs/pluto/linux26 -I${OPENSWANSRCDIR}/include -I$(KLIPSINC) $(EXTRA_INCLUDE)
+
+ # On non-LINUX systems, these one of these may be needed (see endian.h)
+ # BYTE_ORDER = -DBIG_ENDIAN=4321 -DLITTLE_ENDIAN=1234 -DBYTE_ORDER=BIG_ENDIAN
+diff -urN openswan-2.3.1dr6.old/programs/pluto/Makefile openswan-2.3.1dr6.dev/programs/pluto/Makefile
+--- openswan-2.3.1dr6.old/programs/pluto/Makefile 2005-04-05 03:00:36.000000000 +0200
++++ openswan-2.3.1dr6.dev/programs/pluto/Makefile 2005-04-05 03:06:18.000000000 +0200
+@@ -255,7 +255,7 @@
+ LIBSPLUTO+=$(IPSECPOLICY_LIBS) $(X509_LIBS) $(SMARTCARD_LIBS)
+ LIBSPLUTO+=$(HAVE_THREADS_LIBS) ${XAUTHPAM_LIBS}
+ LIBSPLUTO+=${CURL_LIBS}
+-LIBSPLUTO+= -lgmp -lresolv # -lefence
++LIBSPLUTO+= $(EXTRA_LIBS) -lgmp -lresolv # -lefence
+
+ ifneq ($(LD_LIBRARY_PATH),)
+ LDFLAGS=-L$(LD_LIBRARY_PATH)
+Binary files openswan-2.3.1dr6.old/programs/pluto/.Makefile.swp and openswan-2.3.1dr6.dev/programs/pluto/.Makefile.swp differ
diff --git a/openwrt/package/openswan/patches/scripts.patch b/openwrt/package/openswan/patches/scripts.patch
new file mode 100644
index 0000000000..5864ce95a6
--- /dev/null
+++ b/openwrt/package/openswan/patches/scripts.patch
@@ -0,0 +1,170 @@
+diff -uNr openswan-2.3.0.orig/programs/loggerfix openswan-2.3.0/programs/loggerfix
+--- openswan-2.3.0.orig/programs/loggerfix 1970-01-01 00:00:00.000000000 +0000
++++ openswan-2.3.0/programs/loggerfix 2005-02-02 20:34:54.000000000 +0000
+@@ -0,0 +1,5 @@
++#!/bin/sh
++# use filename instead of /dev/null to log, but dont log to flash or ram
++# pref. log to nfs mount
++echo "$*" >> /dev/null
++exit 0
+diff -uNr openswan-2.3.0.orig/programs/look/look.in openswan-2.3.0/programs/look/look.in
+--- openswan-2.3.0.orig/programs/look/look.in 2003-10-31 02:32:42.000000000 +0000
++++ openswan-2.3.0/programs/look/look.in 2005-02-02 20:34:54.000000000 +0000
+@@ -79,7 +79,7 @@
+ then
+ pat="$pat|$defaultroutephys\$|$defaultroutevirt\$"
+ else
+- for i in `echo "$IPSECinterfaces" | tr '=' ' '`
++ for i in `echo "$IPSECinterfaces" | sed 's/=/ /'`
+ do
+ pat="$pat|$i\$"
+ done
+diff -uNr openswan-2.3.0.orig/programs/manual/manual.in openswan-2.3.0/programs/manual/manual.in
+--- openswan-2.3.0.orig/programs/manual/manual.in 2004-11-01 22:49:01.000000000 +0000
++++ openswan-2.3.0/programs/manual/manual.in 2005-02-02 20:34:54.000000000 +0000
+@@ -104,7 +104,7 @@
+ sub(/:/, " ", $0)
+ if (interf != "")
+ print $3 "@" interf
+- }' | tr '\n' ' '`"
++ }' | sed ':a;N;$!ba;s/\n/ /g'`"
+ ;;
+ esac
+ diff -uNr openswan-2.3.0.orig/programs/_startklips/_startklips.in openswan-2.3.0/programs/_startklips/_startklips.in
+--- openswan-2.3.0.orig/programs/_startklips/_startklips.in 2004-12-10 12:38:28.000000000 +0000
++++ openswan-2.3.0/programs/_startklips/_startklips.in 2005-02-02 20:34:54.000000000 +0000
+@@ -292,7 +292,12 @@
+ fi
+ unset MODPATH MODULECONF # no user overrides!
+ depmod -a >/dev/null 2>&1
+- modprobe -v ipsec
++ if [ -f modprobe ]
++ then modprobe -v ipsec
++ elif [ -f insmod ]
++ then insmod ipsec
++ fi
++
+ fi
+ if test ! -f $ipsecversion
+ then
+diff -uNr openswan-2.3.0.orig/programs/setup/setup.in openswan-2.3.0/programs/setup/setup.in
+--- openswan-2.3.0.orig/programs/setup/setup.in 2004-03-22 00:24:06.000000000 +0000
++++ openswan-2.3.0/programs/setup/setup.in 2005-02-02 20:34:54.000000000 +0000
+@@ -110,12 +110,22 @@
+ # do it
+ case "$1" in
+ start|--start|stop|--stop|_autostop|_autostart)
+- if test " `id -u`" != " 0"
++ if [ "x${USER}" != "xroot" ]
+ then
+ echo "permission denied (must be superuser)" |
+ logger -s -p $IPSECsyslog -t ipsec_setup 2>&1
+ exit 1
+ fi
++
++ # make sure all required directories exist
++ if [ ! -d /var/run ]
++ then
++ mkdir -p /var/run/pluto
++ fi
++ if [ ! -d /var/lock/subsys ]
++ then
++ mkdir -p /var/lock/subsys
++ fi
+ tmp=/var/run/pluto/ipsec_setup.st
+ outtmp=/var/run/pluto/ipsec_setup.out
+ (
+--- openswan-2.3.0.orig/programs/setup/Makefile 2004-04-03 19:44:48.000000000 +0000
++++ openswan-2.3.0/programs/setup/Makefile 2005-02-02 20:34:54.000000000 +0000
+@@ -32,7 +32,7 @@
+ install:: setup
+ @rm -f $(BINDIR)/setup
+ @$(INSTALL) $(INSTBINFLAGS) setup $(RCDIR)/ipsec
+- @ln -s $(FINALRCDIR)/ipsec $(BINDIR)/setup
++ @ln -s $(FINALRCDIR)/S50ipsec $(BINDIR)/setup
+ -@for i in 0 1 2 3 4 5 6; do mkdir -p $(RCDIR)/../rc$$i.d; done
+ -@cd $(RCDIR)/../rc0.d && ln -f -s ../init.d/ipsec K76ipsec
+ -@cd $(RCDIR)/../rc1.d && ln -f -s ../init.d/ipsec K76ipsec
+diff -uNr openswan-2.3.0.orig/programs/showhostkey/showhostkey.in openswan-2.3.0/programs/showhostkey/showhostkey.in
+--- openswan-2.3.0.orig/programs/showhostkey/showhostkey.in 2004-11-14 13:40:41.000000000 +0000
++++ openswan-2.3.0/programs/showhostkey/showhostkey.in 2005-02-02 20:34:54.000000000 +0000
+@@ -63,7 +63,7 @@
+ exit 1
+ fi
+
+-host="`hostname --fqdn`"
++host="`nvram get wan_hostname`"
+
+ awk ' BEGIN {
+
+diff -uNr openswan-2.3.0.orig/programs/send-pr/send-pr.in openswan-2.3.0/programs/send-pr/send-pr.in
+--- openswan-2.3.0.orig/programs/send-pr/send-pr.in 2003-07-14 12:26:17.000000000 +0000
++++ openswan-2.3.0/programs/send-pr/send-pr.in 2005-02-02 20:34:54.000000000 +0000
+@@ -402,7 +402,7 @@
+ else
+ if [ "$fieldname" != "Category" ]
+ then
+- values=`${BINDIR}/query-pr --valid-values $fieldname | tr '\n' ' ' | sed 's/ *$//g;s/ / | /g;s/^/[ /;s/$/ ]/;'`
++ values=`${BINDIR}/query-pr --valid-values $fieldname | sed ':a;N;$!ba;s/\n/ /g' | sed 's/ *$//g;s/ / | /g;s/^/[ /;s/$/ ]/;'`
+ valslen=`echo "$values" | wc -c`
+ else
+ values="choose from a category listed above"
+@@ -414,7 +414,7 @@
+ else
+ desc="<${values} (one line)>";
+ fi
+- dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
++ dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'`
+ echo "/^>${fieldname}:/ s/${dpat}//" >> $FIXFIL
+ fi
+ echo "${fmtname}${desc}" >> $file
+@@ -425,7 +425,7 @@
+ desc=" $default_val";
+ else
+ desc=" <`${BINDIR}/query-pr --field-description $fieldname` (multiple lines)>";
+- dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
++ dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'`
+ echo "s/^${dpat}//" >> $FIXFIL
+ fi
+ echo "${fmtname}" >> $file;
+@@ -437,7 +437,7 @@
+ desc="${default_val}"
+ else
+ desc="<`${BINDIR}/query-pr --field-description $fieldname` (one line)>"
+- dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
++ dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'`
+ echo "/^>${fieldname}:/ s/${dpat}//" >> $FIXFIL
+ fi
+ echo "${fmtname}${desc}" >> $file
+diff -uNr openswan-2.3.0.orig/programs/_realsetup/_realsetup.in openswan-2.3.0/programs/_realsetup/_realsetup.in
+--- openswan-2.3.0.orig/programs/_realsetup/_realsetup.in 2004-12-10 13:10:04.000000000 +0000
++++ openswan-2.3.0/programs/_realsetup/_realsetup.in 2005-02-02 20:34:54.000000000 +0000
+@@ -209,7 +209,7 @@
+
+ # misc pre-Pluto setup
+
+- perform test -d `dirname $subsyslock` "&&" touch $subsyslock
++ perform test -d `echo $subsyslock | sed -r 's/(^.*\/)(.*$)/\1/'` "&&" touch $subsyslock
+
+ if test " $IPSECforwardcontrol" = " yes"
+ then
+@@ -313,7 +313,7 @@
+ lsmod 2>&1 | grep "^xfrm_user" > /dev/null && rmmod -s xfrm_user
+ fi
+
+- perform test -d `dirname $subsyslock` "&&" rm -f $subsyslock
++ perform test -d `echo $subsyslock | sed -r 's/(^.*\/)(.*$)/\1/'` "&&" touch $subsyslock "&&" rm -f $subsyslock
+
+ perform rm -f $info $lock $plutopid
+ perform echo "...Openswan IPsec stopped" "|" $LOGONLY
+--- openswan-2.3.0.orig/programs/_plutorun/_plutorun.in 2004-11-03 20:21:08.000000000 +0000
++++ openswan-2.3.0/programs/_plutorun/_plutorun.in 2005-02-02 20:34:54.000000000 +0000
+@@ -140,7 +140,7 @@
+ exit 1
+ fi
+ else
+- if test ! -w "`dirname $stderrlog`"
++ if test ! -w "`echo $stderrlog | sed -r 's/(^.*\/)(.*$)/\1/'`"
+ then
+ echo Cannot write to directory to create \"$stderrlog\".
+ exit 1