mirror of https://github.com/aredn/aredn.git
Protect against missing hosts_olsr.stable (#523)
This commit is contained in:
parent
277610bf27
commit
caaafc3831
|
@ -316,6 +316,7 @@ do
|
|||
end
|
||||
|
||||
-- load the olsr hosts file
|
||||
if nixio.fs.stat("/var/run/hosts_olsr.stable") then
|
||||
for line in io.lines("/var/run/hosts_olsr.stable")
|
||||
do
|
||||
local ip, name, originator = line:match("^([%d%.]+)%s+(%S+)%s+%S+%s+(%S+)")
|
||||
|
@ -362,6 +363,7 @@ do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- discard
|
||||
routes = nil
|
||||
|
|
|
@ -58,6 +58,7 @@ function mesh_ip_to_hostnames(ip)
|
|||
end
|
||||
end
|
||||
local hosts = ""
|
||||
if nixio.fs.stat("/var/run/hosts_olsr.stable") then
|
||||
for line in io.lines("/var/run/hosts_olsr.stable")
|
||||
do
|
||||
local host = line:match(pattern)
|
||||
|
@ -65,6 +66,7 @@ function mesh_ip_to_hostnames(ip)
|
|||
hosts = hosts .. " / " .. host
|
||||
end
|
||||
end
|
||||
end
|
||||
return hosts:sub(4, #hosts)
|
||||
end
|
||||
|
||||
|
@ -180,6 +182,7 @@ end
|
|||
|
||||
local host_total = 0
|
||||
local host_nodes = 0
|
||||
if nixio.fs.stat("/var/run/hosts_olsr.stable") then
|
||||
for line in io.lines("/var/run/hosts_olsr.stable")
|
||||
do
|
||||
if line:match("^10%.") and not line:match("%smid%d+%.") then
|
||||
|
@ -190,6 +193,7 @@ do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- post data
|
||||
|
||||
|
|
Loading…
Reference in New Issue