Fresh pull from upstream
[librecmc/librecmc.git] / package / luci / applications / luci-app-olsr / luasrc / controller / olsr.lua
index 9a997bdc1221bf9c0296bdf26159d86a83d73a7a..0564bd4ea7835bf991e71fbef7e2ef513add4e7f 100644 (file)
@@ -87,8 +87,8 @@ function action_json()
        local v4_port = uci:get("olsrd", "olsrd_jsoninfo", "port") or 9090
        local v6_port = uci:get("olsrd6", "olsrd_jsoninfo", "port") or 9090
 
-       jsonreq4 = utl.exec("(echo /status | nc 127.0.0.1 " .. v4_port .. ") 2>/dev/null" )
-       jsonreq6 = utl.exec("(echo /status | nc ::1 " .. v6_port .. ") 2>/dev/null")
+       jsonreq4 = utl.exec("(echo /status | nc 127.0.0.1 " .. v4_port .. " | sed -n '/^[}{ ]/p') 2>/dev/null" )
+       jsonreq6 = utl.exec("(echo /status | nc ::1 " .. v6_port .. " | sed -n '/^[}{ ]/p') 2>/dev/null")
        http.prepare_content("application/json")
        if not jsonreq4 or jsonreq4 == "" then
                jsonreq4 = "{}"
@@ -375,8 +375,8 @@ function fetch_jsoninfo(otable)
        local v4_port = uci:get("olsrd", "olsrd_jsoninfo", "port") or 9090
        local v6_port = uci:get("olsrd6", "olsrd_jsoninfo", "port") or 9090
 
-       jsonreq4 = utl.exec("(echo /" .. otable .. " | nc 127.0.0.1 " .. v4_port .. ") 2>/dev/null")
-       jsonreq6 = utl.exec("(echo /" .. otable .. " | nc ::1 " .. v6_port .. ") 2>/dev/null")
+       jsonreq4 = utl.exec("(echo /" .. otable .. " | nc 127.0.0.1 " .. v4_port .. " | sed -n '/^[}{ ]/p') 2>/dev/null")
+       jsonreq6 = utl.exec("(echo /" .. otable .. " | nc ::1 " .. v6_port .. " | sed -n '/^[}{ ]/p') 2>/dev/null")
        local jsondata4 = {}
        local jsondata6 = {}
        local data4 = {}