luci-app-upnp: support igdv1 run time flag
[project/luci.git] / applications / luci-app-upnp / luasrc / model / cbi / upnp / upnp.lua
index 3d98d66..17a4d9b 100644 (file)
@@ -1,17 +1,6 @@
---[[
-LuCI - Lua Configuration Interface
-
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008-2011 Jo-Philipp Wich <xm@subsignal.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-]]--
+-- Copyright 2008 Steven Barth <steven@midlink.org>
+-- Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org>
+-- Licensed to the public under the Apache License 2.0.
 
 m = Map("upnpd", luci.util.pcdata(translate("Universal Plug & Play")),
        translate("UPnP allows clients in the local network to automatically configure the router."))
@@ -23,21 +12,21 @@ s.addremove = false
 s:tab("general",  translate("General Settings"))
 s:tab("advanced", translate("Advanced Settings"))
 
-e = s:taboption("general", Flag, "_init", translate("Start UPnP and NAT-PMP service"))
+e = s:taboption("general", Flag, "enabled", translate("Start UPnP and NAT-PMP service"))
 e.rmempty  = false
 
-function e.cfgvalue(self, section)
-       return luci.sys.init.enabled("miniupnpd") and self.enabled or self.disabled
-end
+--function e.cfgvalue(self, section)
+--     return luci.sys.init.enabled("miniupnpd") and self.enabled or self.disabled
+--end
 
 function e.write(self, section, value)
        if value == "1" then
-               luci.sys.call("/etc/init.d/miniupnpd enable >/dev/null")
                luci.sys.call("/etc/init.d/miniupnpd start >/dev/null")
        else
                luci.sys.call("/etc/init.d/miniupnpd stop >/dev/null")
-               luci.sys.call("/etc/init.d/miniupnpd disable >/dev/null")
        end
+
+       return Flag.write(self, section, value)
 end
 
 s:taboption("general", Flag, "enable_upnp", translate("Enable UPnP functionality")).default = "1"
@@ -46,6 +35,9 @@ s:taboption("general", Flag, "enable_natpmp", translate("Enable NAT-PMP function
 s:taboption("general", Flag, "secure_mode", translate("Enable secure mode"),
        translate("Allow adding forwards only to requesting ip addresses")).default = "1"
 
+s:taboption("general", Flag, "igdv1", translate("Enable IGDv1 mode"),
+       translate("Advertise as IGDv1 device instead of IGDv2")).default = "0"
+
 s:taboption("general", Flag, "log_output", translate("Enable additional logging"),
        translate("Puts extra debugging information into the system log"))