Changeset 5949

Show
Ignore:
Timestamp:
03/27/10 15:56:35 (3 years ago)
Author:
jow
Message:

luci-0.9: merge r5948

Location:
luci/branches/luci-0.9/modules
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • luci/branches/luci-0.9/modules/admin-full/luasrc/model/cbi/admin_network/network.lua

    r5768 r5949  
    9292function hwaddr.cfgvalue(self, section) 
    9393    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") 
    9795 
    98         if mac and #mac > 0 then 
    99             return mac:upper() 
    100         end 
     96    if not mac then 
     97        mac = luci.util.exec("ifconfig " .. ix) 
     98        mac = mac and mac:match(" ([A-F0-9:]+)%s*\n") 
    10199    end 
     100 
     101    if mac and #mac > 0 then 
     102        return mac:upper() 
     103    end 
     104 
    102105    return "?" 
    103106end 
  • luci/branches/luci-0.9/modules/admin-mini/luasrc/model/cbi/mini/network.lua

    r5118 r5949  
    4242function hwaddr.cfgvalue(self, section) 
    4343    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 "?" 
    4756end 
    4857