bugfix: dns parse hosts.conf
@@ -119,9 +119,16 @@ local function parse_hosts()
local rts = {}
for line in f:lines() do
- local ip, hosts = string.match(line, "^%s*([%[%]%x%.%:]+)%s+([^#;]*)")
+ local ip, hosts = string.match(line, "^%s*([%[%]%x%.%:]+)%s+([^#;]+)")
+ if not ip or not hosts then
+ goto continue
+ end
+
local family = guess_name_type(ip)
- if hosts and family ~= "hostname" then
+ if family == "hostname" then
+ goto continue
+ end
+
for host in hosts:gmatch("%S+") do
host = host:lower()
local rt = rts[host]
@@ -135,7 +142,8 @@ local function parse_hosts()
end
table.insert(rt[family], ip)
end
- end
+
+ ::continue::
end
return rts
end
