<% local uci = require "luci.model.uci" local fs = require "nixio.fs" local nws = {} uci.inst_state:foreach("network", "interface", function(s) nws[#nws+1] = s end) if uci.inst_state:get("network", "lan", "_ipchanged") and uci.inst_state:revert("network", "lan", "_ipchanged") then include("niu/network/warn_ip_change") end local wanon = uci.inst_state:get("network", "wan", "proto") local wanup = uci.inst_state:get("network", "wan", "up") local wanip = uci.inst_state:get("network", "wan", "ipaddr") local leasefn uci.inst:foreach("dhcp", "dnsmasq", function(section) leasefn = section.leasefile end ) if leasefn then local ln = fs.access(leasefn, "r") and io.lines(leasefn) leasefn = 0 while ln and ln() do leasefn = leasefn + 1 end end local arps if fs.access("/proc/net/arp", "r") then local ln = io.lines("/proc/net/arp") arps = -1 while ln and ln() do arps = arps + 1 end arps = arps >= 0 and arps end %> <% if wanon and wanon ~= "none" then %> <% if wanup then %> <% else %> <% end %> <% end %> <% if arps then %> <% end %>
Uplink Address: <%=wanip%>Uplink: offline
Local Address: <%=uci.inst_state:get("network", "lan", "ipaddr")%>
Active IP-Devices:<%=arps%><% if leasefn then %> (<%=leasefn%> assigned) <% end %>