X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=applications%2Fluci-olsr%2Fluasrc%2Fcontroller%2Folsr.lua;h=20bf25ba1ce5ffb7a99289dc46de527ea8842397;hb=276a93867c21d709af69eab5bfeaded36ad36d51;hp=c1b6ed9f444a268b0a426f0f60523999450efb71;hpb=97f0cf2996be5ce5ad58e22c35ea81336727db08;p=project%2Fluci.git diff --git a/applications/luci-olsr/luasrc/controller/olsr.lua b/applications/luci-olsr/luasrc/controller/olsr.lua index c1b6ed9f4..20bf25ba1 100644 --- a/applications/luci-olsr/luasrc/controller/olsr.lua +++ b/applications/luci-olsr/luasrc/controller/olsr.lua @@ -108,8 +108,16 @@ function action_json() local jsonreq4 = utl.exec("echo /status | nc 127.0.0.1 9090") local jsonreq6 = utl.exec("echo /status | nc ::1 9090") - http.prepare_content("application/json") + + if #jsonreq4 < 1 then + jsonreq4 = "{}" + end + + if #jsonreq6 < 1 then + jsonreq6 = "{}" + end + http.write("{v4:" .. jsonreq4 .. ", v6:" .. jsonreq6 .. "}") end @@ -134,7 +142,7 @@ function action_neigh(json) for k, v in ipairs(data) do if resolve == "1" then - hostname = nixio.getnameinfo(v.remoteIP) + hostname = nixio.getnameinfo(v.remoteIP, nil, 100) if hostname then v.hostname = hostname end @@ -159,7 +167,7 @@ function action_routes() for k, v in ipairs(data) do if resolve == "1" then - local hostname = nixio.getnameinfo(v.gateway) + local hostname = nixio.getnameinfo(v.gateway, nil, 100) if hostname then v.hostname = hostname end @@ -215,7 +223,7 @@ function action_hna() for k, v in ipairs(data) do if resolve == "1" then - hostname = nixio.getnameinfo(v.gateway) + hostname = nixio.getnameinfo(v.gateway, nil, 100) if hostname then v.hostname = hostname end