<%# LuCI - Lua Configuration Interface Copyright 2008 Steven Barth Copyright 2008 Jo-Philipp Wich Copyright 2011 Manuel Munz Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/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 rv[#rv+1] = { hostname = route.Hostname, dest = route.Destination, gw = route["Gateway IP"], interface = route.Interface, metric = route.Metric, etx = tonumber(route.ETX), color = olsrtools.etx_color(tonumber(route.ETX)), rs = i } if i == 1 then i = 0 elseif i == 0 then i = 1 end 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 color = olsrtools.etx_color(tonumber(route.ETX)) %> <% if i == 1 then i = 0 elseif i == 0 then i = 1 end end %>
<%:Announced network%> <%:OLSR gateway%> <%:Interface%> <%:Metric%> ETX
<%=route.Destination%> /cgi-bin-status.html"><%=route["Gateway IP"]%> <% if route.Hostname then %> / <%=route.Hostname%> <% end %> <%=route.Interface%> <%=route.Metric%> <%=string.format("%.3f", tonumber(route.ETX) or 0)%>
<%+footer%>