From ff2074c4295767b2913f4d78f54abf984be685f0 Mon Sep 17 00:00:00 2001 From: Tim Yardley Date: Tue, 5 Dec 2006 06:24:30 +0000 Subject: [PATCH] sync with r1585 from xwrt. kamikaze integration finished by thepeople. thanks SVN-Revision: 5692 --- net/miniupnpd/Makefile | 4 ++- net/miniupnpd/files/miniupnpd.init | 25 +++++++++++-------- net/miniupnpd/files/upnpd.config | 4 +++ net/miniupnpd/ipkg/miniupnp.postinst | 2 ++ .../100-iptables-wan-device-name.patch | 4 +-- 5 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 net/miniupnpd/files/upnpd.config create mode 100644 net/miniupnpd/ipkg/miniupnp.postinst diff --git a/net/miniupnpd/Makefile b/net/miniupnpd/Makefile index 3c5a8072a5..cd66d1c5c4 100644 --- a/net/miniupnpd/Makefile +++ b/net/miniupnpd/Makefile @@ -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 diff --git a/net/miniupnpd/files/miniupnpd.init b/net/miniupnpd/files/miniupnpd.init index 147291af32..5d307a9f4c 100644 --- a/net/miniupnpd/files/miniupnpd.init +++ b/net/miniupnpd/files/miniupnpd.init @@ -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 index 0000000000..35448db0ea --- /dev/null +++ b/net/miniupnpd/files/upnpd.config @@ -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 index 0000000000..d868a6c2d5 --- /dev/null +++ b/net/miniupnpd/ipkg/miniupnp.postinst @@ -0,0 +1,2 @@ +/etc/init.d/miniupnpd enable + diff --git a/net/miniupnpd/patches/100-iptables-wan-device-name.patch b/net/miniupnpd/patches/100-iptables-wan-device-name.patch index b0a1b9831f..dbeebf1a82 100644 --- a/net/miniupnpd/patches/100-iptables-wan-device-name.patch +++ b/net/miniupnpd/patches/100-iptables-wan-device-name.patch @@ -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 -- 2.30.2