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.

27 lines
830 B

  1. #!/bin/sh
  2. . /lib/functions.sh
  3. . /usr/share/libubox/jshn.sh
  4. [ "$ACTION" != ifup ] && exit
  5. handle_network()
  6. {
  7. config_get iface $1 iface_name
  8. [ $INTERFACE != "$iface" ] && return
  9. [ $(config_get $1 proto) != "openfortivpn" ] && return
  10. config_get_bool load_on_boot $1 auto
  11. [ -n "$load_on_boot" ] && [ "$load_on_boot" -eq 0 ] && return
  12. status="$(ifstatus $1)" || continue
  13. json_load "$status"
  14. json_get_var autostart autostart
  15. logger -t "openfortivpnhotplug" "$ACTION on $INTERFACE to bring up $1. Autostart is $autostart"
  16. [ "$autostart" -eq 0 ] && {
  17. logger -t "openfortivpnhotplug" "auto-start was false. bringing $1 up"
  18. ubus call network.interface up "{ \"interface\" : \"$1\" }"
  19. }
  20. }
  21. config_load network
  22. config_foreach handle_network interface
  23. exit 0