luci-base: network.js: prevent duplicate wan interface reporting

Fixes: #3269
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit a8a7697829)
This commit is contained in:
Jo-Philipp Wich 2019-11-06 13:22:10 +01:00
parent c0e73d3f95
commit c2be304f50

View file

@ -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));