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.

49 lines
1.1 KiB

  1. #!/bin/sh /etc/rc.common
  2. #
  3. # Copyright (C) 2016-2019 eGloo, Incorporated
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. START=50
  7. STOP=50
  8. USE_PROCD=1
  9. PROG=/usr/sbin/netifyd
  10. start_netifyd() {
  11. local instance enabled autoconfig internal_if external_if
  12. instance="$1"
  13. config_get_bool enabled "$instance" enabled 0
  14. [ "$enabled" -eq 0 ] && return 0
  15. [ ! -d /var/run/netifyd ] && mkdir -p /var/run/netifyd
  16. config_get_bool autoconfig "$instance" autoconfig 1
  17. config_get filter "$instance" filter
  18. if [ "$autoconfig" -gt 0 ] ; then
  19. source /usr/share/netifyd/functions.sh
  20. load_modules
  21. NETIFYD_AUTODETECT=yes
  22. NETIFYD_OPTS=$(auto_detect_options)
  23. else
  24. config_get internal_if "$instance" internal_if "eth0"
  25. config_get external_if "$instance" external_if "eth1"
  26. NETIFYD_OPTS="-E $external_if -I $internal_if"
  27. fi
  28. procd_open_instance
  29. procd_set_param command $PROG -R $NETIFYD_OPTS
  30. [ -n "$filter" ] && procd_append_param command -F "$filter"
  31. procd_set_param file /etc/netifyd.conf
  32. procd_set_param respawn
  33. procd_close_instance
  34. }
  35. start_service() {
  36. config_load netifyd
  37. config_foreach start_netifyd netifyd
  38. }