luci-base: network.js: prevent duplicate wan interface reporting
Fixes: #3269 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
b27b5cfb51
commit
a8a7697829
1 changed files with 14 additions and 6 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue