<%# Copyright 2008 Steven Barth Copyright 2008 Jo-Philipp Wich Copyright 2011 Manuel Munz Licensed to the public under the Apache License 2.0. -%> <% local i = 1 require("luci.model.uci") local uci = luci.model.uci.cursor_state() uci:foreach("olsrd", "olsrd", function(s) if s.SmartGateway and s.SmartGateway == "yes" then has_smartgw = true end end) if luci.http.formvalue("status") == "1" then local rv = {} for k, gw in ipairs(gws) do gw.tcPathCost = tonumber(gw.tcPathCost)/1024 or 0 if gw.tcPathCost == 4096 then gw.tcPathCost = 0 end rv[#rv+1] = { proto = gw.proto, ipAddress = gw.ipAddress, status = gw.ipv4Status or gw.ipv6Status, tcPathCost = string.format("%.3f", gw.tcPathCost), hopCount = gw.hopCount, uplinkSpeed = gw.uplinkSpeed, downlinkSpeed = gw.downlinkSpeed, v4 = gw.ipv4 and luci.i18n.translate('yes') or luci.i18n.translate('no'), v6 = gw.ipv6 and luci.i18n.translate('yes') or luci.i18n.translate('no'), externalPrefix = gw.externalPrefix } end luci.http.prepare_content("application/json") luci.http.write_json(rv) return end %> <%+header%> <%+header%>

<%:SmartGW announcements%>

<% if has_smartgw then %>
<%:Overview of smart gateways in this network%>
<%:Gateway%>
<%:Status%>
<%:ETX%>
<%:Hops%>
<%:Uplink%>
<%:Downlink%>
<%:IPv4%>
<%:IPv6%>
<%:Prefix%>
<% for k, gw in ipairs(gws) do gw.tcPathCost = tonumber(gw.tcPathCost)/1024 or 0 if gw.tcPathCost == 4096 then gw.tcPathCost = 0 end %>
<% if gw.proto == '6' then %> <% else %> <% end %>
<%=gw.ipv4Status or gw.ipv6Status or '-' %>
<%=string.format("%.3f", gw.tcPathCost)%>
<%=gw.hopCount%>
<%=gw.uplinkSpeed%>
<%=gw.downlinkSpeed%>
<%=gw.ipv4 and luci.i18n.translate('yes') or luci.i18n.translate('no')%>
<%=gw.ipv6 and luci.i18n.translate('yes') or luci.i18n.translate('no')%>
<%=gw.externalPrefix%>
<% i = ((i % 2) + 1) end %>
<% else %> <%:SmartGateway is not configured on this system.%> <% end %> <%+status-olsr/common_js%> <%+footer%>