From 12e50de9dbce577b634819f02776c44be3894cd7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Old=C5=99ich=20Jedli=C4=8Dka?= Date: Mon, 5 Oct 2020 22:42:37 +0200 Subject: [PATCH] luci-base: network.js: Show clients also from wifi VLANs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Iterate through VLANs to get the clients connected on configured wifi VLANs (as configured by `wifi-vlan` sections in `wireless` configuration). This is a minimum support for VLANs on wireless network. The VLAN name is nowhere displayed, but at least clients using VLANs are visible. Signed-off-by: Oldřich Jedlička --- .../htdocs/luci-static/resources/network.js | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/network.js b/modules/luci-base/htdocs/luci-static/resources/network.js index 856421cd31..1f749c593c 100644 --- a/modules/luci-base/htdocs/luci-static/resources/network.js +++ b/modules/luci-base/htdocs/luci-static/resources/network.js @@ -3570,6 +3570,24 @@ WifiNetwork = baseclass.extend(/** @lends LuCI.network.WifiNetwork.prototype */ return ifname; }, + /** + * Get the Linux VLAN network device names. + * + * @returns {string[]} + * Returns the current Linux VLAN network device name as resolved + * from `ubus` runtime information or empty array if this network + * has no associated VLAN network devices. + */ + getVlanIfnames: function() { + var vlans = L.toArray(this.ubus('net', 'vlans')), + ifnames = []; + + for (var i = 0; i < vlans.length; i++) + ifnames.push(vlans[i]['ifname']); + + return ifnames; + }, + /** * Get the name of the corresponding wifi radio device. * @@ -3880,7 +3898,15 @@ WifiNetwork = baseclass.extend(/** @lends LuCI.network.WifiNetwork.prototype */ * with this network. */ getAssocList: function() { - return callIwinfoAssoclist(this.getIfname()); + var tasks = []; + var ifnames = [ this.getIfname() ].concat(this.getVlanIfnames()); + + for (var i = 0; i < ifnames.length; i++) + tasks.push(callIwinfoAssoclist(ifnames[i])); + + return Promise.all(tasks).then(function(values) { + return Array.prototype.concat.apply([], values); + }); }, /** -- 2.30.2