From: Steven Barth Date: Mon, 18 Aug 2008 02:06:59 +0000 (+0000) Subject: Small bug fixes X-Git-Tag: 0.8.0~362 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=935f4a805a484a3325016493e87c82e6b0180fa8;p=oweals%2Fluci.git Small bug fixes --- diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua index 6cc090882..9a32dd68d 100644 --- a/libs/cbi/luasrc/cbi.lua +++ b/libs/cbi/luasrc/cbi.lua @@ -162,6 +162,15 @@ function Map.__init__(self, config, ...) 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 function Map.chain(self, config) 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 d4f95b8f6..c0f66e965 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/network.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/network.lua @@ -46,7 +46,7 @@ end up = s:option(Flag, "up") 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) end @@ -66,7 +66,10 @@ end hwaddr = s:option(DummyValue, "_hwaddr") function hwaddr.cfgvalue(self, section) 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