admin-mini: Merge MAC-Address detection from admin-full
authorSteven Barth <steven@midlink.org>
Thu, 18 Sep 2008 14:51:30 +0000 (14:51 +0000)
committerSteven Barth <steven@midlink.org>
Thu, 18 Sep 2008 14:51:30 +0000 (14:51 +0000)
modules/admin-mini/luasrc/model/cbi/mini/network.lua

index e4dd2caec28692bd2ceaa96c6f5e5159b4483528..ccb5dac8987d490ed68bb351c5025e43c45da8a2 100644 (file)
@@ -36,7 +36,9 @@ hwaddr = s:option(DummyValue, "_hwaddr",
  translate("network_interface_hwaddr"), translate("network_interface_hwaddr_desc"))
 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