summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/admin-full/luasrc/model/cbi/admin_network/network.lua23
-rw-r--r--modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua16
-rw-r--r--modules/admin-mini/luasrc/model/cbi/mini/network.lua4
3 files changed, 36 insertions, 7 deletions
diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/network.lua b/modules/admin-full/luasrc/model/cbi/admin_network/network.lua
index c0f66e965e..1f10ac8290 100644
--- a/modules/admin-full/luasrc/model/cbi/admin_network/network.lua
+++ b/modules/admin-full/luasrc/model/cbi/admin_network/network.lua
@@ -15,9 +15,12 @@ $Id$
require("luci.sys")
require("luci.tools.webadmin")
+luci.model.uci.load_state("network")
+local netstate = luci.model.uci.get_all("network")
+luci.model.uci.unload("network")
+
m = Map("network", translate("interfaces"))
-m.stateful = true
local created
local netstat = luci.sys.net.deviceinfo()
@@ -45,12 +48,25 @@ function s.parse(self, ...)
end
up = s:option(Flag, "up")
+function up.cfgvalue(self, section)
+ return netstate[section] and netstate[section].up or "0"
+end
+
function up.write(self, section, value)
- local call = value == "1" and "ifup" or "ifdown"
- os.execute(call .. " " .. section)
+ local call
+ if value == "1" then
+ call = "ifup"
+ elseif value == "0" then
+ call = "ifdown"
+ end
+ os.execute(call .. " " .. section .. " >/dev/null 2>&1")
end
ifname = s:option(DummyValue, "ifname", translate("device"))
+function ifname.cfgvalue(self, section)
+ return netstate[section] and netstate[section].ifname
+end
+
ifname.titleref = luci.dispatcher.build_url("admin", "network", "vlan")
if luci.model.uci.load("firewall") then
@@ -74,7 +90,6 @@ end
ipaddr = s:option(DummyValue, "ipaddr", translate("addresses"))
-
function ipaddr.cfgvalue(self, section)
local addr = luci.tools.webadmin.network_get_addresses(section)
return table.concat(addr, ", ")
diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
index 64a4928796..3717c5b5b7 100644
--- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
+++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
@@ -66,10 +66,24 @@ s.defaults.device = arg[1]
s:option(Value, "ssid", translate("a_w_netid")).maxlength = 32
-network = s:option(ListValue, "network", translate("network"), translate("a_w_network1"))
+network = s:option(Value, "network", translate("network"), translate("a_w_network1"))
+network.rmempty = true
network:value("")
+network.combobox_manual = translate("a_w_netmanual")
luci.tools.webadmin.cbi_add_networks(network)
+function network.write(self, section, value)
+ if not luci.model.uci.get("network", value) then
+ m:chain("network")
+ luci.model.uci.set("network", value, "interface")
+ Value.write(self, section, value)
+ else
+ if luci.model.uci.get("network", value) == "interface" then
+ Value.write(self, section, value)
+ end
+ end
+end
+
mode = s:option(ListValue, "mode", translate("mode"))
mode:value("ap", translate("a_w_ap"))
mode:value("adhoc", translate("a_w_adhoc"))
diff --git a/modules/admin-mini/luasrc/model/cbi/mini/network.lua b/modules/admin-mini/luasrc/model/cbi/mini/network.lua
index e36d7c030a..692f7c456a 100644
--- a/modules/admin-mini/luasrc/model/cbi/mini/network.lua
+++ b/modules/admin-mini/luasrc/model/cbi/mini/network.lua
@@ -16,13 +16,13 @@ require("luci.tools.webadmin")
require("luci.sys")
luci.model.uci.load_state("network")
-local wireless = luci.model.uci.get_all("network")
+local network = luci.model.uci.get_all("network")
luci.model.uci.unload("network")
local netstat = luci.sys.net.deviceinfo()
local ifaces = {}
-for k, v in pairs(wireless) do
+for k, v in pairs(network) do
if v[".type"] == "interface" and k ~= "loopback" then
table.insert(ifaces, v)
end