[packages] miniupnpd: use network.sh to find devices and subnets
git-svn-id: svn://svn.openwrt.org/openwrt/packages@31963 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
524b8d3632
commit
2eee57c7c4
@ -57,23 +57,6 @@ upnpd_write_bool() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
upnpd_netmask2prefix() {
|
|
||||||
local octet
|
|
||||||
local prefix=0
|
|
||||||
local IFS="."
|
|
||||||
|
|
||||||
set -- $1
|
|
||||||
|
|
||||||
for octet in $1 $2 $3 $4; do
|
|
||||||
while [ $octet -gt 0 ]; do
|
|
||||||
prefix=$(($prefix + ($octet & 1)))
|
|
||||||
octet=$(($octet >> 1))
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
return $prefix
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
type miniupnpd_add_rules >/dev/null 2>/dev/null || \
|
type miniupnpd_add_rules >/dev/null 2>/dev/null || \
|
||||||
ACTION=- . /etc/hotplug.d/firewall/50-miniupnpd
|
ACTION=- . /etc/hotplug.d/firewall/50-miniupnpd
|
||||||
@ -103,11 +86,10 @@ start() {
|
|||||||
|
|
||||||
local args
|
local args
|
||||||
|
|
||||||
include /lib/network
|
. /lib/functions/network.sh
|
||||||
scan_interfaces
|
|
||||||
|
|
||||||
local ifname
|
local ifname
|
||||||
config_get ifname ${extiface:-wan} ifname
|
network_get_device ifname ${extiface:-wan}
|
||||||
|
|
||||||
if [ -n "$conffile" ]; then
|
if [ -n "$conffile" ]; then
|
||||||
args="-f $conffile"
|
args="-f $conffile"
|
||||||
@ -123,12 +105,9 @@ start() {
|
|||||||
|
|
||||||
local iface
|
local iface
|
||||||
for iface in ${intiface:-lan}; do
|
for iface in ${intiface:-lan}; do
|
||||||
local ipaddr netmask
|
local ipnet
|
||||||
config_get ipaddr "$iface" ipaddr
|
network_get_subnet ipnet "$iface" && {
|
||||||
config_get netmask "$iface" netmask "255.255.255.0"
|
echo "listening_ip=$ipnet" >>$tmpconf
|
||||||
[ -n "$ipaddr" ] && {
|
|
||||||
upnpd_netmask2prefix "$netmask"
|
|
||||||
echo "listening_ip=$ipaddr/$?" >>$tmpconf
|
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user