Switch to a separate vpnc-scripts package.

It's used by both vpnc and openconnect now, and openconnect will want an
up-to-date version that has IPv6 support. And won't want to pull in the
whole of the vpnc package just to get it.

This removes the hard-coded masquerading configuration from vpnc-script.
It's possible to do it in a hook now, but it also shouldn't be necessary,
because we should be invoking the hotplug scripts to plumb the interface
properly anyway.

Signed-off-by: David Woodhouse <dw...@infradead.org>
---
 net/vpnc-scripts/Makefile                         |   56 +++++++++++++++++++++
 net/vpnc-scripts/files/etc/vpnc/connect.d/ifstate |    7 +++
 net/vpnc/Makefile                                 |    6 +--
 3 files changed, 65 insertions(+), 4 deletions(-)
 create mode 100644 net/vpnc-scripts/Makefile
 create mode 100644 net/vpnc-scripts/files/etc/vpnc/connect.d/ifstate

diff --git a/net/vpnc-scripts/Makefile b/net/vpnc-scripts/Makefile
new file mode 100644
index 0000000..7481dea
--- /dev/null
+++ b/net/vpnc-scripts/Makefile
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2006 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:=vpnc-scripts
+PKG_VERSION:=20120423
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/vpnc-scripts/
+PKG_MD5SUM:=3265dc7fe57ae9b4c905961a28699c4c
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/vpnc-scripts
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+ip
+  TITLE:=VPN configuration script for vpnc and OpenConnect
+  URL:=http://www.infradead.org/openconnect/vpnc-script.html
+  SUBMENU:=VPN
+endef
+
+define Package/vpnc/vpnc-scripts
+       This package contains the vpnc-script which is used by vpnc
+       and OpenConnect to configure the tunnel interface.
+endef
+
+define Package/vpnc-scripts/conffiles
+/etc/vpnc/connect.d/
+/etc/vpnc/post-connect.d/
+/etc/vpnc/disconnect.d/
+/etc/vpnc/post-connect.d/
+/etc/vpnc/reconnect.d/
+endef
+
+define Build/Compile
+endef
+
+define Package/vpnc-scripts/install
+       $(INSTALL_DIR) $(1)/etc/vpnc
+       $(INSTALL_DIR) $(1)/etc/vpnc/connect.d
+       $(INSTALL_DIR) $(1)/etc/vpnc/post-connect.d
+       $(INSTALL_DIR) $(1)/etc/vpnc/disconnect.d
+       $(INSTALL_DIR) $(1)/etc/vpnc/post-disconnect.d
+       $(INSTALL_DIR) $(1)/etc/vpnc/reconnect.d
+       $(INSTALL_BIN) ./files/etc/vpnc/connect.d/ifstate 
$(1)/etc/vpnc/connect.d/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/vpnc-script $(1)/etc/vpnc/
+endef
+
+$(eval $(call BuildPackage,vpnc-scripts))
diff --git a/net/vpnc-scripts/files/etc/vpnc/connect.d/ifstate 
b/net/vpnc-scripts/files/etc/vpnc/connect.d/ifstate
new file mode 100644
index 0000000..8d2a157
--- /dev/null
+++ b/net/vpnc-scripts/files/etc/vpnc/connect.d/ifstate
@@ -0,0 +1,7 @@
+if [ -n "$OPENWRT_INTERFACE" ]; then
+    uci_set_state network "$OPENWRT_INTERFACE" banner "$CISCO_BANNER"
+    uci_set_state network "$OPENWRT_INTERFACE" ifname "$TUNDEV"
+    [ -n "$INTERNAL_IP4_ADDRESS" ] && uci_set_state network 
"$OPENWRT_INTERFACE" ipaddr "$INTERNAL_IP4_ADDRESS"
+    [ -n "$INTERNAL_IP6_NETMASK" ] && uci_set_state network 
"$OPENWRT_INTERFACE" ip6addr "$INTERNAL_IP6_NETMASK"
+    env -i ACTION="ifup" INTERFACE="$OPENWRT_INTERFACE" DEVICE="$TUNDEV" 
PROTO=openconnect /sbin/hotplug-call "iface"
+fi
diff --git a/net/vpnc/Makefile b/net/vpnc/Makefile
index 0b9d07e..ad1592e 100644
--- a/net/vpnc/Makefile
+++ b/net/vpnc/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=vpnc
 PKG_VERSION:=0.5.3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.unix-ag.uni-kl.de/~massar/vpnc/
@@ -20,7 +20,7 @@ include $(INCLUDE_DIR)/package.mk
 define Package/vpnc
   SECTION:=net
   CATEGORY:=Network
-  DEPENDS:=+libgpg-error +libgcrypt +kmod-tun +ip
+  DEPENDS:=+libgpg-error +libgcrypt +kmod-tun +vpnc-scripts
   TITLE:=VPN client for Cisco EasyVPN
   URL:=http://www.unix-ag.uni-kl.de/~massar/vpnc/
   SUBMENU:=VPN
@@ -36,7 +36,6 @@ endef
 
 define Package/vpnc/conffiles
 /etc/vpnc/default.conf
-/etc/vpnc/vpnc-script
 endef
 
 define Build/Compile
@@ -57,7 +56,6 @@ define Package/vpnc/install
                $(1)/usr/sbin/
        install -d -m0700 $(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
 
 $(eval $(call BuildPackage,vpnc))
-- 
1.7.7.6


-- 
dwmw2

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to