Update vpnc to 0.4.0, thanks to Swen Kuhnlein

git-svn-id: svn://svn.openwrt.org/openwrt/packages@6393 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2007-02-26 22:01:03 +00:00
parent 6229f2c2aa
commit c0ff7f2a10
3 changed files with 61 additions and 36 deletions

View File

@ -9,12 +9,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=vpnc
PKG_VERSION:=0.3.3
PKG_VERSION:=0.4.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.unix-ag.uni-kl.de/~massar/vpnc/
PKG_MD5SUM:=e7518cff21326fe7eb9795b60c25ae6a
PKG_MD5SUM:=604807e7dd90fce00a4e2344ee29c76d
PKG_CAT:=zcat
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
@ -31,7 +31,7 @@ define Package/vpnc
endef
define Package/vpnc/conffiles
/etc/vpnc/vpnc.conf
/etc/vpnc/default.conf
/etc/vpnc/vpnc-script
endef
@ -52,7 +52,7 @@ define Package/vpnc/install
$(PKG_INSTALL_DIR)/usr/sbin/vpnc-disconnect \
$(1)/usr/sbin/
install -d -m0700 $(1)/etc/vpnc
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/vpnc/vpnc.conf $(1)/etc/vpnc/
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/vpnc/default.conf $(1)/etc/vpnc/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/vpnc/vpnc-script $(1)/etc/vpnc/
endef

View File

@ -1,44 +1,28 @@
diff -Nur vpnc-0.3.3/Makefile vpnc-0.3.3.patched/Makefile
--- vpnc-0.3.3/Makefile 2005-05-01 22:30:35.000000000 +0200
+++ vpnc-0.3.3.patched/Makefile 2005-12-23 23:43:55.222055250 +0100
@@ -17,31 +17,32 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
diff -Nur vpnc-0.4.0/Makefile vpnc-0.4.0.patched/Makefile
--- vpnc-0.4.0/Makefile 2007-02-19 21:51:12.000000000 +0100
+++ vpnc-0.4.0.patched/Makefile 2007-02-25 10:40:25.000000000 +0100
@@ -20,7 +20,7 @@
# $Id: Makefile 148 2007-02-19 20:51:14Z Maurice Massar $
DESTDIR=
-PREFIX=/usr/local
+PREFIX=/usr
ETCDIR=/etc/vpnc
BINDIR=$(PREFIX)/bin
SBINDIR=$(PREFIX)/sbin
MANDIR=$(PREFIX)/share/man
@@ -35,12 +35,11 @@
RELEASE_VERSION := $(shell cat VERSION)
CC=gcc
-CFLAGS=-W -Wall -O -g '-DVERSION="$(shell cat VERSION)"' $(shell libgcrypt-config --cflags)
-LDFLAGS=-g $(shell libgcrypt-config --libs)
+CFLAGS=-W -Wall -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include $(OFLAGS) '-DVERSION="$(shell cat VERSION)"'
+LDFLAGS=-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -lgcrypt -lgpg-error
-CFLAGS += -W -Wall -O3 -Wmissing-declarations -Wwrite-strings -g
+CFLAGS += -W -Wall -Wmissing-declarations -Wwrite-strings -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include $(OFLAGS) '-DVERSION="$(shell cat VERSION)"'
CPPFLAGS = -DVERSION=\"$(VERSION)\"
-LDFLAGS = -g $(shell libgcrypt-config --libs)
-CFLAGS += $(shell libgcrypt-config --cflags)
+LDFLAGS = -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -lgcrypt -lgpg-error
-ifeq ($(shell uname -s), Linux)
+OS=$(shell uname -s)
+ifeq ($(OS), Linux)
SYSDEP=sysdep-linux.o
endif
-ifeq ($(shell uname -s), FreeBSD)
+ifeq ($(OS), FreeBSD)
CFLAGS += -DSOCKADDR_IN_SIN_LEN -DHAVE_SA_LEN
SYSDEP=sysdep-bsd.o
endif
-ifeq ($(shell uname -s), NetBSD)
+ifeq ($(OS), NetBSD)
CFLAGS += -DSOCKADDR_IN_SIN_LEN -DHAVE_SA_LEN
SYSDEP=sysdep-bsd.o
endif
-ifeq ($(shell uname -s), OpenBSD)
+ifeq ($(OS), OpenBSD)
CFLAGS += -DSOCKADDR_IN_SIN_LEN -DHAVE_SA_LEN -DNEED_IPLEN_FIX -DNEW_TUN
SYSDEP=sysdep-bsd.o
endif
-ifeq ($(shell uname -s), SunOS)
+ifeq ($(OS), SunOS)
CFLAGS += -DNEED_IPLEN_FIX
LDFLAGS += -lnsl -lresolv -lsocket
SYSDEP=sysdep-svr4.o
endif

View File

@ -0,0 +1,41 @@
--- vpnc-0.4.0/vpnc-script 2007-02-18 12:52:03.000000000 +0100
+++ vpnc-0.4.0.patched/vpnc-script 2007-02-25 11:34:06.000000000 +0100
@@ -107,7 +107,7 @@
}
do_ifconfig() {
- ifconfig "$TUNDEV" inet "$INTERNAL_IP4_ADDRESS" $ifconfig_syntax_ptp "$INTERNAL_IP4_ADDRESS" netmask 255.255.255.255 mtu 1412 up
+ ifconfig "$TUNDEV" "$INTERNAL_IP4_ADDRESS" $ifconfig_syntax_ptp "$INTERNAL_IP4_ADDRESS" netmask 255.255.255.255 mtu 1412 up
}
destroy_tun_device() {
@@ -388,6 +388,18 @@
fi
}
+start_vpn_nat() {
+ iptables -A forwarding_rule -o $TUNDEV -j ACCEPT
+ iptables -A forwarding_rule -i $TUNDEV -j ACCEPT
+ iptables -t nat -A postrouting_rule -o $TUNDEV -j MASQUERADE
+}
+
+stop_vpn_nat() {
+ iptables -t nat -D postrouting_rule -o $TUNDEV -j MASQUERADE
+ iptables -D forwarding_rule -i $TUNDEV -j ACCEPT
+ iptables -D forwarding_rule -o $TUNDEV -j ACCEPT
+}
+
####
if [ -z "$reason" ]; then
@@ -401,8 +413,10 @@
;;
connect)
do_connect
+ start_vpn_nat
;;
disconnect)
+ stop_vpn_nat
do_disconnect
;;
*)