sync with r1585 from xwrt. kamikaze integration finished by thepeople. thanks
authorpavlov <pavlov@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 5 Dec 2006 06:24:30 +0000 (06:24 +0000)
committerpavlov <pavlov@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 5 Dec 2006 06:24:30 +0000 (06:24 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@5692 3c298f89-4303-0410-b956-a3cf2f4a3e73

net/miniupnpd/Makefile
net/miniupnpd/files/miniupnpd.init
net/miniupnpd/files/upnpd.config [new file with mode: 0644]
net/miniupnpd/ipkg/miniupnp.postinst [new file with mode: 0644]
net/miniupnpd/patches/100-iptables-wan-device-name.patch

index 3c5a807..cd66d1c 100644 (file)
@@ -37,10 +37,12 @@ define Build/Compile
 endef
 
 define Package/miniupnpd/install
-       $(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d
+       $(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/etc/config $(1)/CONTROL
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/miniupnpd $(1)/usr/bin/
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/linux/*.sh $(1)/usr/bin/
        $(INSTALL_BIN) ./files/miniupnpd.init $(1)/etc/init.d/miniupnpd
+       $(INSTALL_BIN) ./files/upnpd.config $(1)/etc/config/upnpd
+       $(INSTALL_BIN) ./ipkg/miniupnp.postinst $(1)/CONTROL/postinst
        $(STRIP) $(1)/usr/bin/miniupnpd
 endef
 
index 147291a..5d307a9 100644 (file)
@@ -1,14 +1,14 @@
-#!/bin/sh
-upnpd_enabled=$(nvram get upnp_enabled)
-if [ "$upnpd_enabled" = "1" ]; then
+#!/bin/sh /etc/rc.common
+START=95
+start() {
        echo "miniupnpd starting ..."
        iptables_flush.sh 2>&- >&-
        killall miniupnpd 2>&-
        iptables_removeall.sh 2>&- >&-
        iptables_init.sh
        # get bitspeed information, if provided
-       upnpd_up_bitspeed=$(nvram get upnpd_up_bitspeed)
-       upnpd_down_bitspeed=$(nvram get upnpd_down_bitspeed)
+       upnpd_up_bitspeed=$(uci get upnpd.general.up_bitspeed)
+       upnpd_down_bitspeed=$(uci get upnpd.general.down_bitspeed)
        bitspeed_str=""
        [ -n "$upnpd_up_bitspeed" ] && [ -n "$upnpd_down_bitspeed" ] && {
                # covert to bytespeed
@@ -16,12 +16,15 @@ if [ "$upnpd_enabled" = "1" ]; then
                let upnpd_down_bytespeed=$upnpd_down_bitspeed*1024/8
                bitspeed_str="-B $upnpd_down_bytespeed $upnpd_up_bytespeed"
        }
-       upnpd_log=$(nvram get upnpd_log_output)
+       upnpd_log=$(uci get upnpd.general.log_output)
        if [ "$upnpd_log" = "1" ]; then
-               miniupnpd -i $(nvram get wan_ifname) -a $(nvram get lan_ipaddr) -p 5000 -U $bitspeed_str -d | logger -t miniupnpd &
+               miniupnpd -i $(uci get network.wan.ifname) -a $(uci get network.lan.ipaddr) -p 5000 -U $bitspeed_str -d | logger -t miniupnpd &
        else
-               miniupnpd -i $(nvram get wan_ifname) -a $(nvram get lan_ipaddr) -p 5000 -U $bitspeed_str
+               miniupnpd -i $(uci get network.wan.ifname) -a $(uci get network.lan.ipaddr) -p 5000 -U $bitspeed_str
        fi
-else
-       echo "miniupnpd service is disabled. Set nvram upnp_enabled to '1' to enable."
-fi
+}
+stop() {
+       iptables_flush.sh 2>&- >&-
+       killall miniupnpd 2>&-
+       iptables_removeall.sh 2>&- >&-
+}
\ No newline at end of file
diff --git a/net/miniupnpd/files/upnpd.config b/net/miniupnpd/files/upnpd.config
new file mode 100644 (file)
index 0000000..35448db
--- /dev/null
@@ -0,0 +1,4 @@
+config upnpd general
+       option log_output    '0'
+       option down_bitspeed '1024'
+       option up_bitspeed   '512'
diff --git a/net/miniupnpd/ipkg/miniupnp.postinst b/net/miniupnpd/ipkg/miniupnp.postinst
new file mode 100644 (file)
index 0000000..d868a6c
--- /dev/null
@@ -0,0 +1,2 @@
+/etc/init.d/miniupnpd enable
+
index b0a1b98..dbeebf1 100644 (file)
@@ -7,7 +7,7 @@ diff -urN miniupnpd.orig/linux/iptables_init.sh miniupnpd/linux/iptables_init.sh
  
 -#change this parameters :
 -EXTIF=eth0
-+EXTIF=$(nvram get wan_device)
++EXTIF=$(uci get network.wan.ifname)
  EXTIP="`LC_ALL=C /sbin/ifconfig $EXTIF | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`"
  echo "External IP = $EXTIP"
  
@@ -20,7 +20,7 @@ diff -urN miniupnpd.orig/linux/iptables_removeall.sh miniupnpd/linux/iptables_re
  
 -#change this parameters :
 -EXTIF=eth0
-+EXTIF=$(nvram get wan_device)
++EXTIF=$(uci get network.wan.ifname)
  EXTIP="`LC_ALL=C /sbin/ifconfig $EXTIF | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`"
  
  #removing the MINIUPNPD chain for nat