diff options
author | Steven Barth <steven@midlink.org> | 2009-11-16 16:58:48 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2009-11-16 16:58:48 +0000 |
commit | 2176dae3a0a648805f7de447e4af7ead8b7655dd (patch) | |
tree | 877c2986165224e1982cdbae350b3f1d35fc50a2 /modules/niu/luasrc/view | |
parent | efe5fc77f9c76ca75ae0e4c1735065589d5047c8 (diff) |
NIU:
+PortFw
+QoS
Reorganize Network
Diffstat (limited to 'modules/niu/luasrc/view')
-rw-r--r-- | modules/niu/luasrc/view/niu/network.htm | 27 | ||||
-rw-r--r-- | modules/niu/luasrc/view/niu/traffic.htm | 58 | ||||
-rw-r--r-- | modules/niu/luasrc/view/niu/traffic/conntrack.htm (renamed from modules/niu/luasrc/view/niu/network/conntrack.htm) | 0 |
3 files changed, 62 insertions, 23 deletions
diff --git a/modules/niu/luasrc/view/niu/network.htm b/modules/niu/luasrc/view/niu/network.htm index e49c930657..5f48317dc0 100644 --- a/modules/niu/luasrc/view/niu/network.htm +++ b/modules/niu/luasrc/view/niu/network.htm @@ -15,17 +15,6 @@ 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 wanif = uci.inst_state:get("network", "wan", "ifname") -local wanul, wandl - -if wanif then - local devstats = fs.readfile("/proc/net/dev") - local rx, tx = devstats:match("%s*"..wanif.. - ":%s*([0-9]+)%s+[0-9]+%s+[0-9]+%s+[0-9]+%s+".. - "[0-9]+%s+[0-9]+%s+[0-9]+%s+[0-9]+%s+([0-9]+)") - wanul = tx and (tonumber(tx) / 1000000000) - wandl = rx and (tonumber(rx) / 1000000000) -end local leasefn uci.inst:foreach("dhcp", "dnsmasq", @@ -57,10 +46,10 @@ end <% if wanon and wanon ~= "none" then %> <tr> <% if wanup then %> -<th>Uplink Address</th> +<th>Uplink Address:</th> <td><%=wanip%></td> <% else %> -<th>Uplink</th> +<th>Uplink:</th> <td><span style="color: darkred"><em>offline</em></span> </td> <% end %> @@ -68,23 +57,15 @@ end </tr> <% end %> -<% if wanul and wandl then %> -<tr> -<th>Uplink Traffic</th><td> -<%=("%.2f"):format(wandl)%> GB⇓ <%=("%.2f"):format(wanul)%> GB⇑ -</td> -</tr> -<% end %> - <tr> -<th>Local Address</th><td> +<th>Local Address:</th><td> <%=uci.inst_state:get("network", "lan", "ipaddr")%> </td> </tr> <% if arps then %> <tr> -<th>Active IP-Devices</th><td><%=arps%><% if leasefn then %> +<th>Active IP-Devices:</th><td><%=arps%><% if leasefn then %> (<%=leasefn%> assigned) <% end %></td> </tr> diff --git a/modules/niu/luasrc/view/niu/traffic.htm b/modules/niu/luasrc/view/niu/traffic.htm new file mode 100644 index 0000000000..97a18a1511 --- /dev/null +++ b/modules/niu/luasrc/view/niu/traffic.htm @@ -0,0 +1,58 @@ +<% +local uci = require "luci.model.uci" +local fs = require "nixio.fs" + +local wanon = uci.inst_state:get("network", "wan", "up") == "1" +local wanif = wanon and uci.inst_state:get("network", "wan", "ifname") +local lanif = uci.inst_state:get("network", "lan", "ifname") +local wanul, wandl, lanul, landl +local devstats = fs.readfile("/proc/net/dev") + +local fwav = fs.access("/etc/config/firewall", "r") +local fwon = uci.inst_state:get("firewall", "core", "loaded") == "1" + +if lanif then + local rx, tx = devstats:match("%s*"..lanif.. + ":%s*([0-9]+)%s+[0-9]+%s+[0-9]+%s+[0-9]+%s+".. + "[0-9]+%s+[0-9]+%s+[0-9]+%s+[0-9]+%s+([0-9]+)") + lanul = tx and (tonumber(tx) / 1000000000) + landl = rx and (tonumber(rx) / 1000000000) +end + +if wanif then + local rx, tx = devstats:match("%s*"..wanif.. + ":%s*([0-9]+)%s+[0-9]+%s+[0-9]+%s+[0-9]+%s+".. + "[0-9]+%s+[0-9]+%s+[0-9]+%s+[0-9]+%s+([0-9]+)") + wanul = tx and (tonumber(tx) / 1000000000) + wandl = rx and (tonumber(rx) / 1000000000) +end + +%> + +<table class="dbstattbl"> +<% if wanul and wandl then %> +<tr> +<th>Uplink Traffic: </th><td> +<%=("%.2f"):format(wandl)%> GB⇓ <%=("%.2f"):format(wanul)%> GB⇑ +</td> +</tr> +<% end %> + +<% if lanul and landl then %> +<tr> +<th>Local Traffic: </th><td> +<%=("%.2f"):format(landl)%> GB⇓ <%=("%.2f"):format(lanul)%> GB⇑ +</td> +</tr> +<% end %> + +<% if fwav then %> +<tr> +<th>Firewall: </th><td> +<%=fwon and translate("active") or translate("inactive")%> +</td> +</tr> +<% end %> + +</table> +<br />
\ No newline at end of file diff --git a/modules/niu/luasrc/view/niu/network/conntrack.htm b/modules/niu/luasrc/view/niu/traffic/conntrack.htm index 09b1d6b1cf..09b1d6b1cf 100644 --- a/modules/niu/luasrc/view/niu/network/conntrack.htm +++ b/modules/niu/luasrc/view/niu/traffic/conntrack.htm |