summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-10-31 16:43:48 +0100
committerJo-Philipp Wich <jo@mein.io>2019-11-01 12:03:33 +0100
commit650d7f64d5b1b76d58b6c719e9efe15270468cc8 (patch)
tree9a2fb7b5148227e0c9d62ba20616852c91900799 /modules
parentc85af3d7618b55c499ce4bf58e3896068bd413ae (diff)
luci-base: remove unused Lua code
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/luasrc/controller/admin/index.lua54
-rw-r--r--modules/luci-base/luasrc/tools/status.lua250
-rw-r--r--modules/luci-base/luasrc/view/lease_status.htm102
-rw-r--r--modules/luci-base/luasrc/view/wifi_assoclist.htm120
-rw-r--r--modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js42
-rw-r--r--modules/luci-mod-network/htdocs/luci-static/resources/view/network/network.js136
-rw-r--r--modules/luci-mod-network/luasrc/controller/admin/network.lua97
-rw-r--r--modules/luci-mod-network/luasrc/view/admin_network/iface_status.htm12
8 files changed, 0 insertions, 813 deletions
diff --git a/modules/luci-base/luasrc/controller/admin/index.lua b/modules/luci-base/luasrc/controller/admin/index.lua
index 928faa14b..0cebfa4f5 100644
--- a/modules/luci-base/luasrc/controller/admin/index.lua
+++ b/modules/luci-base/luasrc/controller/admin/index.lua
@@ -71,27 +71,6 @@ function index()
page.index = true
toplevel_page(page, false, false)
- if nixio.fs.access("/etc/config/dhcp") then
- page = entry({"admin", "dhcplease_status"}, call("lease_status"), nil)
- page.leaf = true
- end
-
- local has_wifi = false
-
- uci:foreach("wireless", "wifi-device",
- function(s)
- has_wifi = true
- return false
- end)
-
- if has_wifi then
- page = entry({"admin", "wireless_assoclist"}, call("wifi_assoclist"), nil)
- page.leaf = true
-
- page = entry({"admin", "wireless_deauth"}, post("wifi_deauth"), nil)
- page.leaf = true
- end
-
page = entry({"admin", "translations"}, call("action_translations"), nil)
page.leaf = true
@@ -282,36 +261,3 @@ function action_ubus()
luci.http.prepare_content("application/json")
luci.http.write_json(response)
end
-
-function lease_status()
- local s = require "luci.tools.status"
-
- luci.http.prepare_content("application/json")
- luci.http.write('[')
- luci.http.write_json(s.dhcp_leases())
- luci.http.write(',')
- luci.http.write_json(s.dhcp6_leases())
- luci.http.write(']')
-end
-
-function wifi_assoclist()
- local s = require "luci.tools.status"
-
- luci.http.prepare_content("application/json")
- luci.http.write_json(s.wifi_assoclist())
-end
-
-function wifi_deauth()
- local iface = luci.http.formvalue("iface")
- local bssid = luci.http.formvalue("bssid")
-
- if iface and bssid then
- luci.util.ubus("hostapd.%s" % iface, "del_client", {
- addr = bssid,
- deauth = true,
- reason = 5,
- ban_time = 60000
- })
- end
- luci.http.status(200, "OK")
-end
diff --git a/modules/luci-base/luasrc/tools/status.lua b/modules/luci-base/luasrc/tools/status.lua
deleted file mode 100644
index dc30c064c..000000000
--- a/modules/luci-base/luasrc/tools/status.lua
+++ /dev/null
@@ -1,250 +0,0 @@
--- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
--- Licensed to the public under the Apache License 2.0.
-
-module("luci.tools.status", package.seeall)
-
-local uci = require "luci.model.uci".cursor()
-local ipc = require "luci.ip"
-
-local function dhcp_leases_common(family)
- local rv = { }
- local nfs = require "nixio.fs"
- local sys = require "luci.sys"
- local leasefile = "/tmp/dhcp.leases"
-
- uci:foreach("dhcp", "dnsmasq",
- function(s)
- if s.leasefile and nfs.access(s.leasefile) then
- leasefile = s.leasefile
- return false
- end
- end)
-
- local fd = io.open(leasefile, "r")
- if fd then
- while true do
- local ln = fd:read("*l")
- if not ln then
- break
- else
- local ts, mac, ip, name, duid = ln:match("^(%d+) (%S+) (%S+) (%S+) (%S+)")
- local expire = tonumber(ts) or 0
- if ts and mac and ip and name and duid then
- if family == 4 and not ip:match(":") then
- rv[#rv+1] = {
- expires = (expire ~= 0) and os.difftime(expire, os.time()),
- macaddr = ipc.checkmac(mac) or "00:00:00:00:00:00",
- ipaddr = ip,
- hostname = (name ~= "*") and name
- }
- elseif family == 6 and ip:match(":") then
- rv[#rv+1] = {
- expires = (expire ~= 0) and os.difftime(expire, os.time()),
- ip6addr = ip,
- duid = (duid ~= "*") and duid,
- hostname = (name ~= "*") and name
- }
- end
- end
- end
- end
- fd:close()
- end
-
- local lease6file = "/tmp/hosts/odhcpd"
- uci:foreach("dhcp", "odhcpd",
- function(t)
- if t.leasefile and nfs.access(t.leasefile) then
- lease6file = t.leasefile
- return false
- end
- end)
- local fd = io.open(lease6file, "r")
- if fd then
- while true do
- local ln = fd:read("*l")
- if not ln then
- break
- else
- local iface, duid, iaid, name, ts, id, length, ip = ln:match("^# (%S+) (%S+) (%S+) (%S+) (-?%d+) (%S+) (%S+) (.*)")
- local expire = tonumber(ts) or 0
- if ip and iaid ~= "ipv4" and family == 6 then
- rv[#rv+1] = {
- expires = (expire >= 0) and os.difftime(expire, os.time()),
- duid = duid,
- ip6addr = ip,
- hostname = (name ~= "-") and name
- }
- elseif ip and iaid == "ipv4" and family == 4 then
- rv[#rv+1] = {
- expires = (expire >= 0) and os.difftime(expire, os.time()),
- macaddr = sys.net.duid_to_mac(duid) or "00:00:00:00:00:00",
- ipaddr = ip,
- hostname = (name ~= "-") and name
- }
- end
- end
- end
- fd:close()
- end
-
- if family == 6 then
- local _, lease
- local hosts = sys.net.host_hints()
- for _, lease in ipairs(rv) do
- local mac = sys.net.duid_to_mac(lease.duid)
- local host = mac and hosts[mac]
- if host then
- if not lease.name then
- lease.host_hint = host.name or host.ipv4 or host.ipv6
- elseif host.name and lease.hostname ~= host.name then
- lease.host_hint = host.name
- end
- end
- end
- end
-
- return rv
-end
-
-function dhcp_leases()
- return dhcp_leases_common(4)
-end
-
-function dhcp6_leases()
- return dhcp_leases_common(6)
-end
-
-function wifi_networks()
- local rv = { }
- local ntm = require "luci.model.network".init()
-
- local dev
- for _, dev in ipairs(ntm:get_wifidevs()) do
- local rd = {
- up = dev:is_up(),
- device = dev:name(),
- name = dev:get_i18n(),
- networks = { }
- }
-
- local net
- for _, net in ipairs(dev:get_wifinets()) do
- local a, an = nil, 0
- for _, a in pairs(net:assoclist() or {}) do
- an = an + 1
- end
-
- rd.networks[#rd.networks+1] = {
- name = net:shortname(),
- link = net:adminlink(),
- up = net:is_up(),
- mode = net:active_mode(),
- ssid = net:active_ssid(),
- bssid = net:active_bssid(),
- encryption = net:active_encryption(),
- frequency = net:frequency(),
- channel = net:channel(),
- signal = net:signal(),
- quality = net:signal_percent(),
- noise = net:noise(),
- bitrate = net:bitrate(),
- ifname = net:ifname(),
- country = net:country(),
- txpower = net:txpower(),
- txpoweroff = net:txpower_offset(),
- num_assoc = an,
- disabled = (dev:get("disabled") == "1" or
- net:get("disabled") == "1")
- }
- end
-
- rv[#rv+1] = rd
- end
-
- return rv
-end
-
-function wifi_network(id)
- local ntm = require "luci.model.network".init()
- local net = ntm:get_wifinet(id)
- if net then
- local dev = net:get_device()
- if dev then
- return {
- id = id,
- name = net:shortname(),
- link = net:adminlink(),
- up = net:is_up(),
- mode = net:active_mode(),
- ssid = net:active_ssid(),
- bssid = net:active_bssid(),
- encryption = net:active_encryption(),
- frequency = net:frequency(),
- channel = net:channel(),
- signal = net:signal(),
- quality = net:signal_percent(),
- noise = net:noise(),
- bitrate = net:bitrate(),
- ifname = net:ifname(),
- country = net:country(),
- txpower = net:txpower(),
- txpoweroff = net:txpower_offset(),
- disabled = (dev:get("disabled") == "1" or
- net:get("disabled") == "1"),
- device = {
- up = dev:is_up(),
- device = dev:name(),
- name = dev:get_i18n()
- }
- }
- end
- end
- return { }
-end
-
-function wifi_assoclist()
- local sys = require "luci.sys"
- local ntm = require "luci.model.network".init()
- local hosts = sys.net.host_hints()
-
- local assoc = {}
- local _, dev, net, bss
-
- for _, dev in ipairs(ntm:get_wifidevs()) do
- local radioname = dev:get_i18n()
-
- for _, net in ipairs(dev:get_wifinets()) do
- local netname = net:shortname()
- local netlink = net:adminlink()
- local ifname = net:ifname()
-
- for _, bss in pairs(net:assoclist() or {}) do
- local host = hosts[_]
-
- bss.bssid = _
- bss.ifname = ifname
- bss.radio = radioname
- bss.name = netname
- bss.link = netlink
-
- bss.host_name = (host) and (host.name or host.ipv4 or host.ipv6)
- bss.host_hint = (host and host.name and (host.ipv4 or host.ipv6)) and (host.ipv4 or host.ipv6)
-
- assoc[#assoc+1] = bss
- end
- end
- end
-
- table.sort(assoc, function(a, b)
- if a.radio ~= b.radio then
- return a.radio < b.radio
- elseif a.ifname ~= b.ifname then
- return a.ifname < b.ifname
- else
- return a.bssid < b.bssid
- end
- end)
-
- return assoc
-end
diff --git a/modules/luci-base/luasrc/view/lease_status.htm b/modules/luci-base/luasrc/view/lease_status.htm
deleted file mode 100644
index bbaf5986b..000000000
--- a/modules/luci-base/luasrc/view/lease_status.htm
+++ /dev/null
@@ -1,102 +0,0 @@
-<script type="text/javascript">//<![CDATA[
- XHR.poll(-1, '<%=url('admin/dhcplease_status')%>', null,
- function(x, st)
- {
- var tb = document.getElementById('lease_status_table');
- if (st && st[0] && tb)
- {
- var rows = [];
-
- for (var i = 0; i < st[0].length; i++)
- {
- var timestr;
-
- if (st[0][i].expires === false)
- timestr = '<em><%:unlimited%></em>';
- else if (st[0][i].expires <= 0)
- timestr = '<em><%:expired%></em>';
- else
- timestr = String.format('%t', st[0][i].expires);
-
- rows.push([
- st[0][i].hostname || '?',
- st[0][i].ipaddr,
- st[0][i].macaddr,
- timestr
- ]);
- }
-
- cbi_update_table(tb, rows, '<em><%:There are no active leases.%></em>');
- }
-
- var tb6 = document.getElementById('lease6_status_table');
- if (st && st[1] && tb6)
- {
- tb6.parentNode.style.display = 'block';
-
- var rows = [];
-
- for (var i = 0; i < st[1].length; i++)
- {
- var timestr;
-
- if (st[1][i].expires === false)
- timestr = '<em><%:unlimited%></em>';
- else if (st[1][i].expires <= 0)
- timestr = '<em><%:expired%></em>';
- else
- timestr = String.format('%t', st[1][i].expires);
-
- var name = st[1][i].hostname,
- hint = st[1][i].host_hint;
-
- rows.push([
- hint ? '%h (%h)'.format(name || '?', hint) : (name || '?'),
- st[1][i].ip6addr,
- st[1][i].duid,
- timestr
- ]);
- }
-
- cbi_update_table(tb6, rows, '<em><%:There are no active leases.%></em>');
- }
- }
- );
-//]]></script>
-
-<div class="cbi-section">
- <h3><%:Active DHCP Leases%></h3>
- <div class="table" id="lease_status_table">
- <div class="tr table-titles">
- <div class="th"><%:Hostname%></div>
- <div class="th"><%:IPv4-Address%></div>
- <div class="th"><%:MAC-Address%></div>
- <div class="th"><%:Leasetime remaining%></div>
- </div>
- <div class="tr placeholder">
- <div class="td"><em><%:Collecting data...%></em></div>
- </div>
- </div>
-</div>
-
-<%
- local fs = require "nixio.fs"
- local has_ipv6 = fs.access("/proc/net/ipv6_route")
-
- if has_ipv6 then
--%>
- <div class="cbi-section" style="display:none">
- <h3><%:Active DHCPv6 Leases%></h3>
- <div class="table" id="lease6_status_table">
- <div class="tr table-titles">
- <div class="th"><%:Host%></div>
- <div class="th"><%:IPv6-Address%></div>
- <div class="th"><%:DUID%></div>
- <div class="th"><%:Leasetime remaining%></div>
- </div>
- <div class="tr placeholder">
- <div class="td"><em><%:Collecting data...%></em></div>
- </div>
- </div>
- </div>
-<% end -%>
diff --git a/modules/luci-base/luasrc/view/wifi_assoclist.htm b/modules/luci-base/luasrc/view/wifi_assoclist.htm
deleted file mode 100644
index f6f66fbbc..000000000
--- a/modules/luci-base/luasrc/view/wifi_assoclist.htm
+++ /dev/null
@@ -1,120 +0,0 @@
-<%
- local supports_deauth = {}
-
- local _, v
- for _, v in ipairs(luci.util.ubus()) do
- local iface = v:match("^hostapd%.(.+)$")
- if iface then
- local funcs = luci.util.ubus(v)
- if type(funcs) == "table" and funcs.del_client then
- supports_deauth[iface] = true
- end
- end
- end
-%>
-
-<script type="text/javascript">//<![CDATA[
- var supports_deauth = <%= luci.http.write_json(supports_deauth) %>;
-
- function wifirate(bss, rx) {
- var p = rx ? 'rx_' : 'tx_',
- s = '%.1f <%:Mbit/s%>, %d<%:MHz%>'
- .format(bss[p+'rate'] / 1000, bss[p+'mhz']),
- ht = bss[p+'ht'], vht = bss[p+'vht'],
- mhz = bss[p+'mhz'], nss = bss[p+'nss'],
- mcs = bss[p+'mcs'], sgi = bss[p+'short_gi'];
-
- if (ht || vht) {
- if (vht) s += ', VHT-MCS %d'.format(mcs);
- if (nss) s += ', VHT-NSS %d'.format(nss);
- if (ht) s += ', MCS %s'.format(mcs);
- if (sgi) s += ', <%:Short GI%>';
- }
-
- return s;
- }
-
- function handleDeauth(ev) {
- (new XHR()).post('<%=url('admin/wireless_deauth')%>', {
- token: '<%=token%>',
- iface: ev.target.getAttribute('data-iface'),
- bssid: ev.target.getAttribute('data-bssid')
- }, function() {
- ev.target.disabled = true;
- });
- }
-
- XHR.poll(-1, '<%=url('admin/wireless_assoclist')%>', null,
- function(x, st)
- {
- var tb = document.getElementById('wifi_assoclist_table');
- if (st && tb)
- {
- var rows = [];
-
- st.forEach(function(bss) {
- var icon;
- var q = (-1 * (bss.noise - bss.signal)) / 5;
- if (q < 1)
- icon = "<%=resource%>/icons/signal-0.png";
- else if (q < 2)
- icon = "<%=resource%>/icons/signal-0-25.png";
- else if (q < 3)
- icon = "<%=resource%>/icons/signal-25-50.png";
- else if (q < 4)
- icon = "<%=resource%>/icons/signal-50-75.png";
- else
- icon = "<%=resource%>/icons/signal-75-100.png";
-
- rows.push([
- '<span class="ifacebadge" title="%q"><img src="<%=resource%>/icons/wifi.png" /> <a href="%s">%h</a><small>&#160;(%h)</small></span>'.format(
- bss.radio,
- bss.link,
- bss.name,
- bss.ifname),
- bss.bssid,
- bss.host_hint ? '%h (%h)'.format(bss.host_name || '?', bss.host_hint) : (bss.host_name || '?'),
- '<span class="ifacebadge" title="<%:Signal%>: %d <%:dBm%> / <%:Noise%>: %d <%:dBm%> / <%:SNR%>: %d"><img src="%s" /> %d / %d <%:dBm%></span>'.format(
- bss.signal,
- bss.noise,
- bss.signal - bss.noise,
- icon,
- bss.signal,
- bss.noise),
- E('span', {}, [
- E('span', wifirate(bss, true)),
- E('br'),
- E('span', wifirate(bss, false))
- ]),
- supports_deauth[bss.ifname] ? E('input', {
- type: 'button',
- class: 'cbi-button cbi-button-remove',
- value: '<%:Disconnect%>',
- 'data-bssid': bss.bssid,
- 'data-iface': bss.ifname,
- click: handleDeauth
- }) : '-'
- ]);
- });
-
- cbi_update_table(tb, rows, '<em><%:No information available%></em>');
- }
- }
- );
-//]]></script>
-
-<div class="table" id="wifi_assoclist_table">
- <div class="tr table-titles">
- <div class="th nowrap"><%:Network%></div>
- <div class="th hide-xs"><%:MAC-Address%></div>
- <div class="th nowrap"><%:Host%></div>
- <div class="th nowrap"><%:Signal%> / <%:Noise%></div>
- <div class="th nowrap"><%:RX Rate%> / <%:TX Rate%></div>
- <% if next(supports_deauth) then %>
- <div class="th right"><%:Disconnect%></div>
- <% end %>
- </div>
- <div class="tr placeholder">
- <div class="td"><em><%:Collecting data...%></em></div>
- </div>
-</div>
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js
deleted file mode 100644
index 88f48d189..000000000
--- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/iface_status.js
+++ /dev/null
@@ -1,42 +0,0 @@
-requestAnimationFrame(function() {
- document.querySelectorAll('[data-iface-status]').forEach(function(container) {
- var network = container.getAttribute('data-iface-status'),
- icon = container.querySelector('img'),
- info = container.querySelector('span');
-
- L.poll(5, L.url('admin/network/iface_status', network), null, function(xhr, ifaces) {
- var ifc = Array.isArray(ifaces) ? ifaces[0] : null;
- if (!ifc)
- return;
-
- L.itemlist(info, [
- _('Device'), ifc.ifname,
- _('Uptime'), ifc.is_up ? '%t'.format(ifc.uptime) : null,
- _('MAC'), ifc.ifname ? ifc.macaddr : null,
- _('RX'), ifc.ifname ? '%.2mB (%d %s)'.format(ifc.rx_bytes, ifc.rx_packets, _('Pkts.')) : null,
- _('TX'), ifc.ifname ? '%.2mB (%d %s)'.format(ifc.tx_bytes, ifc.tx_packets, _('Pkts.')) : null,
- _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[0] : null,
- _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[1] : null,
- _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[2] : null,
- _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[3] : null,
- _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[4] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[0] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[1] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[2] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[3] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[4] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[5] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[6] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[7] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[8] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[9] : null,
- _('IPv6-PD'), ifc.ip6prefix,
- null, ifc.ifname ? null : E('em', _('Interface not present or not connected yet.'))
- ]);
-
- icon.src = L.resource('icons/%s%s.png').format(ifc.type, ifc.is_up ? '' : '_disabled');
- });
-
- L.run();
- });
-});
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/network.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/network.js
deleted file mode 100644
index bab23cc3c..000000000
--- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/network.js
+++ /dev/null
@@ -1,136 +0,0 @@
-function iface_reconnect(id) {
- L.halt();
- L.dom.content(document.getElementById(id + '-ifc-description'), E('em', _('Interface is reconnecting...')));
- L.post(L.url('admin/network/iface_reconnect', id), null, L.run);
-}
-
-function iface_delete(ev) {
- if (!confirm(_('Really delete this interface? The deletion cannot be undone! You might lose access to this device if you are connected via this interface'))) {
- ev.preventDefault();
- return false;
- }
-
- ev.target.previousElementSibling.value = '1';
- return true;
-}
-
-var networks = [];
-
-document.querySelectorAll('[data-network]').forEach(function(n) {
- networks.push(n.getAttribute('data-network'));
-});
-
-function render_iface(ifc) {
- return E('span', { class: 'cbi-tooltip-container' }, [
- E('img', { 'class' : 'middle', 'src': L.resource('icons/%s%s.png').format(
- ifc.is_alias ? 'alias' : ifc.type,
- ifc.is_up ? '' : '_disabled') }),
- E('span', { 'class': 'cbi-tooltip ifacebadge large' }, [
- E('img', { 'src': L.resource('icons/%s%s.png').format(
- ifc.type, ifc.is_up ? '' : '_disabled') }),
- L.itemlist(E('span', { 'class': 'left' }), [
- _('Type'), ifc.typename,
- _('Device'), ifc.ifname,
- _('Connected'), ifc.is_up ? _('yes') : _('no'),
- _('MAC'), ifc.macaddr,
- _('RX'), '%.2mB (%d %s)'.format(ifc.rx_bytes, ifc.rx_packets, _('Pkts.')),
- _('TX'), '%.2mB (%d %s)'.format(ifc.tx_bytes, ifc.tx_packets, _('Pkts.'))
- ])
- ])
- ]);
-}
-
-L.poll(5, L.url('admin/network/iface_status', networks.join(',')), null,
- function(x, ifcs) {
- if (ifcs) {
- for (var idx = 0; idx < ifcs.length; idx++) {
- var ifc = ifcs[idx];
-
- var s = document.getElementById(ifc.id + '-ifc-devices');
- if (s) {
- var c = [ render_iface(ifc) ];
-
- if (ifc.subdevices && ifc.subdevices.length)
- {
- var sifs = [ ' (' ];
-
- for (var j = 0; j < ifc.subdevices.length; j++)
- sifs.push(render_iface(ifc.subdevices[j]));
-
- sifs.push(')');
-
- c.push(E('span', {}, sifs));
- }
-
- c.push(E('br'));
- c.push(E('small', {}, ifc.is_alias ? _('Alias of "%s"').format(ifc.is_alias) : ifc.name));
-
- L.dom.content(s, c);
- }
-
- var d = document.getElementById(ifc.id + '-ifc-description');
- if (d && ifc.proto && ifc.ifname) {
- var desc = null, c = [];
-
- if (ifc.is_dynamic)
- desc = _('Virtual dynamic interface');
- else if (ifc.is_alias)
- desc = _('Alias Interface');
-
- if (ifc.desc)
- desc = desc ? '%s (%s)'.format(desc, ifc.desc) : ifc.desc;
-
- L.itemlist(d, [
- _('Protocol'), desc || '?',
- _('Uptime'), ifc.is_up ? '%t'.format(ifc.uptime) : null,
- _('MAC'), (!ifc.is_dynamic && !ifc.is_alias && ifc.macaddr) ? ifc.macaddr : null,
- _('RX'), (!ifc.is_dynamic && !ifc.is_alias) ? '%.2mB (%d %s)'.format(ifc.rx_bytes, ifc.rx_packets, _('Pkts.')) : null,
- _('TX'), (!ifc.is_dynamic && !ifc.is_alias) ? '%.2mB (%d %s)'.format(ifc.tx_bytes, ifc.tx_packets, _('Pkts.')) : null,
- _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[0] : null,
- _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[1] : null,
- _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[2] : null,
- _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[3] : null,
- _('IPv4'), ifc.ipaddrs ? ifc.ipaddrs[4] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[0] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[1] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[2] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[3] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[4] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[5] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[6] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[7] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[8] : null,
- _('IPv6'), ifc.ip6addrs ? ifc.ip6addrs[9] : null,
- _('IPv6-PD'), ifc.ip6prefix,
- _('Information'), ifc.is_auto ? null : _('Not started on boot'),
- _('Error'), ifc.errors ? ifc.errors[0] : null,
- _('Error'), ifc.errors ? ifc.errors[1] : null,
- _('Error'), ifc.errors ? ifc.errors[2] : null,
- _('Error'), ifc.errors ? ifc.errors[3] : null,
- _('Error'), ifc.errors ? ifc.errors[4] : null,
- ]);
- }
- else if (d && !ifc.proto) {
- var e = document.getElementById(ifc.id + '-ifc-edit');
- if (e) e.disabled = true;
-
- var link = L.url('admin/system/opkg') + '?query=luci-proto';
- L.dom.content(d, [
- E('em', _('Unsupported protocol type.')), E('br'),
- E('a', { href: link }, _('Install protocol extensions...'))
- ]);
- }
- else if (d && !ifc.ifname) {
- var link = L.url('admin/network/network', ifc.name) + '?tab.network.%s=physical'.format(ifc.name);
- L.dom.content(d, [
- E('em', _('Network without interfaces.')), E('br'),
- E('a', { href: link }, _('Assign interfaces...'))
- ]);
- }
- else if (d) {
- L.dom.content(d, E('em' ,_('Interface not present or not connected yet.')));
- }
- }
- }
- }
-);
diff --git a/modules/luci-mod-network/luasrc/controller/admin/network.lua b/modules/luci-mod-network/luasrc/controller/admin/network.lua
index f8623be93..662fe8cf8 100644
--- a/modules/luci-mod-network/luasrc/controller/admin/network.lua
+++ b/modules/luci-mod-network/luasrc/controller/admin/network.lua
@@ -31,9 +31,6 @@ function index()
end)
if has_wifi then
- page = entry({"admin", "network", "wireless_status"}, call("wifi_status"), nil)
- page.leaf = true
-
page = entry({"admin", "network", "wireless_reconnect"}, post("wifi_reconnect"), nil)
page.leaf = true
@@ -42,9 +39,6 @@ function index()
end
- page = entry({"admin", "network", "iface_status"}, call("iface_status"), nil)
- page.leaf = true
-
page = entry({"admin", "network", "iface_reconnect"}, post("iface_reconnect"), nil)
page.leaf = true
@@ -95,77 +89,6 @@ function index()
-- end
end
-function iface_status(ifaces)
- local netm = require "luci.model.network".init()
- local rv = { }
-
- local iface
- for iface in ifaces:gmatch("[%w%.%-_]+") do
- local net = netm:get_network(iface)
- local device = net and net:get_interface()
- if device then
- local data = {
- id = iface,
- desc = net:get_i18n(),
- proto = net:proto(),
- uptime = net:uptime(),
- gwaddr = net:gwaddr(),
- ipaddrs = net:ipaddrs(),
- ip6addrs = net:ip6addrs(),
- dnsaddrs = net:dnsaddrs(),
- ip6prefix = net:ip6prefix(),
- errors = net:errors(),
- name = device:shortname(),
- type = device:type(),
- typename = device:get_type_i18n(),
- ifname = device:name(),
- macaddr = device:mac(),
- is_up = net:is_up() and device:is_up(),
- is_alias = net:is_alias(),
- is_dynamic = net:is_dynamic(),
- is_auto = net:is_auto(),
- rx_bytes = device:rx_bytes(),
- tx_bytes = device:tx_bytes(),
- rx_packets = device:rx_packets(),
- tx_packets = device:tx_packets(),
-
- subdevices = { }
- }
-
- for _, device in ipairs(net:get_interfaces() or {}) do
- data.subdevices[#data.subdevices+1] = {
- name = device:shortname(),
- type = device:type(),
- typename = device:get_type_i18n(),
- ifname = device:name(),
- macaddr = device:mac(),
- is_up = device:is_up(),
- rx_bytes = device:rx_bytes(),
- tx_bytes = device:tx_bytes(),
- rx_packets = device:rx_packets(),
- tx_packets = device:tx_packets(),
- }
- end
-
- rv[#rv+1] = data
- else
- rv[#rv+1] = {
- id = iface,
- name = iface,
- type = "ethernet"
- }
- end
- end
-
- if #rv > 0 then
- luci.http.prepare_content("application/json")
- luci.http.write_json(rv)
- return
- end
-
- luci.http.status(404, "No such device")
-end
-
function iface_reconnect(iface)
local netmd = require "luci.model.network".init()
local net = netmd:get_network(iface)
@@ -235,26 +158,6 @@ function iface_down(iface, force)
luci.http.status(404, "No such interface")
end
-function wifi_status(devs)
- local s = require "luci.tools.status"
- local rv = { }
-
- if type(devs) == "string" then
- local dev
- for dev in devs:gmatch("[%w%.%-]+") do
- rv[#rv+1] = s.wifi_network(dev)
- end
- end
-
- if #rv > 0 then
- luci.http.prepare_content("application/json")
- luci.http.write_json(rv)
- return
- end
-
- luci.http.status(404, "No such device")
-end
-
function wifi_reconnect(radio)
local rc = luci.sys.call("env -i /sbin/wifi up %s >/dev/null" % luci.util.shellquote(radio))
diff --git a/modules/luci-mod-network/luasrc/view/admin_network/iface_status.htm b/modules/luci-mod-network/luasrc/view/admin_network/iface_status.htm
deleted file mode 100644
index a75b2755c..000000000
--- a/modules/luci-mod-network/luasrc/view/admin_network/iface_status.htm
+++ /dev/null
@@ -1,12 +0,0 @@
-<%+cbi/valueheader%>
-
-<span class="ifacebadge large"<%=attr("data-iface-status", self.network)%>>
- <img src="<%=resource%>/icons/ethernet_disabled.png" />
- <span>
- <em class="spinning"><%:Collecting data...%></em>
- </span>
-</span>
-
-<script type="text/javascript" src="<%=resource%>/view/network/iface_status.js"></script>
-
-<%+cbi/valuefooter%>