better heuristics for filtering bat-hosts candidate entries: only accept 6-bytes MACs, and not all-zeroes like lo
This commit is contained in:
parent
6240662804
commit
65f291d478
1 changed files with 4 additions and 5 deletions
|
@ -14,10 +14,7 @@ function get_interfaces_names()
|
||||||
local ret = {}
|
local ret = {}
|
||||||
|
|
||||||
for name in io.popen("ls -1 /sys/class/net/"):lines() do
|
for name in io.popen("ls -1 /sys/class/net/"):lines() do
|
||||||
-- skip loopback ("lo") mac (00:00:00:00:00:00)
|
table.insert(ret, name)
|
||||||
if name ~= "lo" then
|
|
||||||
table.insert(ret, name)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
@ -46,7 +43,9 @@ local function generate_bat_hosts()
|
||||||
end
|
end
|
||||||
|
|
||||||
for mac, iname in pairs(ifaces) do
|
for mac, iname in pairs(ifaces) do
|
||||||
table.insert(ret, mac.." "..hostname.."_"..iname.."\n")
|
if mac:match("^%x%x:%x%x:%x%x:%x%x:%x%x:%x%x$") and not mac:match("00:00:00:00:00:00") then
|
||||||
|
table.insert(ret, mac.." "..hostname.."_"..iname.."\n")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
Loading…
Reference in a new issue