[packages] miniupnpd: properly handle multiple internal interfaces in hotplug helper (#9538)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@27151 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
bb474cdf99
commit
ebe91cc5fe
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2006-2009 OpenWrt.org
|
||||
# Copyright (C) 2006-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=miniupnpd
|
||||
PKG_VERSION:=1.5.20110309
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
PKG_MD5SUM:=350d20bf25922e12f8d69e06fa33fd83
|
||||
|
||||
PKG_SOURCE_URL:=http://miniupnp.free.fr/files
|
||||
|
@ -1,7 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
/etc/init.d/miniupnpd enabled && [ -n "`pidof miniupnpd`" ] && {
|
||||
local intif="$(uci_get upnpd config internal_iface)"
|
||||
[ "$ACTION" = "ifup" ] && [ "$INTERFACE" = "$intif" ] && \
|
||||
/etc/init.d/miniupnpd restart
|
||||
/etc/init.d/miniupnpd enabled && [ -n "`pidof miniupnpd`" ] && [ "$ACTION" = "ifup" ] && {
|
||||
local intif
|
||||
for intif in $(uci_get upnpd config internal_iface); do
|
||||
[ "$INTERFACE" = "$intif" ] && /etc/init.d/miniupnpd restart
|
||||
done
|
||||
}
|
||||
|
@ -24,15 +24,18 @@ conf_rule_add() {
|
||||
local tmpconf="$2"
|
||||
local action external_port_start external_port_end int_addr
|
||||
local internal_port_start internal_port_end
|
||||
|
||||
config_get action "$cfg" action "deny" # allow or deny
|
||||
upnpd_get_port_range "ext" "$cfg" ext_ports "0-65535" # external ports: x, x-y, x:y
|
||||
config_get int_addr "$cfg" int_addr "0.0.0.0/0" # ip or network and subnet mask (internal)
|
||||
upnpd_get_port_range "int" "$cfg" int_ports "0-65535" # internal ports: x, x-y, x:y or range
|
||||
|
||||
# Make a single IP IP/32 so that miniupnpd.conf can use it.
|
||||
case "$int_addr" in
|
||||
*/*) ;;
|
||||
*) int_addr="$int_addr/32" ;;
|
||||
esac
|
||||
|
||||
echo "${action} ${ext_start}${ext_end:+-}${ext_end} ${int_addr} ${int_start}${int_end:+-}${int_end}" >>$tmpconf
|
||||
}
|
||||
|
||||
@ -40,8 +43,8 @@ upnpd_write_bool() {
|
||||
local opt="$1"
|
||||
local def="${2:-0}"
|
||||
local alt="$3"
|
||||
|
||||
local val
|
||||
|
||||
config_get_bool val config "$opt" "$def"
|
||||
if [ "$val" -eq 0 ]; then
|
||||
echo "${alt:-$opt}=no" >> $tmpconf
|
||||
@ -94,11 +97,10 @@ start() {
|
||||
|
||||
echo "ext_ifname=$ifname" >$tmpconf
|
||||
|
||||
local iface
|
||||
|
||||
[ -n "$extip" ] && \
|
||||
echo "ext_ip=$extip" >>$tmpconf
|
||||
|
||||
local iface
|
||||
for iface in ${intiface:-lan}; do
|
||||
local ipaddr
|
||||
config_get ipaddr "$iface" ipaddr
|
||||
@ -159,6 +161,7 @@ start() {
|
||||
local zone
|
||||
config_load firewall
|
||||
config_get zone core "${extiface:-wan}_zone"
|
||||
|
||||
[ -n "$zone" ] && \
|
||||
miniupnpd_add_rules "$zone" "${extiface:-wan}" "$ifname"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user