From 58d97b5e271bc0d7507eab5b9bd2902181864e02 Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Fri, 3 Aug 2018 12:36:51 -0400 Subject: modules: Split luci-mod-full Move some common elements to luci-base, and otherwise make three packages out of status, system, and network. They were mostly separated already, but there were some shared elements between status and network that are now in luci-base. Signed-off-by: Daniel F. Dickinson --- .../luasrc/view/admin_status/bandwidth.htm | 305 ------------- .../luasrc/view/admin_status/connections.htm | 376 ---------------- .../luasrc/view/admin_status/dmesg.htm | 12 - .../luasrc/view/admin_status/index.htm | 487 --------------------- .../luasrc/view/admin_status/iptables.htm | 155 ------- .../luasrc/view/admin_status/load.htm | 285 ------------ .../luasrc/view/admin_status/routes.htm | 156 ------- .../luasrc/view/admin_status/syslog.htm | 12 - .../luasrc/view/admin_status/wireless.htm | 371 ---------------- 9 files changed, 2159 deletions(-) delete mode 100644 modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm delete mode 100644 modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm delete mode 100644 modules/luci-mod-admin-full/luasrc/view/admin_status/dmesg.htm delete mode 100644 modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm delete mode 100644 modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm delete mode 100644 modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm delete mode 100644 modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm delete mode 100644 modules/luci-mod-admin-full/luasrc/view/admin_status/syslog.htm delete mode 100644 modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm (limited to 'modules/luci-mod-admin-full/luasrc/view/admin_status') diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm deleted file mode 100644 index 3bb55f9054..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm +++ /dev/null @@ -1,305 +0,0 @@ -<%# - Copyright 2010 Jo-Philipp Wich - Licensed to the public under the Apache License 2.0. --%> - -<%- - local ntm = require "luci.model.network".init() - - local dev - local devices = { } - for _, dev in luci.util.vspairs(luci.sys.net.devices()) do - if dev ~= "lo" and not ntm:ignore_interface(dev) then - devices[#devices+1] = dev - end - end - - local curdev = luci.http.formvalue("dev") or devices[1] --%> - -<%+header%> - - - -

<%:Realtime Traffic%>

- - - - -
-
-
- -
-
-
<%:Inbound:%>
-
0 <%:kbit/s%>
(0 <%:kB/s%>)
- -
<%:Average:%>
-
0 <%:kbit/s%>
(0 <%:kB/s%>)
- -
<%:Peak:%>
-
0 <%:kbit/s%>
(0 <%:kB/s%>)
-
-
-
<%:Outbound:%>
-
0 <%:kbit/s%>
(0 <%:kB/s%>)
- -
<%:Average:%>
-
0 <%:kbit/s%>
(0 <%:kB/s%>)
- -
<%:Peak:%>
-
0 <%:kbit/s%>
(0 <%:kB/s%>)
-
-
- -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm deleted file mode 100644 index 0a0db3be78..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm +++ /dev/null @@ -1,376 +0,0 @@ -<%# - Copyright 2010 Jo-Philipp Wich - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> - - - -

<%:Realtime Connections%>

- -
<%:This page gives an overview over currently active network connections.%>
- -
- <%:Active Connections%> - - -
-
-
- -
-
-
<%:UDP:%>
-
0
- -
<%:Average:%>
-
0
- -
<%:Peak:%>
-
0
-
-
-
<%:TCP:%>
-
0
- -
<%:Average:%>
-
0
- -
<%:Peak:%>
-
0
-
-
-
<%:Other:%>
-
0
- -
<%:Average:%>
-
0
- -
<%:Peak:%>
-
0
-
-
-
- -
-
-
-
<%:Network%>
-
<%:Protocol%>
-
<%:Source%>
-
<%:Destination%>
-
<%:Transfer%>
-
- -
-
- <%:Collecting data...%> -
-
-
-
-
- -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/dmesg.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/dmesg.htm deleted file mode 100644 index 1a8770ef88..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/dmesg.htm +++ /dev/null @@ -1,12 +0,0 @@ -<%# - Copyright 2008 Steven Barth - Copyright 2008 Jo-Philipp Wich - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> -

<%:Kernel Log%>

