set upnpd.config.pcp_allow_thirdparty=1
set upnpd.config.internal_iface=loopback
set upnpd.config.ipv6_listening_ip=::1
+set upnpd.config.external_zone=wan
set upnpd.config._pcproxy_configured=1
commit upnpd
EOF
add_extzone_rules $(fw3 -q network "$ext_iface")
done
+add_extzone_rules $(uci -q get upnpd.config.external_zone)
+
[ ! $ADDED = 0 ] && exit 0
-# If it's not available, resort to network_find_wan{,6} and
+
+# If really nothing is available, resort to network_find_wan{,6} and
# assume external interfaces all have same firewall zone.
+# (This heuristic may fail horribly, in case of e.g. multihoming, so
+# please set external_zone in that case!)
+
network_find_wan wan_iface
network_find_wan6 wan6_iface
network_get_device device $iface
[ "$DEVICE" = "$device" ] && /etc/init.d/miniupnpd restart && exit 0
done
+
+for device in $(fw3 -q zone `uci_get upnpd config external_zone`); do
+ [ "$DEVICE" = "$device" ] && /etc/init.d/miniupnpd restart && exit 0
+done
local ipv6_listening_ip
config_get extiface config external_iface
+ config_get extzone config external_zone
config_get intiface config internal_iface
config_get extip config external_ip
config_get port config port 5000
local ifname
- [ -n "$extiface" ] || network_find_wan extiface
- [ -n "$extiface" ] || network_find_wan6 extiface
-
- network_get_device ifname ${extiface}
+ # manual external interface overrides everything
+ if [ -z "$extiface" ] ; then
+ # manual external zone (if dynamically find interfaces
+ # belonging to it) overrides network_find_wan*
+ if [ -n "$extzone" ] ; then
+ ifname=$(fw3 -q zone $extzone | head -1)
+ fi
+ [ -n "$extiface" ] || network_find_wan extiface
+ [ -n "$extiface" ] || network_find_wan6 extiface
+ fi
+
+ [ -n "$ifname"] || network_get_device ifname ${extiface}
if [ -n "$conffile" ]; then
args="-f $conffile"