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.

29 lines
955 B

  1. /etc/init.d/miniupnpd enabled || exit 0
  2. # If miniupnpd is not running:
  3. # - check on _any_ event (event updates may contribute to network_find_wan*)
  4. # If miniupnpd _is_ running:
  5. # - check only on ifup (otherwise lease updates etc would cause
  6. # miniupnpd state loss)
  7. . /lib/functions/procd.sh
  8. [ "$ACTION" != "ifup" ] && procd_running "miniupnpd" "*" && exit 0
  9. tmpconf="/var/etc/miniupnpd.conf"
  10. extiface=$(uci get upnpd.config.external_iface)
  11. extzone=$(uci get upnpd.config.external_zone)
  12. . /lib/functions/network.sh
  13. [ -z "$extiface" ] && {
  14. # manual external zone (if dynamically find interfaces
  15. # belonging to it) overrides network_find_wan*
  16. [ -n "$extzone" ] && ifname=$(fw3 -q zone "$extzone" | head -1)
  17. [ -z "$extiface" ] && network_find_wan extiface
  18. [ -z "$extiface" ] && network_find_wan6 extiface
  19. }
  20. [ -z "$ifname" ] && network_get_device ifname "$extiface"
  21. grep -q "ext_ifname=$ifname" "$tmpconf" || /etc/init.d/miniupnpd restart