-
- -
-<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm deleted file mode 100644 index 8820ae1cf3..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm +++ /dev/null @@ -1,487 +0,0 @@ -<%# - Copyright 2008 Steven Barth - Copyright 2008-2011 Jo-Philipp Wich - Licensed to the public under the Apache License 2.0. --%> - -<% - local fs = require "nixio.fs" - local ipc = require "luci.ip" - local util = require "luci.util" - local stat = require "luci.tools.status" - local ver = require "luci.version" - - local has_ipv6 = fs.access("/proc/net/ipv6_route") - local has_dhcp = fs.access("/etc/config/dhcp") - local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0) - - local sysinfo = luci.util.ubus("system", "info") or { } - local boardinfo = luci.util.ubus("system", "board") or { } - local unameinfo = nixio.uname() or { } - - local meminfo = sysinfo.memory or { - total = 0, - free = 0, - buffered = 0, - shared = 0 - } - - local swapinfo = sysinfo.swap or { - total = 0, - free = 0 - } - - local has_dsl = fs.access("/etc/init.d/dsl_control") - - if luci.http.formvalue("status") == "1" then - local ntm = require "luci.model.network".init() - local wan_nets = ntm:get_wan_networks() - local wan6_nets = ntm:get_wan6_networks() - - local conn_count = tonumber( - fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0 - - local conn_max = tonumber(luci.sys.exec( - "sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max" - ):match("%d+")) or 4096 - - local rv = { - uptime = sysinfo.uptime or 0, - localtime = os.date(), - loadavg = sysinfo.load or { 0, 0, 0 }, - memory = meminfo, - swap = swapinfo, - connmax = conn_max, - conncount = conn_count, - wifinets = stat.wifi_networks() - } - - if #wan_nets > 0 then - local k, v - - rv.wan = { } - - for k, v in pairs(wan_nets) do - local dev = v:get_interface() - local link = dev and ipc.link(dev:name()) - - local wan_info = { - ipaddr = v:ipaddr(), - gwaddr = v:gwaddr(), - netmask = v:netmask(), - dns = v:dnsaddrs(), - expires = v:expires(), - uptime = v:uptime(), - proto = v:proto(), - i18n = v:get_i18n(), - ifname = v:ifname(), - link = v:adminlink(), - mac = dev and dev:mac(), - type = dev and dev:type(), - name = dev and dev:get_i18n(), - ether = link and link.type == 1 - } - - rv.wan[#rv.wan+1] = wan_info - end - end - - if #wan6_nets > 0 then - local k, v - - rv.wan6 = { } - - for k, v in pairs(wan6_nets) do - local dev = v:get_interface() - local link = dev and ipc.link(dev:name()) - local wan6_info = { - ip6addr = v:ip6addr(), - gw6addr = v:gw6addr(), - dns = v:dns6addrs(), - ip6prefix = v:ip6prefix(), - uptime = v:uptime(), - proto = v:proto(), - i18n = v:get_i18n(), - ifname = v:ifname(), - link = v:adminlink(), - mac = dev and dev:mac(), - type = dev and dev:type(), - name = dev and dev:get_i18n(), - ether = link and link.type == 1 - } - - rv.wan6[#rv.wan6+1] = wan6_info - end - end - - if has_dsl then - local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat") - local dsl_func = loadstring(dsl_stat) - if dsl_func then - rv.dsl = dsl_func() - end - end - - luci.http.prepare_content("application/json") - luci.http.write_json(rv) - - return - end --%> - -<%+header%> - - - -

<%:Status%>

- -
-

<%:System%>

- -
-
<%:Hostname%>
<%=luci.sys.hostname() or "?"%>
-
<%:Model%>
<%=pcdata(boardinfo.model or "?")%>
-
<%:Architecture%>
<%=pcdata(boardinfo.system or "?")%>
-
<%:Firmware Version%>
- <%=pcdata(ver.distname)%> <%=pcdata(ver.distversion)%> / - <%=pcdata(ver.luciname)%> (<%=pcdata(ver.luciversion)%>) -
-
<%:Kernel Version%>
<%=unameinfo.release or "?"%>
-
<%:Local Time%>
-
-
<%:Uptime%>
-
-
<%:Load Average%>
-
-
-
- -
-

<%:Memory%>

- -
-
<%:Total Available%>
-
-
<%:Free%>
-
-
<%:Buffered%>
-
-
-
- -<% if swapinfo.total > 0 then %> -
-

<%:Swap%>

- -
-
<%:Total Available%>
-
-
<%:Free%>
-
-
-
-<% end %> - -
-

<%:Network%>

- -
-

<%:Collecting data...%>

-
- -
-
<%:Active Connections%>
-
-
-
- -<% - if has_dhcp then - include("admin_network/lease_status") - end -%> - -<% if has_dsl then %> -
-

<%:DSL%>

- -
-

<%:Collecting data...%>

-
-
-<% end %> - -<% if has_wifi then %> -
-

<%:Wireless%>

- -
-

<%:Collecting data...%>

-
-
- -
-

<%:Associated Stations%>

