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

index e4dd2ca..ccb5dac 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