You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
659 B

  1. #!/bin/sh
  2. . /usr/share/libubox/jshn.sh
  3. [ "$ACTION" != ifup ] && exit
  4. networks=$(uci show network | sed "s/network.\([^.]*\).proto='openfortivpn'/\1/;t;d")
  5. for i in $networks; do
  6. iface=$(uci get "network.${i}.iface_name")
  7. iface_success=$?
  8. [ $? -eq 0 ] && [ $INTERFACE == "$iface" ] && {
  9. logger -t "openfortivpnhotplug" "$ACTION on $INTERFACE to bring up $i"
  10. json_load "$(ifstatus $i)"
  11. json_get_var autostart autostart
  12. [ "$autostart" -eq 0 ] && {
  13. logger -t "openfortivpnhotplug" "auto-start was false. bringing $i up"
  14. ubus call network.interface up "{ \"interface\" : \"$i\" }"
  15. }
  16. }
  17. done