Browse Source

Merge pull request #13220 from aaronjg/openfortivpn/config-varname-fix

openfortivpn: use more standard config option names
lilik-openwrt-22.03
Rosen Penev 4 years ago
committed by GitHub
parent
commit
744169fa13
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 28 deletions
  1. +1
    -1
      net/openfortivpn/Makefile
  2. +27
    -27
      net/openfortivpn/files/openfortivpn.sh

+ 1
- 1
net/openfortivpn/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=openfortivpn PKG_NAME:=openfortivpn
PKG_VERSION:=1.14.1 PKG_VERSION:=1.14.1
PKG_RELEASE:=7
PKG_RELEASE:=8
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/adrienverge/openfortivpn/tar.gz/v$(PKG_VERSION)? PKG_SOURCE_URL:=https://codeload.github.com/adrienverge/openfortivpn/tar.gz/v$(PKG_VERSION)?


+ 27
- 27
net/openfortivpn/files/openfortivpn.sh View File

@ -12,9 +12,9 @@ append_args() {
} }
proto_openfortivpn_init_config() { proto_openfortivpn_init_config() {
proto_config_add_string "server"
proto_config_add_string "peeraddr"
proto_config_add_int "port" proto_config_add_int "port"
proto_config_add_string "iface_name"
proto_config_add_string "tunlink"
proto_config_add_string "local_ip" proto_config_add_string "local_ip"
proto_config_add_string "username" proto_config_add_string "username"
proto_config_add_string "password" proto_config_add_string "password"
@ -29,29 +29,29 @@ proto_openfortivpn_setup() {
local msg ifname ip server_ip pwfile callfile local msg ifname ip server_ip pwfile callfile
local host server port iface_name local_ip username password trusted_cert \
local host peeraddr port tunlink local_ip username password trusted_cert \
remote_status_check remote_status_check
json_get_vars host server port iface_name local_ip username password trusted_cert \
json_get_vars host peeraddr port tunlink local_ip username password trusted_cert \
remote_status_check remote_status_check
ifname="vpn-$config" ifname="vpn-$config"
[ -n "$iface_name" ] && {
network_get_device iface_device_name "$iface_name"
network_is_up "$iface_name" || {
msg="$iface_name is not up $iface_device_up"
logger -t "openfortivpn" "$config: $msg"
proto_notify_error "$config" "$msg"
proto_block_restart "$config"
exit 1
}
[ -n "$tunlink" ] && {
network_get_device iface_device_name "$tunlink"
network_is_up "$tunlink" || {
msg="$tunlink is not up $iface_device_up"
logger -t "openfortivpn" "$config: $msg"
proto_notify_error "$config" "$msg"
proto_block_restart "$config"
exit 1
}
} }
server_ip=$(resolveip -4 -t 10 "$server")
server_ip=$(resolveip -4 -t 10 "$peeraddr")
[ $? -eq 0 ] || { [ $? -eq 0 ] || {
msg="$config: failed to resolve server ip for $server"
msg="$config: failed to resolve server ip for $peeraddr"
logger -t "openfortivpn" "$msg" logger -t "openfortivpn" "$msg"
sleep 10 sleep 10
proto_notify_error "$config" "$msg" proto_notify_error "$config" "$msg"
@ -60,8 +60,8 @@ proto_openfortivpn_setup() {
} }
[ "$remote_status_check" = "curl" ] && { [ "$remote_status_check" = "curl" ] && {
curl -k --head -s --connect-timeout 10 ${iface_name:+--interface} $iface_device_name https://$server_ip > /dev/null || {
msg="failed to reach https://${server_ip}${iface_name:+ on $iface_device_name}"
curl -k --head -s --connect-timeout 10 ${tunlink:+--interface} $iface_device_name https://$server_ip > /dev/null || {
msg="failed to reach https://${server_ip}${tunlink:+ on $iface_device_name}"
logger -t "openfortivpn" "$config: $msg" logger -t "openfortivpn" "$config: $msg"
sleep 10 sleep 10
proto_notify_error "$config" "$msg" proto_notify_error "$config" "$msg"
@ -70,7 +70,7 @@ proto_openfortivpn_setup() {
} }
} }
[ "$remote_status_check" = "ping" ] && { [ "$remote_status_check" = "ping" ] && {
ping ${iface_name:+-I} $iface_device_name -c 1 -w 10 $server_ip > /dev/null 2>&1 || {
ping ${tunlink:+-I} $iface_device_name -c 1 -w 10 $server_ip > /dev/null 2>&1 || {
msg="$config: failed to ping $server_ip on $iface_device_name" msg="$config: failed to ping $server_ip on $iface_device_name"
logger -t "openfortvpn" "$config: $msg" logger -t "openfortvpn" "$config: $msg"
sleep 10 sleep 10
@ -80,30 +80,30 @@ proto_openfortivpn_setup() {
} }
} }
for ip in $(resolveip -4 -t 10 "$server"); do
logger -p 6 -t "openfortivpn" "$config: adding host dependency for $ip on $iface_name at $config"
proto_add_host_dependency "$config" "$ip" "$iface_name"
for ip in $(resolveip -4 -t 10 "$peeraddr"); do
logger -p 6 -t "openfortivpn" "$config: adding host dependency for $ip on $tunlink at $config"
proto_add_host_dependency "$config" "$ip" "$tunlink"
done done
[ -n "$port" ] && port=":$port" [ -n "$port" ] && port=":$port"
append_args "$server$port" --pppd-ifname="$ifname" --use-syslog -c /dev/null
append_args "$peeraddr$port" --pppd-ifname="$ifname" --use-syslog -c /dev/null
append_args "--set-dns=0" append_args "--set-dns=0"
append_args "--no-routes" append_args "--no-routes"
append_args "--pppd-use-peerdns=1" append_args "--pppd-use-peerdns=1"
[ -n "$iface_name" ] && {
[ -n "$tunlink" ] && {
append_args "--ifname=$iface_device_name" append_args "--ifname=$iface_device_name"
} }
[ -n "$trusted_cert" ] && append_args "--trusted-cert=$trusted_cert" [ -n "$trusted_cert" ] && append_args "--trusted-cert=$trusted_cert"
[ -n "$username" ] && append_args -u "$username" [ -n "$username" ] && append_args -u "$username"
[ -n "$password" ] && { [ -n "$password" ] && {
umask 077
mkdir -p '/var/etc/openfortivpn'
pwfile="/var/etc/openfortivpn/$config.passwd"
echo "$password" > "$pwfile"
umask 077
mkdir -p '/var/etc/openfortivpn'
pwfile="/var/etc/openfortivpn/$config.passwd"
echo "$password" > "$pwfile"
} }
[ -n "$local_ip" ] || local_ip=$server_ip [ -n "$local_ip" ] || local_ip=$server_ip


Loading…
Cancel
Save