<%# Opennet Firmware Copyright 2010 Rene Ejury 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 $Id: index.htm 5448 2009-10-31 15:54:11Z jow $ -%> <%+header%> <% local uci = require "luci.model.uci" local cursor = uci.cursor() local on_version = luci.sys.exec("opkg status on-core | awk '{if (/Version/) print $2;}'") local on_id = cursor:get("on-core", "settings", "on_id") if not on_id then on_id = "" end function printZoneLine(zoneName) networks = cursor:get("firewall", "zone_"..zoneName, "network") if networks and relevant(networks) then %> <%=luci.i18n.translate("on_status_network_"..zoneName) %> <% printInterfaces(networks) %> <% end end function relevant(networks) for network in networks:gmatch("%S+") do iface = cursor:get("network", network, "ifname") if iface and luci.sys.exec("ip address show label "..iface) ~= "" then return true end end return false end function printInterfaces(networks) %> <% for network in networks:gmatch("%S+") do printValues(network) end %>
<%:on_networks_iface%> <%:on_networks_ip%> <%:on_networks_mac%> <%:on_networks_dhcp%>
<% end function printValues(network) ifname = cursor:get("network", network, "ifname") if not ifname or ifname == "none" then return end output = luci.sys.exec([[ ip address show label ]]..ifname..[[ | awk 'BEGIN{ mac="---";ip="---"; } { if ($1 ~ "link") mac=$2; if ($1 ~ "inet") ip=$2; } END{ print "]]..ifname..[["ip""mac""}' ]]) if output and output ~= "" then %> <%=output%> <% local dhcp = cursor:get_all("dhcp", network) if dhcp and dhcp.ignore ~= "1" then %> <%=dhcp.start.." / "..dhcp.limit.." / "..dhcp.leasetime%> <% else print("---") end %> <% end end %>

<%=luci.i18n.translatef("on_status_title", "", on_version, on_id)%>

<%:on_status_intro%>