miniupnpd: compatible with js luci

This commit is contained in:
coolsnowwolf 2025-01-27 21:39:22 +08:00
parent ac5ec89fe1
commit 32114c009f
2 changed files with 27 additions and 32 deletions

View File

@ -69,7 +69,7 @@ upnpd() {
local extip port usesysuptime conffile serial_number model_number
local uuid notify_interval presentation_url enable_upnp
local upnp_lease_file clean_ruleset_threshold clean_ruleset_interval
local ipv6_listening_ip enabled
local args ifname ipv6_listening_ip enabled
config_get_bool enabled config enabled 1
@ -94,22 +94,18 @@ upnpd() {
config_get clean_ruleset_interval config clean_ruleset_interval
config_get ipv6_listening_ip config ipv6_listening_ip
local args
. /lib/functions/network.sh
local ifname
# 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
# 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}
@ -181,10 +177,9 @@ upnpd() {
[ -n "${model_number}" ] && \
echo "model_number=${model_number}" >>$tmpconf
config_foreach conf_rule_add perm_rule "$tmpconf"
config_foreach conf_rule_add perm_rule "$tmpconf"
fi
if [ -n "$ifname" ]; then
# start firewall
iptables -L MINIUPNPD >/dev/null 2>/dev/null || fw3 reload
@ -204,9 +199,9 @@ stop_service() {
iptables -t nat -F MINIUPNPD 2>/dev/null
iptables -t filter -F MINIUPNPD 2>/dev/null
[ -x /usr/sbin/ip6tables ] && {
ip6tables -t filter -F MINIUPNPD 2>/dev/null
}
[ -x /usr/sbin/ip6tables ] && {
ip6tables -t filter -F MINIUPNPD 2>/dev/null
}
}
start_service() {

View File

@ -4,13 +4,13 @@ config upnpd config
option enable_upnp 1
option secure_mode 1
option log_output 0
option download 1024
option upload 512
#by default, looked up dynamically from ubus
#option external_iface wan
option download 1024
option upload 512
#by default, looked up dynamically from ubus
# option external_iface wan
option internal_iface lan
option port 5000
option upnp_lease_file /var/upnp.leases
option upnp_lease_file /var/run/miniupnpd.leases
config perm_rule
option action allow
@ -20,8 +20,8 @@ config perm_rule
option comment "Allow high ports"
config perm_rule
option action deny
option ext_ports 0-65535
option int_addr 0.0.0.0/0
option int_ports 0-65535
option comment "Default deny"
option action deny
option ext_ports 0-65535
option int_addr 0.0.0.0/0
option int_ports 0-65535
option comment "Default deny"