- - <%+admin_network/wifi_assoclist%> -
-<% end %> - -<%- - local incdir = util.libpath() .. "/view/admin_status/index/" - if fs.access(incdir) then - local inc - for inc in fs.dir(incdir) do - if inc:match("%.htm$") then - include("admin_status/index/" .. inc:gsub("%.htm$", "")) - end - end - end --%> - -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm deleted file mode 100644 index 51e428e40e..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm +++ /dev/null @@ -1,155 +0,0 @@ -<%# - Copyright 2008-2009 Steven Barth - Copyright 2008-2015 Jo-Philipp Wich - Licensed to the public under the Apache License 2.0. --%> - -<%- - - require "luci.sys.iptparser" - local wba = require "luci.tools.webadmin" - local fs = require "nixio.fs" - local io = require "io" - - local has_ip6tables = fs.access("/usr/sbin/ip6tables") - local mode = 4 - - if has_ip6tables then - mode = luci.dispatcher.context.requestpath - mode = tonumber(mode[#mode] ~= "iptables" and mode[#mode]) or 4 - end - - local ipt = luci.sys.iptparser.IptParser(mode) - - local rowcnt = 1 - function rowstyle() - rowcnt = rowcnt + 1 - return (rowcnt % 2) + 1 - end - - function link_target(t,c) - if ipt:is_custom_target(c) then - return '%s' %{ t:lower(), c, c } - end - return c - end - - function link_iface(i) - local net = wba.iface_get_network(i) - if net and i ~= "lo" then - return '%s' %{ - url("admin/network/network", net), i - } - - end - return i - end - - local tables = { "Filter", "NAT", "Mangle", "Raw" } - if mode == 6 then - tables = { "Filter", "Mangle", "Raw" } - local ok, lines = pcall(io.lines, "/proc/net/ip6_tables_names") - if ok and lines then - local line - for line in lines do - if line == "nat" then - tables = { "Filter", "NAT", "Mangle", "Raw" } - end - end - end - end --%> - -<%+header%> - - - -

<%:Firewall Status%>

- -<% if has_ip6tables then %> - -<% end %> - -
- -
" style="position: absolute; right: 0"> - - - - -
- -
- - <% for _, tbl in ipairs(tables) do chaincnt = 0 %> -

<%:Table%>: <%=tbl%>

- - <% for _, chain in ipairs(ipt:chains(tbl)) do - rowcnt = 0 - chaincnt = chaincnt + 1 - chaininfo = ipt:chain(tbl, chain) - %> -

- <%:Chain%> <%=chain%> - (<%- if chaininfo.policy then -%> - <%:Policy%>: <%=chaininfo.policy%>, <%:Packets%>: <%=chaininfo.packets%>, <%:Traffic%>: <%=wba.byte_format(chaininfo.bytes)-%> - <%- else -%> - <%:References%>: <%=chaininfo.references-%> - <%- end -%>) -

- -
-
-
-
<%:Pkts.%>
-
<%:Traffic%>
-
<%:Target%>
-
<%:Prot.%>
-
<%:In%>
-
<%:Out%>
-
<%:Source%>
-
<%:Destination%>
-
<%:Options%>
-
- - <% for _, rule in ipairs(ipt:find({table=tbl, chain=chain})) do %> -
-
<%=rule.packets%>
-
<%=wba.byte_format(rule.bytes)%>
-
<%=rule.target and link_target(tbl, rule.target) or "-"%>
-
<%=rule.protocol%>
-
<%=link_iface(rule.inputif)%>
-
<%=link_iface(rule.outputif)%>
-
<%=rule.source%>
-
<%=rule.destination%>
-
<%=#rule.options > 0 and luci.util.pcdata(table.concat(rule.options, " ")) or "-"%>
-
- <% end %> - - <% if rowcnt == 1 then %> -
-
<%:No rules in this chain%>
-
- <% end %> -
-
- <% end %> - - <% if chaincnt == 0 then %> - <%:No chains in this table%> - <% end %> - -

- <% end %> -
-
- -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm deleted file mode 100644 index bced06fa22..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm +++ /dev/null @@ -1,285 +0,0 @@ -<%# - Copyright 2010 Jo-Philipp Wich - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> - - - -

<%:Realtime Load%>

- - -
-
-
- -
-
-
<%:1 Minute Load:%>
-
0
- -
<%:Average:%>
-
0
- -
<%:Peak:%>
-
0
-
-
-
<%:5 Minute Load:%>
-
0
- -
<%:Average:%>
-
0
- -
<%:Peak:%>
-
0
-
-
-
<%:15 Minute Load:%>
-
0
- -
<%:Average:%>
-
0
- -
<%:Peak:%>
-
0
-
-
- -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm deleted file mode 100644 index 74779f6ad8..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm +++ /dev/null @@ -1,156 +0,0 @@ -<%# - Copyright 2008-2009 Steven Barth - Copyright 2008-2015 Jo-Philipp Wich - Licensed to the public under the Apache License 2.0. --%> - -<%- - require "luci.tools.webadmin" - require "nixio.fs" - - local ip = require "luci.ip" - local style = true - local _, v - - local rtn = { - [255] = "local", - [254] = "main", - [253] = "default", - [0] = "unspec" - } - - if nixio.fs.access("/etc/iproute2/rt_tables") then - local ln - for ln in io.lines("/etc/iproute2/rt_tables") do - local i, n = ln:match("^(%d+)%s+(%S+)") - if i and n then - rtn[tonumber(i)] = n - end - end - end --%> - -<%+header%> - - -
-

