[packages_10.03.2] miniupnpd: merge r28183, r29178, r29673, r29722
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 5 Feb 2012 15:29:11 +0000 (15:29 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 5 Feb 2012 15:29:11 +0000 (15:29 +0000)
SVN-Revision: 30221

net/miniupnpd/Makefile
net/miniupnpd/files/miniupnpd.init

index 0a2d443e981f2c81181b88f7956aa5051597be79..8c342dfc0b668b90e66cf0881df6675ee2905d2d 100644 (file)
@@ -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.
 # See /LICENSE for more information.
@@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=miniupnpd
-PKG_VERSION:=1.5.20110309
-PKG_RELEASE:=2
-PKG_MD5SUM:=350d20bf25922e12f8d69e06fa33fd83
+PKG_VERSION:=1.6.20110730
+PKG_RELEASE:=4
 
 PKG_SOURCE_URL:=http://miniupnp.free.fr/files
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=8bd5c0447b6dc1101b96e958ee67d3ea
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -44,8 +44,8 @@ define Build/Compile
 endef
 
 define Package/miniupnpd/install
-       $(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/etc/config $(1)/etc/hotplug.d/iface $(1)/etc/hotplug.d/firewall
-       $(INSTALL_BIN) $(PKG_BUILD_DIR)/miniupnpd $(1)/usr/bin/miniupnpd
+       $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config $(1)/etc/hotplug.d/iface $(1)/etc/hotplug.d/firewall
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/miniupnpd $(1)/usr/sbin/miniupnpd
        $(INSTALL_BIN) ./files/miniupnpd.init $(1)/etc/init.d/miniupnpd
        $(INSTALL_CONF) ./files/upnpd.config $(1)/etc/config/upnpd
        $(INSTALL_DATA) ./files/miniupnpd.iface.hotplug $(1)/etc/hotplug.d/iface/50-miniupnpd
index 4eebe417028d604892d7d1e783482bd07b668d71..9865030a04cf3d5e842901263216c6e2a7a73ce4 100644 (file)
@@ -1,6 +1,10 @@
 #!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
 START=95
 
+SERVICE_USE_PID=1
+
 upnpd_get_port_range() {
        local _var="$1"; shift
        local _val
@@ -53,6 +57,23 @@ 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
@@ -102,10 +123,13 @@ start() {
 
                local iface
                for iface in ${intiface:-lan}; do
-                       local ipaddr
+                       local ipaddr netmask
                        config_get ipaddr "$iface" ipaddr
-                       [ -n "$ipaddr" ] && \
-                               echo "listening_ip=$ipaddr" >>$tmpconf
+                       config_get netmask "$iface" netmask "255.255.255.0"
+                       [ -n "$ipaddr" ] && {
+                               upnpd_netmask2prefix "$netmask"
+                               echo "listening_ip=$ipaddr/$?" >>$tmpconf
+                       }
                done
 
                [ "$port" != "auto" ] && \
@@ -166,9 +190,11 @@ start() {
                        miniupnpd_add_rules "$zone" "${extiface:-wan}" "$ifname"
 
                if [ "$logging" = "1" ]; then
-                       start-stop-daemon -b -S -x miniupnpd -- $args -d
+                       SERVICE_DAEMONIZE=1 \
+                       service_start /usr/sbin/miniupnpd $args -d
                else
-                       start-stop-daemon -S -x miniupnpd -- $args
+                       SERVICE_DAEMONIZE= \
+                       service_start /usr/sbin/miniupnpd $args
                fi
        else
                logger -t "upnp daemon" "external interface not found, not starting"
@@ -176,8 +202,7 @@ start() {
 }
 
 stop() {
-       start-stop-daemon -K -q -x miniupnpd -p /var/run/miniupnpd.pid
-       rm -f /var/run/miniupnpd.pid
+       service_stop /usr/sbin/miniupnpd
 
        type miniupnpd_remove_rules >/dev/null 2>/dev/null || \
                ACTION=- . /etc/hotplug.d/firewall/50-miniupnpd