summaryrefslogtreecommitdiffhomepage
path: root/modules/freifunk/luasrc
diff options
context:
space:
mode:
Diffstat (limited to 'modules/freifunk/luasrc')
-rw-r--r--modules/freifunk/luasrc/controller/freifunk/freifunk.lua15
-rw-r--r--modules/freifunk/luasrc/view/freifunk/public_status.htm16
2 files changed, 27 insertions, 4 deletions
diff --git a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua
index 89cd0ff50c..1d0175ff1e 100644
--- a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua
+++ b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua
@@ -51,7 +51,7 @@ function index()
page.order = 20
page.i18n = "base"
page.setuser = false
- page.setgroup = false
+ page.setgroup = false
entry({"freifunk", "status.json"}, call("jsonstatus"))
entry({"freifunk", "status", "zeroes"}, call("zeroes"), "Testdownload")
@@ -292,7 +292,18 @@ function public_status_json()
dest = dr4.dest:string(),
dev = dr4.device,
metr = dr4.metric }
- end
+ else
+ local dr = sys.exec("ip r s t olsr-default")
+ if dr then
+ local dest, gateway, dev, metr = dr:match("^(%w+) via (%d+.%d+.%d+.%d+) dev (%w+) +metric (%d+)")
+ def4 = {
+ dest = dest,
+ gateway = gateway,
+ dev = dev,
+ metr = metr
+ }
+ end
+ end
rv[#rv+1] = {
time = os.date("%a, %d %b %Y, %H:%M:%S"),
diff --git a/modules/freifunk/luasrc/view/freifunk/public_status.htm b/modules/freifunk/luasrc/view/freifunk/public_status.htm
index 9cb1856884..0203f2ae86 100644
--- a/modules/freifunk/luasrc/view/freifunk/public_status.htm
+++ b/modules/freifunk/luasrc/view/freifunk/public_status.htm
@@ -49,6 +49,18 @@ local has_iwinfo = pcall(require, "iwinfo")
local defroutev4 = sys.net.defaultroute()
local defroutev6 = sys.net.defaultroute6()
+if defroutev4 then
+ defroutev4.dest = defroutev4.dest:string()
+ defroutev4.gateway = defroutev4.gateway:string()
+else
+ local dr4 = sys.exec("ip r s t olsr-default")
+ if dr4 then
+ defroutev4 = { }
+ defroutev4.dest, defroutev4.gateway, defroutev4.device, defroutev4.metric = dr4:match("^(%w+) via (%d+.%d+.%d+.%d+) dev (%w+) +metric (%d+)$
+ end
+end
+
+
-%>
<%+header%>
@@ -283,9 +295,9 @@ local defroutev6 = sys.net.defaultroute6()
<% if defroutev4 then %>
<tr class="cbi-section-table-row cbi-rowstyle-1">
- <td class="cbi-value-field" id="v4dst"><%=defroutev4.dest:string()%></td>
+ <td class="cbi-value-field" id="v4dst"><%=defroutev4.dest%></td>
<td class="cbi-value-field" id="v4dev"><%=defroutev4.device%></td>
- <td class="cbi-value-field" id="v4gw"><%=defroutev4.gateway:string()%></td>
+ <td class="cbi-value-field" id="v4gw"><%=defroutev4.gateway%></td>
<td class="cbi-value-field" id="v4metr"><%=defroutev4.metric%></td>
</tr>