openfortivpn: use functions/network.sh to access interface params
authorAaron Goodman <aaronjg@stanford.edu>
Tue, 21 Jul 2020 06:13:56 +0000 (02:13 -0400)
committerAaron Goodman <aaronjg@stanford.edu>
Fri, 31 Jul 2020 00:47:34 +0000 (20:47 -0400)
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
net/openfortivpn/files/openfortivpn.sh

index 893510ce81d4d0979204b4e9ad9183f430b0a066..8f3f4b235b6e3676249e7db3e7a459b0879f8f1e 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh
 . /lib/functions.sh
+. /lib/functions/network.sh
 . ../netifd-proto.sh
 init_proto "$@"
 
@@ -36,17 +37,14 @@ proto_openfortivpn_setup() {
 
 
         [ -n "$iface_name" ] && {
-            json_load "$(ifstatus $iface_name)"
-            json_get_var iface_device_name l3_device
-            json_get_var iface_device_up up
-        }
-
-        [ "$iface_device_up" -eq 1 ] || {
-            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
+           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
+           }
         }
 
         server_ip=$(resolveip -t 10 "$server")