Merge pull request #24109 from nmav/tmp-openconnect-cam-fix

openconnect: introduced URI parameter
This commit is contained in:
Nikos Mavrogiannopoulos 2024-05-13 16:06:30 +02:00 committed by GitHub
commit 4a4090ff89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=openconnect
PKG_VERSION:=9.12
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.infradead.org/openconnect/download

View File

@ -5,8 +5,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 uri 'https://vpn.example.com:4443'
option username 'test'
option password 'secret'
option serverhash 'AE7FF6A0426F0A0CD0A02EB9EC3C5066FAEB0B25'

View File

@ -16,6 +16,7 @@ append_args() {
proto_openconnect_init_config() {
proto_config_add_string "server"
proto_config_add_int "port"
proto_config_add_string "uri"
proto_config_add_int "mtu"
proto_config_add_int "juniper"
proto_config_add_int "reconnect_timeout"
@ -65,6 +66,7 @@ proto_openconnect_setup() {
proxy \
reconnect_timeout \
server \
uri \
serverhash \
token_mode \
token_script \
@ -79,6 +81,8 @@ proto_openconnect_setup() {
[ -n "$interface" ] && {
local trials=5
[ -n $uri ] && server=$(echo $uri | awk -F[/:] '{print $4}')
logger -t "openconnect" "adding host dependency for $server at $config"
while resolveip -t 10 "$server" > "$tmpfile" && [ "$trials" -gt 0 ]; do
sleep 5
@ -95,8 +99,9 @@ proto_openconnect_setup() {
}
[ -n "$port" ] && port=":$port"
[ -z "$uri" ] && uri="$server$port"
append_args "$server$port" -i "$ifname" --non-inter --syslog --script /lib/netifd/vpnc-script
append_args "$uri" -i "$ifname" --non-inter --syslog --script /lib/netifd/vpnc-script
[ "$pfs" = 1 ] && append_args --pfs
[ "$no_dtls" = 1 ] && append_args --no-dtls
[ -n "$mtu" ] && append_args --mtu "$mtu"