minimalist-pcproxy/miniupnpd: added+using upnp.config.external_zone.

This commit is contained in:
Markus Stenberg 2014-06-26 23:17:54 +03:00
parent 20c981679d
commit 6dca756c06
4 changed files with 24 additions and 4 deletions

View File

@ -10,6 +10,7 @@ set upnpd.config.enable_upnp=0
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

View File

@ -34,11 +34,17 @@ for ext_iface in $(uci -q get upnpd.config.external_iface); do
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

View File

@ -31,3 +31,7 @@ for iface in $ext_iface $ext_iface6 $(uci_get upnpd config internal_iface; uci_g
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

View File

@ -70,6 +70,7 @@ start() {
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
@ -93,10 +94,18 @@ start() {
local ifname
[ -n "$extiface" ] || network_find_wan extiface
[ -n "$extiface" ] || network_find_wan6 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
network_get_device ifname ${extiface}
[ -n "$ifname"] || network_get_device ifname ${extiface}
if [ -n "$conffile" ]; then
args="-f $conffile"