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
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"
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