From 4e682f03ef2be78fe3846a342c1149275f74a2b4 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 14 Jun 2014 23:41:49 +0200 Subject: [PATCH 1/4] import package uanytun Signed-off-by: Christian Pointner --- net/uanytun/Makefile | 207 +++++++++++++++++++++++ net/uanytun/files/uanytun-nocrypt.config | 88 ++++++++++ net/uanytun/files/uanytun.config | 116 +++++++++++++ net/uanytun/files/uanytun.init | 104 ++++++++++++ 4 files changed, 515 insertions(+) create mode 100644 net/uanytun/Makefile create mode 100644 net/uanytun/files/uanytun-nocrypt.config create mode 100644 net/uanytun/files/uanytun.config create mode 100644 net/uanytun/files/uanytun.init diff --git a/net/uanytun/Makefile b/net/uanytun/Makefile new file mode 100644 index 0000000000..ce1adf0520 --- /dev/null +++ b/net/uanytun/Makefile @@ -0,0 +1,207 @@ +# +# Copyright (C) 2008 Christian Pointner, +# +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# This Makefile builds uAnytun Package for OpenWRT +# +# $Id: $ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=uanytun +PKG_VERSION:=0.3.3 +PKG_RELEASE:=1 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.anytun.org/download/ +PKG_MD5SUM:=ca39dab02e91b0737e2b3f0839e74f6a + +include $(INCLUDE_DIR)/package.mk + + +define Package/uanytun/template + SECTION:=net + CATEGORY:=Network + TITLE:=micro anycast tunneling daemon + URL:=http://www.anytun.org/ + MAINTAINER:=Christian Pointner + SUBMENU:=VPN +endef + +define Package/uanytun/desc-template +uAnytun is a tiny implementation of SATP the secure anycast tunneling protocol. + SATP defines a protocol used for communication between any combination of + unicast and anycast tunnel endpoints. It has less protocol overhead than + IPSec in Tunnel mode and allows tunneling of every ETHER TYPE protocol (e.g. + ethernet, ip, arp ...). SATP directly includes cryptography and message + authentication based on the methodes used by SRTP. It is intended to deliver + a generic, scaleable and secure solution for tunneling and relaying of packets + of any protocol. + Unlike Anytun which is a full featured implementation uAnytun has no support + for multiple connections or synchronisation. It is a small single threaded + implementation intended to act as a client on small platforms. +endef + + +define Package/uanytun + $(call Package/uanytun/template) + DEPENDS:=+kmod-tun +libgcrypt +endef + +define Package/uanytun/conffiles +/etc/config/uanytun +endef + +define Package/uanytun/description + $(call Package/uanytun/desc-template) +endef + + +define Package/uanytun-sslcrypt + $(call Package/uanytun/template) + DEPENDS:=+kmod-tun +libopenssl +endef + +define Package/uanytun-sslcrypt/conffiles +/etc/config/uanytun-sslcrypt +endef + +define Package/uanytun-sslcrypt/description + $(call Package/uanytun/desc-template) +endef + + +define Package/uanytun-nocrypt + $(call Package/uanytun/template) + DEPENDS:=+kmod-tun +endef + +define Package/uanytun-nocrypt/conffiles +/etc/config/uanytun-nocrypt +endef + +define Package/uanytun-nocrypt/description + $(call Package/uanytun/desc-template) +endef + +define Package/uanytun/configure + (cd $(1)/$(2)/src; \ + touch include.mk; \ + ln -s linux/tun.c .; \ + echo '#ifndef UANYTUN_version_h_INCLUDED' > version.h; \ + echo '#define UANYTUN_version_h_INCLUDED' >> version.h; \ + echo '' >> version.h; \ + echo '#define VERSION_STRING_0 "uanytun version '`cat $(1)/version`'"' >> version.h; \ + echo '#define VERSION_STRING_1 "built on '`hostname`', '`date +"%d.%m.%Y %H:%M:%S %Z"`'"' >> version.h; \ + echo '' >> version.h; \ + echo '#endif' >> version.h \ + ) +endef + +ifneq ($(CONFIG_PACKAGE_uanytun-nocrypt),) + define Build/Configure/uanytun-nocrypt + rm -rf $(PKG_BUILD_DIR)/uanytun-nocrypt + mkdir -p $(PKG_BUILD_DIR)/uanytun-nocrypt + $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun-nocrypt + $(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun-nocrypt) + endef + + define Build/Compile/uanytun-nocrypt + $(MAKE) -C $(PKG_BUILD_DIR)/uanytun-nocrypt/src \ + $(TARGET_CONFIGURE_OPTS) \ + NO_CRYPT_OBJ=1 \ + TARGET=Linux \ + CFLAGS="$(TARGET_CFLAGS) -DNO_CRYPT" \ + LDFLAGS="$(TARGET_LDFLAGS) -ldl" + $(STRIP) $(PKG_BUILD_DIR)/uanytun-nocrypt/src/uanytun + endef +endif + +ifneq ($(CONFIG_PACKAGE_uanytun-sslcrypt),) + define Build/Configure/uanytun-sslcrypt + rm -rf $(PKG_BUILD_DIR)/uanytun-sslcrypt + mkdir -p $(PKG_BUILD_DIR)/uanytun-sslcrypt + $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun-sslcrypt + $(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun-sslcrypt) + endef + + define Build/Compile/uanytun-sslcrypt + $(MAKE) -C $(PKG_BUILD_DIR)/uanytun-sslcrypt/src \ + $(TARGET_CONFIGURE_OPTS) \ + TARGET=Linux \ + CFLAGS="$(TARGET_CFLAGS) -DUSE_SSL_CRYPTO -I$(STAGING_DIR)/usr/include" \ + LDFLAGS="$(TARGET_LDFLAGS) -ldl -lcrypto" + $(STRIP) $(PKG_BUILD_DIR)/uanytun-sslcrypt/src/uanytun + endef +endif + +ifneq ($(CONFIG_PACKAGE_uanytun),) + define Build/Configure/uanytun-default + rm -rf $(PKG_BUILD_DIR)/uanytun + mkdir -p $(PKG_BUILD_DIR)/uanytun + $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun + $(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun) + endef + + define Build/Compile/uanytun-default + $(MAKE) -C $(PKG_BUILD_DIR)/uanytun/src \ + $(TARGET_CONFIGURE_OPTS) \ + TARGET=Linux \ + CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \ + LDFLAGS="$(TARGET_LDFLAGS) -ldl -lgcrypt -lgpg-error" + $(STRIP) $(PKG_BUILD_DIR)/uanytun/src/uanytun + endef +endif + + +define Build/Configure + $(call Build/Configure/uanytun-nocrypt) + $(call Build/Configure/uanytun-sslcrypt) + $(call Build/Configure/uanytun-default) +endef + +define Build/Compile + $(call Build/Compile/uanytun-nocrypt) + $(call Build/Compile/uanytun-sslcrypt) + $(call Build/Compile/uanytun-default) +endef + +define Build/Clean + rm -rf $(PKG_BUILD_DIR)/uanytun-nocrypt + rm -rf $(PKG_BUILD_DIR)/uanytun-sslcrypt + rm -rf $(PKG_BUILD_DIR)/uanytun +endef + + + +define Package/uanytun/install-generic + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/$(3) $(1)/etc/config/$(2) + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(2)/src/uanytun $(1)/usr/sbin/$(2) + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/uanytun.init $(1)/etc/init.d/$(2) + @sed -e 's/BIN=uanytun/BIN=$(2)/' -i $(1)/etc/init.d/$(2) +endef + +define Package/uanytun/install + $(call Package/uanytun/install-generic,$(1),uanytun,uanytun.config) +endef + +define Package/uanytun-sslcrypt/install + $(call Package/uanytun/install-generic,$(1),uanytun-sslcrypt,uanytun.config) +endef + +define Package/uanytun-nocrypt/install + $(call Package/uanytun/install-generic,$(1),uanytun-nocrypt,uanytun-nocrypt.config) +endef + + + +$(eval $(call BuildPackage,uanytun)) +$(eval $(call BuildPackage,uanytun-sslcrypt)) +$(eval $(call BuildPackage,uanytun-nocrypt)) diff --git a/net/uanytun/files/uanytun-nocrypt.config b/net/uanytun/files/uanytun-nocrypt.config new file mode 100644 index 0000000000..9792d1f009 --- /dev/null +++ b/net/uanytun/files/uanytun-nocrypt.config @@ -0,0 +1,88 @@ +config "client1" + option disabled 0 + option username 'nobody' + option groupname 'nogroup' +# option chroot "/var/run/uanytun" + +# option interface '' +# option port '4444' +# option sender_id '1' + +# option dev 'anytun0' + option type 'tun' + option ifconfig '192.168.123.1/24' +# option post-up-script '/etc/uanytun/client1-post-up.sh' + + option remote_host 'example.com' + option remote_port '4444' + + option window_size 0 + option mux 1 + + option log 'syslog:3,anytun-client1,daemon' + + +config "client2" + option disabled 1 + option username 'nobody' + option groupname 'nogroup' + + option type 'tun' + option ifconfig '192.168.123.2/24' + + option remote_host 'example.com' + option remote_port '4444' + + option window_size 0 + option mux 2 + + option log 'syslog:3,anytun-client2,daemon' + + +config "client3" + option disabled 1 + option username 'nobody' + option groupname 'nogroup' + + option type 'tun' + option ifconfig '192.168.123.3/24' + + option remote_host 'example.com' + option remote_port '4444' + + option window_size 0 + option mux 3 + + option log 'syslog:3,anytun-client3,daemon' + + +config "p2p-a" + option disabled 1 + option username 'nobody' + option groupname 'nogroup' + + option type 'tun' + option ifconfig '192.168.223.1/24' + + option remote_host 'p2p-b.example.com' + option remote_port '4444' + + option window_size 0 + + option log 'syslog:3,anytun-p2p-a,daemon' + + +config "p2p-b" + option disabled 1 + option username 'nobody' + option groupname 'nogroup' + + option type 'tun' + option ifconfig '192.168.223.2/24' + + option remote_host 'p2p-a.example.com' + option remote_port '4444' + + option window_size 0 + + option log 'syslog:3,anytun-p2p-b,daemon' diff --git a/net/uanytun/files/uanytun.config b/net/uanytun/files/uanytun.config new file mode 100644 index 0000000000..c53db37385 --- /dev/null +++ b/net/uanytun/files/uanytun.config @@ -0,0 +1,116 @@ +config "client1" + option disabled 0 +# option username 'nobody' +# option groupname 'nogroup' +# option chroot "/var/run/uanytun" + +# option interface '' +# option port '4444' +# option sender_id '1' + + option cipher 'aes-ctr' +# option cipher 'null' +# option cipher 'aes-ctr-128' +# option cipher 'aes-ctr-192' +# option cipher 'aes-ctr-256' + option auth_algo 'sha1' +# option auth_algo 'null' +# option auth_tag_length 10 + +# option dev 'anytun0' + option type 'tun' + option ifconfig '192.168.123.1/24' +# option post-up-script '/etc/uanytun/client1-post-up.sh' + + option remote_host 'example.com' + option remote_port '4444' + + option window_size 0 + option mux 1 + + option role 'client' +# option kd_prf 'null' +# option kd_prf 'aes-ctr' +# option kd_prf 'aes-ctr-128' +# option kd_prf 'aes-ctr-192' +# option kd_prf 'aes-ctr-256' +# option ld_kdr '0' +# option key '0123456789ABCDEF0123456789ABCDEF' +# option salt '0123456789ABCD0123456789ABCD' + option passphrase 'Creating_VPN_Tunnels_With_Anytun_Is_Easy' + + option log 'syslog:3,anytun-client1,daemon' + + +config "client2" + option disabled 1 + + option cipher 'aes-ctr' + option auth_algo 'sha1' + option type 'tun' + option ifconfig '192.168.123.2/24' + + option remote_host 'example.com' + option remote_port '4444' + + option window_size 0 + option mux 2 + option role 'client' + option passphrase 'Creating_VPN_Tunnels_With_Anytun_Is_Easy' + + option log 'syslog:3,anytun-client2,daemon' + + +config "client3" + option disabled 1 + + option cipher 'aes-ctr' + option auth_algo 'sha1' + option type 'tun' + option ifconfig '192.168.123.3/24' + + option remote_host 'example.com' + option remote_port '4444' + + option window_size 0 + option mux 3 + option role 'client' + option passphrase 'Creating_VPN_Tunnels_With_Anytun_Is_Easy' + + option log 'syslog:3,anytun-client3,daemon' + + +config "p2p-a" + option disabled 1 + + option cipher 'aes-ctr' + option auth_algo 'sha1' + option type 'tun' + option ifconfig '192.168.223.1/24' + + option remote_host 'p2p-b.example.com' + option remote_port '4444' + + option window_size 0 + option role 'alice' + option passphrase 'Creating_P2P_VPN_Tunnels_With_Anytun_Is_Easy' + + option log 'syslog:3,anytun-p2p-a,daemon' + + +config "p2p-b" + option disabled 1 + + option cipher 'aes-ctr' + option auth_algo 'sha1' + option type 'tun' + option ifconfig '192.168.223.2/24' + + option remote_host 'p2p-a.example.com' + option remote_port '4444' + + option window_size 0 + option role 'bob' + option passphrase 'Creating_P2P_VPN_Tunnels_With_Anytun_Is_Easy' + + option log 'syslog:3,anytun-p2p-b,daemon' diff --git a/net/uanytun/files/uanytun.init b/net/uanytun/files/uanytun.init new file mode 100644 index 0000000000..59e1c23cd4 --- /dev/null +++ b/net/uanytun/files/uanytun.init @@ -0,0 +1,104 @@ +#!/bin/sh /etc/rc.common +START=50 + +BIN=uanytun +DAEMON=/usr/sbin/$BIN +DESC=$BIN +RUN_D=/var/run + + +option_cb() { + local varname="$1" + local value="$2" + + if ! echo "$CONFIG_OPTIONS" | grep " $varname " > /dev/null; then + CONFIG_OPTIONS="$CONFIG_OPTIONS $varname " + fi +} + +foreach_config_forced() { + foreach_config $1 "forced" +} + +foreach_config() { + local cfg="$1" + local name + local option + local value + local args="" + local forced=0 + + if [ -n "$2" ] && [ "x$2" == "xforced" ]; then + forced=1 + fi + + config_get name "$cfg" TYPE + for option in $CONFIG_OPTIONS + do + config_get value "$cfg" "$option" + if [ "x$option" == "xdisabled" ]; then + if [ $forced -eq 0 ] && [ $value -eq 1 ]; then + echo -n " $name(disabled)" + return + fi + continue + fi + + option=`echo $option | tr '_' '-'` + if [ -n "$value" ]; then + args="$args --$option $value" + fi + done + echo -n " $name" + local status="OK" + $DAEMON --write-pid "$RUN_D/$BIN.$name.pid" $args || status="failed" + echo -n "($status)" +} + +stop_vpn() { + local name=$1 + local pidfile=$RUN_D/$BIN.$name.pid + echo -n " $name" + local status="OK" + if [ ! -f "$pidfile" ]; then + status="tunnel not active" + else + kill `cat $pidfile` > /dev/null 2>&1 || status="failed" + rm -f $pidfile + fi + echo -n "($status)" +} + +start() { + echo -n "Starting $DESC:" + config_load $BIN + if [ $# -gt 0 ]; then + while [ $# -gt 0 ]; do + config_foreach foreach_config_forced "$1" + shift + done + else + config_foreach foreach_config "" + fi + echo "." +} + +stop() { + echo -n "Stopping $DESC:" + local name + local pidfile + + if [ $# -gt 0 ]; then + while [ $# -gt 0 ]; do + stop_vpn $1 + shift + done + else + for pidfile in `ls $RUN_D/$BIN.*.pid 2> /dev/null`; do + name=${pidfile%%.pid} + name=${name##$RUN_D/$BIN.} + stop_vpn $name + done + fi + echo "." +} From 4d0bfa537143504c8ca13887fc5b657adfecf272 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 14 Jun 2014 23:43:32 +0200 Subject: [PATCH 2/4] upgrade uanytun to newest release 0.3.4 the new package now makes use of build variants Signed-off-by: Christian Pointner --- net/uanytun/Makefile | 172 +++++++++++---------------------- net/uanytun/files/uanytun.init | 4 +- 2 files changed, 61 insertions(+), 115 deletions(-) diff --git a/net/uanytun/Makefile b/net/uanytun/Makefile index ce1adf0520..4c5730760a 100644 --- a/net/uanytun/Makefile +++ b/net/uanytun/Makefile @@ -1,6 +1,6 @@ # -# Copyright (C) 2008 Christian Pointner, -# +# Copyright (C) 2008-2014 Christian Pointner, +# # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -12,13 +12,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uanytun -PKG_VERSION:=0.3.3 +PKG_VERSION:=0.3.4 PKG_RELEASE:=1 -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.anytun.org/download/ -PKG_MD5SUM:=ca39dab02e91b0737e2b3f0839e74f6a +PKG_MD5SUM:=b4085ab7f0127732818b8b801f280aef + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) include $(INCLUDE_DIR)/package.mk @@ -26,13 +27,26 @@ include $(INCLUDE_DIR)/package.mk define Package/uanytun/template SECTION:=net CATEGORY:=Network + SUBMENU:=VPN + DEPENDS:=+kmod-tun TITLE:=micro anycast tunneling daemon URL:=http://www.anytun.org/ - MAINTAINER:=Christian Pointner - SUBMENU:=VPN + MAINTAINER:=Christian Pointner endef -define Package/uanytun/desc-template + +define Package/uanytun + $(call Package/uanytun/template) + TITLE+= (gcrypt) + VARIANT:=gcrypt + DEPENDS+=+libgcrypt +endef + +define Package/uanytun/conffiles +/etc/config/uanytun +endef + +define Package/uanytun/description uAnytun is a tiny implementation of SATP the secure anycast tunneling protocol. SATP defines a protocol used for communication between any combination of unicast and anycast tunnel endpoints. It has less protocol overhead than @@ -47,161 +61,93 @@ uAnytun is a tiny implementation of SATP the secure anycast tunneling protocol. endef -define Package/uanytun - $(call Package/uanytun/template) - DEPENDS:=+kmod-tun +libgcrypt -endef - -define Package/uanytun/conffiles -/etc/config/uanytun -endef - -define Package/uanytun/description - $(call Package/uanytun/desc-template) -endef - - define Package/uanytun-sslcrypt $(call Package/uanytun/template) - DEPENDS:=+kmod-tun +libopenssl + TITLE+= (openssl) + VARIANT:=sslcrypt + DEPENDS+=+libopenssl endef -define Package/uanytun-sslcrypt/conffiles -/etc/config/uanytun-sslcrypt -endef - -define Package/uanytun-sslcrypt/description - $(call Package/uanytun/desc-template) -endef +Package/uanytun-sslcrypt/conffiles=$(Package/uanytun/conffiles) +Package/uanytun-sslcrypt/description=$(Package/uanytun/description) define Package/uanytun-nocrypt $(call Package/uanytun/template) - DEPENDS:=+kmod-tun + TITLE+= (no crypt) + VARIANT:=nocrypt endef -define Package/uanytun-nocrypt/conffiles -/etc/config/uanytun-nocrypt -endef +Package/uanytun-nocrypt/conffiles=$(Package/uanytun/conffiles) +Package/uanytun-nocrypt/description=$(Package/uanytun/description) -define Package/uanytun-nocrypt/description - $(call Package/uanytun/desc-template) -endef -define Package/uanytun/configure - (cd $(1)/$(2)/src; \ + +define Build/Configure + (cd $(PKG_BUILD_DIR)/src; \ touch include.mk; \ ln -s linux/tun.c .; \ echo '#ifndef UANYTUN_version_h_INCLUDED' > version.h; \ echo '#define UANYTUN_version_h_INCLUDED' >> version.h; \ echo '' >> version.h; \ - echo '#define VERSION_STRING_0 "uanytun version '`cat $(1)/version`'"' >> version.h; \ + echo '#define VERSION_STRING_0 "uanytun version '`cat $(PKG_BUILD_DIR)/version`'"' >> version.h; \ echo '#define VERSION_STRING_1 "built on '`hostname`', '`date +"%d.%m.%Y %H:%M:%S %Z"`'"' >> version.h; \ echo '' >> version.h; \ echo '#endif' >> version.h \ ) endef -ifneq ($(CONFIG_PACKAGE_uanytun-nocrypt),) - define Build/Configure/uanytun-nocrypt - rm -rf $(PKG_BUILD_DIR)/uanytun-nocrypt - mkdir -p $(PKG_BUILD_DIR)/uanytun-nocrypt - $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun-nocrypt - $(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun-nocrypt) - endef +VARIANT_CFLAGS:= +VARIANT_LDFLAGS:=-ldl +VARIANT_MAKE_OPTS:= - define Build/Compile/uanytun-nocrypt - $(MAKE) -C $(PKG_BUILD_DIR)/uanytun-nocrypt/src \ - $(TARGET_CONFIGURE_OPTS) \ - NO_CRYPT_OBJ=1 \ - TARGET=Linux \ - CFLAGS="$(TARGET_CFLAGS) -DNO_CRYPT" \ - LDFLAGS="$(TARGET_LDFLAGS) -ldl" - $(STRIP) $(PKG_BUILD_DIR)/uanytun-nocrypt/src/uanytun - endef +ifeq ($(BUILD_VARIANT),gcrypt) +VARIANT_LDFLAGS+=-lgpg-error -lgcrypt endif -ifneq ($(CONFIG_PACKAGE_uanytun-sslcrypt),) - define Build/Configure/uanytun-sslcrypt - rm -rf $(PKG_BUILD_DIR)/uanytun-sslcrypt - mkdir -p $(PKG_BUILD_DIR)/uanytun-sslcrypt - $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun-sslcrypt - $(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun-sslcrypt) - endef - - define Build/Compile/uanytun-sslcrypt - $(MAKE) -C $(PKG_BUILD_DIR)/uanytun-sslcrypt/src \ - $(TARGET_CONFIGURE_OPTS) \ - TARGET=Linux \ - CFLAGS="$(TARGET_CFLAGS) -DUSE_SSL_CRYPTO -I$(STAGING_DIR)/usr/include" \ - LDFLAGS="$(TARGET_LDFLAGS) -ldl -lcrypto" - $(STRIP) $(PKG_BUILD_DIR)/uanytun-sslcrypt/src/uanytun - endef +ifeq ($(BUILD_VARIANT),sslcrypt) +VARIANT_CFLAGS+=-DUSE_SSL_CRYPTO +VARIANT_LDFLAGS+=-lcrypto endif -ifneq ($(CONFIG_PACKAGE_uanytun),) - define Build/Configure/uanytun-default - rm -rf $(PKG_BUILD_DIR)/uanytun - mkdir -p $(PKG_BUILD_DIR)/uanytun - $(CP) -r $(PKG_BUILD_DIR)/src $(PKG_BUILD_DIR)/uanytun - $(call Package/uanytun/configure,$(PKG_BUILD_DIR),uanytun) - endef - - define Build/Compile/uanytun-default - $(MAKE) -C $(PKG_BUILD_DIR)/uanytun/src \ - $(TARGET_CONFIGURE_OPTS) \ - TARGET=Linux \ - CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \ - LDFLAGS="$(TARGET_LDFLAGS) -ldl -lgcrypt -lgpg-error" - $(STRIP) $(PKG_BUILD_DIR)/uanytun/src/uanytun - endef +ifeq ($(BUILD_VARIANT),nocrypt) +VARIANT_CFLAGS+=-DNO_CRYPT +VARIANT_MAKE_OPTS+=NO_CRYPT_OBJ=1 endif - -define Build/Configure - $(call Build/Configure/uanytun-nocrypt) - $(call Build/Configure/uanytun-sslcrypt) - $(call Build/Configure/uanytun-default) -endef - define Build/Compile - $(call Build/Compile/uanytun-nocrypt) - $(call Build/Compile/uanytun-sslcrypt) - $(call Build/Compile/uanytun-default) + $(MAKE) -C $(PKG_BUILD_DIR)/src \ + $(TARGET_CONFIGURE_OPTS) \ + $(VARIANT_MAKE_OPTS) \ + TARGET=Linux \ + CFLAGS="$(TARGET_CFLAGS) $(VARIANT_CFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS) $(VARIANT_LDFLAGS)" + $(STRIP) $(PKG_BUILD_DIR)/src/uanytun endef -define Build/Clean - rm -rf $(PKG_BUILD_DIR)/uanytun-nocrypt - rm -rf $(PKG_BUILD_DIR)/uanytun-sslcrypt - rm -rf $(PKG_BUILD_DIR)/uanytun -endef - - define Package/uanytun/install-generic $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DATA) ./files/$(3) $(1)/etc/config/$(2) + $(INSTALL_DATA) ./files/$(2) $(1)/etc/config/$(PKG_NAME) $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(2)/src/uanytun $(1)/usr/sbin/$(2) + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/uanytun $(1)/usr/sbin/$(PKG_NAME) $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/uanytun.init $(1)/etc/init.d/$(2) - @sed -e 's/BIN=uanytun/BIN=$(2)/' -i $(1)/etc/init.d/$(2) + $(INSTALL_BIN) ./files/uanytun.init $(1)/etc/init.d/$(PKG_NAME) endef define Package/uanytun/install - $(call Package/uanytun/install-generic,$(1),uanytun,uanytun.config) + $(call Package/uanytun/install-generic,$(1),uanytun.config) endef define Package/uanytun-sslcrypt/install - $(call Package/uanytun/install-generic,$(1),uanytun-sslcrypt,uanytun.config) + $(call Package/uanytun/install-generic,$(1),uanytun.config) endef define Package/uanytun-nocrypt/install - $(call Package/uanytun/install-generic,$(1),uanytun-nocrypt,uanytun-nocrypt.config) + $(call Package/uanytun/install-generic,$(1),uanytun-nocrypt.config) endef - $(eval $(call BuildPackage,uanytun)) $(eval $(call BuildPackage,uanytun-sslcrypt)) $(eval $(call BuildPackage,uanytun-nocrypt)) diff --git a/net/uanytun/files/uanytun.init b/net/uanytun/files/uanytun.init index 59e1c23cd4..21609cad02 100644 --- a/net/uanytun/files/uanytun.init +++ b/net/uanytun/files/uanytun.init @@ -61,7 +61,7 @@ stop_vpn() { echo -n " $name" local status="OK" if [ ! -f "$pidfile" ]; then - status="tunnel not active" + status="tunnel not active" else kill `cat $pidfile` > /dev/null 2>&1 || status="failed" rm -f $pidfile @@ -71,7 +71,7 @@ stop_vpn() { start() { echo -n "Starting $DESC:" - config_load $BIN + config_load $BIN if [ $# -gt 0 ]; then while [ $# -gt 0 ]; do config_foreach foreach_config_forced "$1" From fc9d972e1d9903ab4d076e5f6c22576d8ebdc861 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 21 Jun 2014 14:07:00 +0200 Subject: [PATCH 3/4] fixed typo in description Signed-off-by: Christian Pointner --- net/uanytun/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/uanytun/Makefile b/net/uanytun/Makefile index 4c5730760a..8e9a651558 100644 --- a/net/uanytun/Makefile +++ b/net/uanytun/Makefile @@ -52,7 +52,7 @@ uAnytun is a tiny implementation of SATP the secure anycast tunneling protocol. unicast and anycast tunnel endpoints. It has less protocol overhead than IPSec in Tunnel mode and allows tunneling of every ETHER TYPE protocol (e.g. ethernet, ip, arp ...). SATP directly includes cryptography and message - authentication based on the methodes used by SRTP. It is intended to deliver + authentication based on the methods used by SRTP. It is intended to deliver a generic, scaleable and secure solution for tunneling and relaying of packets of any protocol. Unlike Anytun which is a full featured implementation uAnytun has no support From 1f60e90a9dfe6b5167992737263bd5e4323f6fc2 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 22 Jun 2014 02:57:51 +0200 Subject: [PATCH 4/4] dropped gcrypt variant for now now using libnettle for the default crypto library Signed-off-by: Christian Pointner --- net/uanytun/Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/net/uanytun/Makefile b/net/uanytun/Makefile index 8e9a651558..7643a1f693 100644 --- a/net/uanytun/Makefile +++ b/net/uanytun/Makefile @@ -12,12 +12,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uanytun -PKG_VERSION:=0.3.4 +PKG_VERSION:=0.3.5 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.anytun.org/download/ -PKG_MD5SUM:=b4085ab7f0127732818b8b801f280aef +PKG_MD5SUM:=ce47ad45003ff1d84eaf5276941b9ddf PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) @@ -37,9 +37,9 @@ endef define Package/uanytun $(call Package/uanytun/template) - TITLE+= (gcrypt) - VARIANT:=gcrypt - DEPENDS+=+libgcrypt + TITLE+= (nettle) + VARIANT:=nettle + DEPENDS+=+libnettle endef define Package/uanytun/conffiles @@ -101,8 +101,9 @@ VARIANT_CFLAGS:= VARIANT_LDFLAGS:=-ldl VARIANT_MAKE_OPTS:= -ifeq ($(BUILD_VARIANT),gcrypt) -VARIANT_LDFLAGS+=-lgpg-error -lgcrypt +ifeq ($(BUILD_VARIANT),nettle) +VARIANT_CFLAGS+=-DUSE_NETTLE +VARIANT_LDFLAGS+=-lnettle endif ifeq ($(BUILD_VARIANT),sslcrypt)