X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=modules%2Fluci-base%2Fluasrc%2Fsys.lua;h=12b20e4c38d50479754b2d854d8b1b96d0ad4b9e;hb=8d34bf94a66d0fe3b36f064170ae7516f4d78126;hp=b00feda5a8ab264eac40d9766cdf6461a78d60c8;hpb=62630fbf880058aa1c7ae10ecf5ae5cb6e4af5bb;p=project%2Fluci.git diff --git a/modules/luci-base/luasrc/sys.lua b/modules/luci-base/luasrc/sys.lua index b00feda5a..12b20e4c3 100644 --- a/modules/luci-base/luasrc/sys.lua +++ b/modules/luci-base/luasrc/sys.lua @@ -138,20 +138,21 @@ local function _nethints(what, callback) luci.ip.neighbors(nil, function(neigh) if neigh.mac and neigh.family == 4 then - _add(what, neigh.mac:upper(), neigh.dest:string(), nil, nil) + _add(what, neigh.mac:string(), neigh.dest:string(), nil, nil) elseif neigh.mac and neigh.family == 6 then - _add(what, neigh.mac:upper(), nil, neigh.dest:string(), nil) + _add(what, neigh.mac:string(), nil, neigh.dest:string(), nil) end end) if fs.access("/etc/ethers") then for e in io.lines("/etc/ethers") do - mac, name = e:match("^([a-fA-F0-9:]+)%s+(%S+)") + mac, name = e:match("^([a-fA-F0-9:-]+)%s+(%S+)") + mac = luci.ip.checkmac(mac) if mac and name then - if luci.ip.IPv4(name) then - _add(what, mac:upper(), name, nil, nil) + if luci.ip.checkip4(name) then + _add(what, mac, name, nil, nil) else - _add(what, mac:upper(), nil, nil, name) + _add(what, mac, nil, nil, name) end end end @@ -162,8 +163,9 @@ local function _nethints(what, callback) if s.leasefile and fs.access(s.leasefile) then for e in io.lines(s.leasefile) do mac, ip, name = e:match("^%d+ (%S+) (%S+) (%S+)") + mac = luci.ip.checkmac(mac) if mac and ip then - _add(what, mac:upper(), ip, nil, name ~= "*" and name) + _add(what, mac, ip, nil, name ~= "*" and name) end end end @@ -173,7 +175,10 @@ local function _nethints(what, callback) cur:foreach("dhcp", "host", function(s) for mac in luci.util.imatch(s.mac) do - _add(what, mac:upper(), s.ip, nil, s.name) + mac = luci.ip.checkmac(mac) + if mac then + _add(what, mac, s.ip, nil, s.name) + end end end)