Changeset 5949
- Timestamp:
- 03/27/10 15:56:35 (3 years ago)
- Location:
- luci/branches/luci-0.9/modules
- Files:
-
- 2 modified
-
admin-full/luasrc/model/cbi/admin_network/network.lua (modified) (1 diff)
-
admin-mini/luasrc/model/cbi/mini/network.lua (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
luci/branches/luci-0.9/modules/admin-full/luasrc/model/cbi/admin_network/network.lua
r5768 r5949 92 92 function hwaddr.cfgvalue(self, section) 93 93 local ix = utl.trim(self.map:get(section, "ifname") or "") 94 if #ix > 0 then 95 local mac = fs.readfile("/sys/class/net/" .. ix .. "/address") 96 or luci.util.exec("ifconfig " .. ix):match(" ([A-F0-9:]+)%s*\n") 94 local mac = fs.readfile("/sys/class/net/" .. ix .. "/address") 97 95 98 if mac and #mac > 0then99 return mac:upper()100 end96 if not mac then 97 mac = luci.util.exec("ifconfig " .. ix) 98 mac = mac and mac:match(" ([A-F0-9:]+)%s*\n") 101 99 end 100 101 if mac and #mac > 0 then 102 return mac:upper() 103 end 104 102 105 return "?" 103 106 end -
luci/branches/luci-0.9/modules/admin-mini/luasrc/model/cbi/mini/network.lua
r5118 r5949 42 42 function hwaddr.cfgvalue(self, section) 43 43 local ix = self.map:get(section, "ifname") or "" 44 return fs.readfile("/sys/class/net/" .. ix .. "/address") 45 or luci.util.exec("ifconfig " .. ix):match(" ([A-F0-9:]+)%s*\n") 46 or "n/a" 44 local mac = fs.readfile("/sys/class/net/" .. ix .. "/address") 45 46 if not mac then 47 mac = luci.util.exec("ifconfig " .. ix) 48 mac = mac and mac:match(" ([A-F0-9:]+)%s*\n") 49 end 50 51 if mac and #mac > 0 then 52 return mac:upper() 53 end 54 55 return "?" 47 56 end 48 57
