ok fixed... 
thanks for the pointers didn't work with scripting in quite a while... 

Signed-off-by: Bogdan <[email protected]>

--- openwrt/packages/net/miniupnpd/files/miniupnpd.initSat Nov 20 05:36:46 2010
+++ openwrt/packages/net/miniupnpd/files/miniupnpd.initTue Dec 15 04:10:04 2010
@@ -15,6 +15,8 @@
 config_get_bool logging config log_output 0
 config_get_bool secure config secure_mode 0
 config_get_bool enabled config enabled 0 
+config_get_bool natpmp config natpmp 0
+config_get_bool upnp config upnp 1
 
 include /lib/network
 scan_interfaces
@@ -22,6 +24,15 @@
 local ifname
 config_get ifname ${extiface:-wan} ifname
 
+if [ "ls -1l /etc/miniupnpd.conf | cut -d ' ' -f 19" != "/tmp/miniupnpd.conf" 
]; then
+rm /etc/miniupnpd.conf
+ln -s /tmp/miniupnpd.conf /etc/miniupnpd.conf
+fi
+
+if [ -e "/tmp/miniupnpd.conf" ]; then
+rm /tmp/miniupnpd.conf
+fi
+
 if [ -n "$ifname" ]; then
 local args="-i $ifname"
 local iface
@@ -32,7 +43,20 @@
 [ -n "$ipaddr" ] && append args "-a $ipaddr"
 done
 
-append args "-p 5000 -U"
+if [ "$upnp" = "1" ]; then
+append args "-p 5000"
+echo enable_upnp=yes >> /tmp/miniupnpd.conf
+else
+echo enable_upnp=no >> /tmp/miniupnpd.conf
+fi
+
+if [ "$natpmp" = "1" ]; then
+echo enable_natpmp=yes >> /tmp/miniupnpd.conf
+else
+echo enable_natpmp=no >> /tmp/miniupnpd.conf
+fi
+
+append args "-U"
 
 [ -n "$upload" -a -n "$download" ] && \
 append args "-B $(($download * 1024 * 8)) $(($upload * 1024 * 8))"



----- Original Message ----
From: Gert Doering <[email protected]>
To: OpenWrt Development List <[email protected]>
Sent: Tuesday, December 14, 2010 22:04:50
Subject: Re: [OpenWrt-Devel] [PATCH] miniupnpd config change

Hi,

On Tue, Dec 14, 2010 at 10:14:46AM -0800, Bogdan Giuglea wrote:
> -append args "-p 5000 -U"
> +if [ "$upnp" = "1" ]; then
> +append args "-p 5000"
> +echo enable_upnp=yes >> /tmp/miniupnpd.conf &
> +else
> +echo enable_upnp=no >> /tmp/miniupnpd.conf &
> +fi

Don't run "echo" commands in the background.  There is no benefit to it,
it needs more resources (extra shell) and will create potential race 
conditions.  

IOW: the "&" is completely unnecessary and potentially dangerous.

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                            [email protected]
fax: +49-89-35655025                        [email protected]



_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to