[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
|
||||
}
|
||||
|
||||
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() {
|
||||
type miniupnpd_add_rules >/dev/null 2>/dev/null || \
|
||||
ACTION=- . /etc/hotplug.d/firewall/50-miniupnpd
|
||||
@ -103,11 +86,10 @@ start() {
|
||||
|
||||
local args
|
||||
|
||||
include /lib/network
|
||||
scan_interfaces
|
||||
. /lib/functions/network.sh
|
||||
|
||||
local ifname
|
||||
config_get ifname ${extiface:-wan} ifname
|
||||
network_get_device ifname ${extiface:-wan}
|
||||
|
||||
if [ -n "$conffile" ]; then
|
||||
args="-f $conffile"
|
||||
@ -123,12 +105,9 @@ start() {
|
||||
|
||||
local iface
|
||||
for iface in ${intiface:-lan}; do
|
||||
local ipaddr netmask
|
||||
config_get ipaddr "$iface" ipaddr
|
||||
config_get netmask "$iface" netmask "255.255.255.0"
|
||||
[ -n "$ipaddr" ] && {
|
||||
upnpd_netmask2prefix "$netmask"
|
||||
echo "listening_ip=$ipaddr/$?" >>$tmpconf
|
||||
local ipnet
|
||||
network_get_subnet ipnet "$iface" && {
|
||||
echo "listening_ip=$ipnet" >>$tmpconf
|
||||
}
|
||||
done
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user