This changes miniupnpd init so user can enable/disable nat-pmp and upnp 
functions via /etc/config/upnpd by adding "option 'natpmp' '1'" and "option 
'upnp' '1'" 
upnp function is enabled by default

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 14 12:42:16 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,8 @@
 local ifname
 config_get ifname ${extiface:-wan} ifname
 
+rm /etc/miniupnpd.conf
+
 if [ -n "$ifname" ]; then
 local args="-i $ifname"
 local iface
@@ -32,7 +36,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 >> /etc/miniupnpd.conf &
+else
+echo enable_upnp=no >> /etc/miniupnpd.conf &
+fi
+
+if [ "$natpmp" = "1" ]; then
+echo enable_natpmp=yes >> /etc/miniupnpd.conf &
+else
+echo enable_natpmp=no >> /etc/miniupnpd.conf &
+fi
+
+append args "-U"
 
 [ -n "$upload" -a -n "$download" ] && \
 append args "-B $(($download * 1024 * 8)) $(($upload * 1024 * 8))"



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

Reply via email to