From a8a76978298ba1cfddadbb48da73fa2abde82692 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 6 Nov 2019 13:22:10 +0100 Subject: luci-base: network.js: prevent duplicate wan interface reporting Fixes: #3269 Signed-off-by: Jo-Philipp Wich --- .../htdocs/luci-static/resources/network.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'modules/luci-base/htdocs/luci-static/resources') diff --git a/modules/luci-base/htdocs/luci-static/resources/network.js b/modules/luci-base/htdocs/luci-static/resources/network.js index 7c5d2b9743..b29a100e96 100644 --- a/modules/luci-base/htdocs/luci-static/resources/network.js +++ b/modules/luci-base/htdocs/luci-static/resources/network.js @@ -1471,10 +1471,14 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { */ getWANNetworks: function() { return this.getStatusByRoute('0.0.0.0', 0).then(L.bind(function(statuses) { - var rv = []; + var rv = [], seen = {}; - for (var i = 0; i < statuses.length; i++) - rv.push(this.instantiateNetwork(statuses[i].interface, statuses[i].proto)); + for (var i = 0; i < statuses.length; i++) { + if (!seen.hasOwnProperty(statuses[i].interface)) { + rv.push(this.instantiateNetwork(statuses[i].interface, statuses[i].proto)); + seen[statuses[i].interface] = true; + } + } return rv; }, this)); @@ -1492,10 +1496,14 @@ Network = L.Class.extend(/** @lends LuCI.Network.prototype */ { */ getWAN6Networks: function() { return this.getStatusByRoute('::', 0).then(L.bind(function(statuses) { - var rv = []; + var rv = [], seen = {}; - for (var i = 0; i < statuses.length; i++) - rv.push(this.instantiateNetwork(statuses[i].interface, statuses[i].proto)); + for (var i = 0; i < statuses.length; i++) { + if (!seen.hasOwnProperty(statuses[i].interface)) { + rv.push(this.instantiateNetwork(statuses[i].interface, statuses[i].proto)); + seen[statuses[i].interface] = true; + } + } return rv; }, this)); -- cgit v1.2.3