#
-# Copyright (C) 2006-2011 OpenWrt.org
+# Copyright (C) 2006-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
PKG_NAME:=miniupnpd
PKG_VERSION:=1.6.20110730
-PKG_RELEASE:=3
+PKG_RELEASE:=4
PKG_SOURCE_URL:=http://miniupnp.free.fr/files
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
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 ipaddr netmask
config_get ipaddr "$iface" ipaddr
config_get netmask "$iface" netmask "255.255.255.0"
- [ -n "$ipaddr" ] && \
- echo "listening_ip=$ipaddr/$netmask" >>$tmpconf
+ [ -n "$ipaddr" ] && {
+ upnpd_netmask2prefix "$netmask"
+ echo "listening_ip=$ipaddr/$?" >>$tmpconf
+ }
done
[ "$port" != "auto" ] && \