mirror of
https://github.com/openwrt/luci.git
synced 2026-04-15 19:01:56 +00:00
luci-base: network.js: de-dup ifc IPv6 addresses
De-dup IPv6 addresses before getIP6Addrs() returns an array from "ipv6-address" and "ipv6-prefix-assignment" ubus data. This can happen when the local address derived from a delegated prefix matches an explicitly configured IPv6 address. Use a Set to ensure that duplicate entries are filtered out before returning the address list. Signed-off-by: Konstantin Glukhov <KGlukhov@Hotmail.com>
This commit is contained in:
committed by
Paul Donald
parent
c923488dda
commit
e839b9d18d
@@ -2322,21 +2322,21 @@ Protocol = baseclass.extend(/** @lends LuCI.network.Protocol.prototype */ {
|
||||
*/
|
||||
getIP6Addrs() {
|
||||
let addrs = this._ubus('ipv6-address');
|
||||
const rv = [];
|
||||
const rv = new Set();
|
||||
|
||||
if (Array.isArray(addrs))
|
||||
for (let a of addrs)
|
||||
if (L.isObject(a))
|
||||
rv.push('%s/%d'.format(a.address, a.mask));
|
||||
rv.add('%s/%d'.format(a.address, a.mask));
|
||||
|
||||
addrs = this._ubus('ipv6-prefix-assignment');
|
||||
|
||||
if (Array.isArray(addrs))
|
||||
for (let a of addrs)
|
||||
if (L.isObject(a) && L.isObject(a['local-address']))
|
||||
rv.push('%s/%d'.format(a['local-address'].address, a['local-address'].mask));
|
||||
rv.add('%s/%d'.format(a['local-address'].address, a['local-address'].mask));
|
||||
|
||||
return rv;
|
||||
return Array.from(rv);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user