From 41f8d5465097ee45b051c2c37d44cdccd8e9739b Mon Sep 17 00:00:00 2001 From: Daniel Gimpelevich Date: Fri, 6 Feb 2015 11:54:39 -0800 Subject: [PATCH] openconnect: fix a couple of minor things and add an interface option Signed-off-by: Daniel Gimpelevich --- net/openconnect/Makefile | 2 +- net/openconnect/README | 1 + net/openconnect/files/openconnect.sh | 12 ++++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/net/openconnect/Makefile b/net/openconnect/Makefile index 87ec8a53b..2fed00253 100644 --- a/net/openconnect/Makefile +++ b/net/openconnect/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openconnect PKG_VERSION:=7.04 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/openconnect/ diff --git a/net/openconnect/README b/net/openconnect/README index 3cd562194..f6d2f051c 100644 --- a/net/openconnect/README +++ b/net/openconnect/README @@ -4,6 +4,7 @@ To setup a VPN connection, add the following to /etc/config/network: config interface 'MYVPN' option proto 'openconnect' + option interface 'wan' option server 'vpn.example.com' option port '4443' option username 'test' diff --git a/net/openconnect/files/openconnect.sh b/net/openconnect/files/openconnect.sh index cd97c2cb2..bdac9bc86 100755 --- a/net/openconnect/files/openconnect.sh +++ b/net/openconnect/files/openconnect.sh @@ -10,6 +10,9 @@ proto_openconnect_init_config() { proto_config_add_string "serverhash" proto_config_add_string "authgroup" proto_config_add_string "password" + proto_config_add_string "token_mode" + proto_config_add_string "token_secret" + proto_config_add_string "interface" no_device=1 available=1 } @@ -17,14 +20,14 @@ proto_openconnect_init_config() { proto_openconnect_setup() { local config="$1" - json_get_vars server port username serverhash authgroup password vgroup token_mode token_secret + json_get_vars server port username serverhash authgroup password interface token_mode token_secret grep -q tun /proc/modules || insmod tun logger -t openconnect "initializing..." serv_addr= for ip in $(resolveip -t 10 "$server"); do - ( proto_add_host_dependency "$config" "$ip" ) + ( proto_add_host_dependency "$config" "$ip" $interface ) serv_addr=1 done [ -n "$serv_addr" ] || { @@ -57,7 +60,8 @@ proto_openconnect_setup() { [ -n "$username" ] && append cmdline "-u $username" [ -n "$password" ] && { umask 077 - pwfile="/var/run/openconnect-$config.passwd" + mkdir -p /var/etc + pwfile="/var/etc/openconnect-$config.passwd" echo "$password" > "$pwfile" append cmdline "--passwd-on-stdin" } @@ -78,7 +82,7 @@ proto_openconnect_setup() { proto_openconnect_teardown() { local config="$1" - pwfile="/var/run/openconnect-$config.passwd" + pwfile="/var/etc/openconnect-$config.passwd" rm -f $pwfile logger -t openconnect "bringing down openconnect"