<%:Routes%>

-
<%:The following rules are currently active on this system.%>
- -
- ARP -
-
-
-
<%_IPv4-Address%>
-
<%_MAC-Address%>
-
<%:Interface%>
-
- - <% - for _, v in ipairs(ip.neighbors({ family = 4 })) do - if v.mac then - %> -
-
<%=v.dest%>
-
<%=v.mac%>
-
<%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%>
-
- <% - style = not style - end - end - %> -
-
-
- -
- <%_Active IPv4-Routes%> -
-
-
-
<%:Network%>
-
<%:Target%>
-
<%_IPv4-Gateway%>
-
<%:Metric%>
-
<%:Table%>
-
- <% for _, v in ipairs(ip.routes({ family = 4, type = 1 })) do %> -
-
<%=luci.tools.webadmin.iface_get_network(v.dev) or v.dev%>
-
<%=v.dest%>
-
<%=v.gw or "-"%>
-
<%=v.metric or 0%>
-
<%=rtn[v.table] or v.table%>
-
- <% style = not style end %> -
-
-
- - <% - if nixio.fs.access("/proc/net/ipv6_route") then - style = true - %> -
- <%_Active IPv6-Routes%> -
-
-
-
<%:Network%>
-
<%:Target%>
-
<%:Source%>
-
<%:Metric%>
-
<%:Table%>
-
- <% - for _, v in ipairs(ip.routes({ family = 6, type = 1 })) do - if v.dest and not v.dest:is6linklocal() then - %> -
-
<%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%>
-
<%=v.dest%>
-
<%=v.from%>
-
<%=v.metric or 0%>
-
<%=rtn[v.table] or v.table%>
-
- <% - style = not style - end - end - %> -
-
-
- -
- <%:IPv6 Neighbours%> -
-
-
-
<%:IPv6-Address%>
-
<%:MAC-Address%>
-
<%:Interface%>
-
- <% - for _, v in ipairs(ip.neighbors({ family = 6 })) do - if v.dest and not v.dest:is6linklocal() and v.mac then - %> -
-
<%=v.dest%>
-
<%=v.mac%>
-
<%=luci.tools.webadmin.iface_get_network(v.dev) or '(' .. v.dev .. ')'%>
-
- <% - style = not style - end - end - %> -
-
-
- <% end %> -
- -<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/syslog.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/syslog.htm deleted file mode 100644 index fb734a76d9..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/syslog.htm +++ /dev/null @@ -1,12 +0,0 @@ -<%# - Copyright 2008 Steven Barth - Copyright 2008 Jo-Philipp Wich - Licensed to the public under the Apache License 2.0. --%> - -<%+header%> -

<%:System Log%>

-
- -
-<%+footer%> diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm deleted file mode 100644 index 8ec43cb0e6..0000000000 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm +++ /dev/null @@ -1,371 +0,0 @@ -<%# - Copyright 2011 Jo-Philipp Wich - Licensed to the public under the Apache License 2.0. --%> - -<%- - local ntm = require "luci.model.network".init() - - local dev - local devices = { } - for _, dev in luci.util.vspairs(luci.sys.net.devices()) do - if dev:match("^wlan%d") or dev:match("^ath%d") or dev:match("^wl%d") then - devices[#devices+1] = dev - end - end - - local curdev = luci.http.formvalue("dev") or devices[1] --%> - -<%+header%> - - - -

<%:Realtime Wireless%>

- - - - -
-
-
- -
-
-
<%:Signal:%>
-
0 <%:dBm%>
- -
<%:Average:%>
-
0 <%:dBm%>
- -
<%:Peak:%>
-
0 <%:dBm%>
-
-
-
<%:Noise:%>
-
0 <%:dBm%>
- -
<%:Average:%>
-
0 <%:dBm%>
- -
<%:Peak:%>
-
0 <%:dBm%>
-
-
- -
- - -
-
-
- -
-
-
<%:Phy Rate:%>
-
0 MBit/s
- -
<%:Average:%>
-
0 MBit/s
- -
<%:Peak:%>
-
0 MBit/s
-
-
- -<%+footer%> -- cgit v1.2.3