X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-mod-freifunk%2Fluasrc%2Fview%2Ffreifunk%2Fpublic_status.htm;fp=modules%2Fluci-mod-freifunk%2Fluasrc%2Fview%2Ffreifunk%2Fpublic_status.htm;h=257f9caf155208323505a028d97234eae005eb88;hp=42a58f9dd365ab40de06d9b5afe298def6fa0ce6;hb=bccc6279fc6a03648827ba66b50cc41b1b5f540e;hpb=0ef5f3c6930133d5b074fd0722796d490cfcbb7c diff --git a/modules/luci-mod-freifunk/luasrc/view/freifunk/public_status.htm b/modules/luci-mod-freifunk/luasrc/view/freifunk/public_status.htm index 42a58f9dd..257f9caf1 100644 --- a/modules/luci-mod-freifunk/luasrc/view/freifunk/public_status.htm +++ b/modules/luci-mod-freifunk/luasrc/view/freifunk/public_status.htm @@ -49,6 +49,32 @@ for _, dev in ipairs(devices) do end local has_iwinfo = pcall(require, "iwinfo") + +-- Find default routes + +local _, r, def4, def6 + +for _, r in ipairs(ip.routes({ type = 1, dest_exact = "0.0.0.0/0" })) do + def4 = { + gateway = r.gw:string(), + dest = r.dest:string(), + dev = r.dev, + metr = r.metric or 0 + } + break +end + +for _, r in ipairs(ip.routes({ type = 1, dest_exact = "::/0" })) do + def6 = { + gateway = r.gw:string(), + dest = r.dest:string(), + dev = r.dev, + metr = r.metric or 0 + } + break +end + + if luci.http.formvalue("status") == "1" then local rv = { } for dev in pairs(netdevs) do @@ -67,30 +93,6 @@ if luci.http.formvalue("status") == "1" then end - -- Find default routes - - local _, r, def4, def6 - - for _, r in ipairs(ip.routes({ type = 1, dest_exact = "0.0.0.0/0" })) do - def4 = { - gateway = r.gw:string(), - dest = r.dest:string(), - dev = r.dev, - metr = r.metric or 0 - } - break - end - - for _, r in ipairs(ip.routes({ type = 1, dest_exact = "::/0" })) do - def6 = { - gateway = r.gw:string(), - dest = r.dest:string(), - dev = r.dev, - metr = r.metric or 0 - } - break - end - rv[#rv+1] = { time = time, uptime = uptime, @@ -297,7 +299,7 @@ end if bitrate ~= "N/A" then bitrate = ( bitrate / 1000 ).."Mb/s" end - local interface = net.iwdata.ifname or "N/A" + local interface = netiwdata.ifname or "N/A" %> <%=signal_string%> @@ -323,7 +325,7 @@ end
-<% if not defroutev4 and not defroutev6 then %> +<% if not def4 and not def6 then %> <%:No default routes known.%> <%else%> @@ -334,23 +336,22 @@ end - <% if defroutev4 then %> - + <% if def4 then %> - - - - + + + + <% end - if defroutev6 then %> + if def6 then %> - - - - + + + + <% end %>
<%:Metric%>
<%=defroutev4.dest%><%=defroutev4.device%><%=defroutev4.gateway%><%=defroutev4.metric%><%=def4.dest%><%=def4.dev%><%=def4.gateway%><%=def4.metr%>
<%=defroutev6.dest%><%=defroutev6.device%><%=defroutev6.nexthop%><%=defroutev6.metric%><%=def6.dest%><%=def6.dev%><%=def6.gateway%><%=def6.metr%>