[packages] miniupnpd: convert netmask to prefix and write listen address in CIDR notation (#10767, #10770)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@29722 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
0541eec1f3
commit
4e56459b0d
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2006-2011 OpenWrt.org
|
# Copyright (C) 2006-2012 OpenWrt.org
|
||||||
#
|
#
|
||||||
# This is free software, licensed under the GNU General Public License v2.
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
|
|||||||
|
|
||||||
PKG_NAME:=miniupnpd
|
PKG_NAME:=miniupnpd
|
||||||
PKG_VERSION:=1.6.20110730
|
PKG_VERSION:=1.6.20110730
|
||||||
PKG_RELEASE:=3
|
PKG_RELEASE:=4
|
||||||
|
|
||||||
PKG_SOURCE_URL:=http://miniupnp.free.fr/files
|
PKG_SOURCE_URL:=http://miniupnp.free.fr/files
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
|
@ -57,6 +57,23 @@ 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
|
||||||
@ -109,8 +126,10 @@ start() {
|
|||||||
local ipaddr netmask
|
local ipaddr netmask
|
||||||
config_get ipaddr "$iface" ipaddr
|
config_get ipaddr "$iface" ipaddr
|
||||||
config_get netmask "$iface" netmask "255.255.255.0"
|
config_get netmask "$iface" netmask "255.255.255.0"
|
||||||
[ -n "$ipaddr" ] && \
|
[ -n "$ipaddr" ] && {
|
||||||
echo "listening_ip=$ipaddr/$netmask" >>$tmpconf
|
upnpd_netmask2prefix "$netmask"
|
||||||
|
echo "listening_ip=$ipaddr/$?" >>$tmpconf
|
||||||
|
}
|
||||||
done
|
done
|
||||||
|
|
||||||
[ "$port" != "auto" ] && \
|
[ "$port" != "auto" ] && \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user