Remove #NOPROP from /etc/ethers where it was being incorectly parsed.

The AREDN code now cross references entries in /etc/ethers with those in
/etc/hosts to determine if an IP is #NOPROP.
This commit is contained in:
Tim Wilkinson 2022-06-20 23:41:56 -07:00 committed by Joe AE6XE
parent ad441ba600
commit a65e09e2ad
2 changed files with 16 additions and 9 deletions

View File

@ -303,7 +303,7 @@ if h and e then
ip = decimal_to_ip(netaddr + ip)
if validate_same_subnet(ip, cfg.lan_ip, cfg.lan_mask) and validate_ip_netmask(ip, cfg.lan_mask) then
h:write(ip .. "\t" .. host .. " " .. noprop .. "\n")
e:write(mac .. "\t" .. ip .. " " .. noprop .. "\n")
e:write(mac .. "\t" .. ip .. "\n")
end
end
end

View File

@ -105,16 +105,23 @@ if dmz_mode ~= "0" then
end
end
if nixio.fs.stat("/etc/ethers") then
local noprop_ip = {}
if nixio.fs.stat("/etc/hosts") then
for line in io.lines("/etc/hosts")
do
local ip = line:match("^(%S+)%s.*#NOPROP$")
if ip then
noprop_ip[ip] = true
end
end
end
for line in io.lines("/etc/ethers")
do
local noprop = line:match(".*%s+.*%s+#NOPROP")
if not noprop then
local ip = line:match("[0-9a-fA-F:]+%s+([%d%.]+)")
if ip then
local host = ip_to_hostname(ip)
if host then
hosts[#hosts + 1] = { ip = ip, host = host }
end
local ip = line:match("[0-9a-fA-F:]+%s+([%d%.]+)")
if ip and not noprop_ip[ip] then
local host = ip_to_hostname(ip)
if host then
hosts[#hosts + 1] = { ip = ip, host = host }
end
end
end