Small bug fixes
This commit is contained in:
parent
23b17ce06f
commit
935f4a805a
2 changed files with 14 additions and 2 deletions
|
@ -162,6 +162,15 @@ function Map.__init__(self, config, ...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Map.render(self, ...)
|
||||||
|
if self.stateful then
|
||||||
|
uci.load_state(self.config)
|
||||||
|
else
|
||||||
|
uci.load_config(self.config)
|
||||||
|
end
|
||||||
|
Node.render(self, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Chain foreign config
|
-- Chain foreign config
|
||||||
function Map.chain(self, config)
|
function Map.chain(self, config)
|
||||||
|
|
|
@ -46,7 +46,7 @@ end
|
||||||
|
|
||||||
up = s:option(Flag, "up")
|
up = s:option(Flag, "up")
|
||||||
function up.write(self, section, value)
|
function up.write(self, section, value)
|
||||||
local call = value == "1" and "ifdown" or "ifup"
|
local call = value == "1" and "ifup" or "ifdown"
|
||||||
os.execute(call .. " " .. section)
|
os.execute(call .. " " .. section)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -66,7 +66,10 @@ end
|
||||||
hwaddr = s:option(DummyValue, "_hwaddr")
|
hwaddr = s:option(DummyValue, "_hwaddr")
|
||||||
function hwaddr.cfgvalue(self, section)
|
function hwaddr.cfgvalue(self, section)
|
||||||
local ix = self.map:get(section, "ifname") or ""
|
local ix = self.map:get(section, "ifname") or ""
|
||||||
return luci.fs.readfile("/sys/class/net/" .. ix .. "/address") or "n/a"
|
return luci.fs.readfile("/sys/class/net/" .. ix .. "/address")
|
||||||
|
or luci.util.exec("ifconfig " .. ix):match(" ([A-F0-9:]+)%s*\n")
|
||||||
|
or "n/a"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue