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
936 B

  1. #!/bin/sh /etc/rc.common
  2. enabled miniupnpd || exit 0
  3. # If miniupnpd is not running:
  4. # - check on _any_ event (even updates may contribute to network_find_wan*)
  5. # If miniupnpd _is_ running:
  6. # - check only on ifup (otherwise lease updates etc would cause
  7. # miniupnpd state loss)
  8. [ "$ACTION" != "ifup" ] && service_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