<%# Copyright 2008 Steven Barth Copyright 2008 Jo-Philipp Wich Copyright 2011 Manuel Munz Licensed to the public under the Apache License 2.0. -%> <% local olsrtools = require "luci.tools.olsr" local i = 1 if luci.http.formvalue("status") == "1" then local rv = {} for k, route in ipairs(routes) do local ETX = string.format("%.3f", tonumber(route.rtpMetricCost)/1024 or 0) rv[#rv+1] = { hostname = route.hostname, dest = route.destination, genmask = route.genmask, gw = route.gateway, interface = route.networkInterface, metric = route.metric, etx = ETX, color = olsrtools.etx_color(tonumber(ETX)) } end luci.http.prepare_content("application/json") luci.http.write_json(rv) return end %> <%+header%>

<%:Known OLSR routes%>

<%:Overview of currently known routes to other OLSR nodes%> <% for k, route in ipairs(routes) do ETX = tonumber(route.rtpMetricCost)/1024 or '0' color = olsrtools.etx_color(ETX) %> <% i = ((i % 2) + 1) end %>
<%:Announced network%> <%:OLSR gateway%> <%:Interface%> <%:Metric%> ETX
<%=route.destination%>/<%=route.genmask%> <% if route.proto == '6' then %> <%=route.gateway%> <% else %> <%=route.gateway%> <% end %> <% if route.hostname then %> / <%=route.hostname%> <% end %> <%=route.networkInterface%> <%=route.metric%> <%=string.format("%.3f", ETX)%>
<%+status-olsr/legend%>
<%+status-olsr/common_js%> <%+footer%>