summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-olsr
diff options
context:
space:
mode:
authorManuel Munz <munz@comuno.net>2015-05-30 20:48:57 +0200
committerManuel Munz <munz@comuno.net>2015-05-30 20:48:57 +0200
commitcc39eaa681bbd9e35be1c3729efa102ddb0a20a4 (patch)
tree5e12084068a1bb2b8e4e678c60c60fd01e630834 /applications/luci-app-olsr
parent595c637c3bb798f85a93a07d45c4ef568a3ce706 (diff)
applications/olsr: Get jsoninfo source port prom olsrd/olsrd6 config file
Diffstat (limited to 'applications/luci-app-olsr')
-rw-r--r--applications/luci-app-olsr/luasrc/controller/olsr.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/applications/luci-app-olsr/luasrc/controller/olsr.lua b/applications/luci-app-olsr/luasrc/controller/olsr.lua
index 74deb716c4..3a5838d03d 100644
--- a/applications/luci-app-olsr/luasrc/controller/olsr.lua
+++ b/applications/luci-app-olsr/luasrc/controller/olsr.lua
@@ -80,12 +80,15 @@ end
function action_json()
local http = require "luci.http"
local utl = require "luci.util"
- local uci = require "luci.model.uci".cursor_state()
+ local uci = require "luci.model.uci".cursor()
local jsonreq4
local jsonreq6
- jsonreq4 = utl.exec("echo /status | nc 127.0.0.1 9090")
- jsonreq6 = utl.exec("echo /status | nc ::1 9090")
+ 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 )
+ jsonreq6 = utl.exec("echo /status | nc ::1 " .. v6_port)
http.prepare_content("application/json")
if not jsonreq4 or jsonreq4 == "" then
jsonreq4 = "{}"
@@ -368,8 +371,11 @@ function fetch_jsoninfo(otable)
local IpVersion = uci:get_first("olsrd", "olsrd","IpVersion")
local jsonreq4 = ""
local jsonreq6 = ""
- jsonreq4 = utl.exec("echo /" .. otable .. " | nc 127.0.0.1 9090")
- jsonreq6 = utl.exec("echo /" .. otable .. " | nc ::1 9090")
+ 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)
+ jsonreq6 = utl.exec("echo /" .. otable .. " | nc ::1 " .. v6_port)
local jsondata4 = {}
local jsondata6 = {}
local data4 = {}