applications/luci-upnp: also stop miniupnpd if it is about to be disabled
[project/luci.git] / applications / luci-upnp / luasrc / model / cbi / upnp / upnp.lua
index 293b1fb..97fe88e 100644 (file)
@@ -16,8 +16,13 @@ m = Map("upnpd", translate("upnpd"), translate("upnpd_desc"))
 
 s = m:section(NamedSection, "config", "upnpd", "")
 e = s:option(Flag, "enabled", translate("enable"))
+e.rmempty = false
+
 function e.write(self, section, value)
        local cmd = (value == "1") and "enable" or "disable"
+       if value ~= "1" then
+               os.execute("/etc/init.d/miniupnpd stop")
+       end
        os.execute("/etc/init.d/miniupnpd " .. cmd)
 end
 
@@ -27,7 +32,7 @@ end
 
 s:option(Flag, "secure_mode").rmempty = true
 s:option(Flag, "log_output").rmempty = true
-s:option(Value, "download", nil, "kb/s").rmempty = true
-s:option(Value, "upload", nil, "kb/s").rmempty = true
+s:option(Value, "download", nil, "kByte/s").rmempty = true
+s:option(Value, "upload", nil, "kByte/s").rmempty = true
 
 return m