luci-base: network.js: de-dup ifc IPv6 addresses
authorKonstantin Glukhov <redacted>
Wed, 11 Mar 2026 06:16:30 +0000 (15:16 +0900)
committerPaul Donald <redacted>
Mon, 16 Mar 2026 21:04:55 +0000 (22:04 +0100)
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 <redacted>
modules/luci-base/htdocs/luci-static/resources/network.js

index 67ed3bf522afb00a1e99a439b04225ca6ab16878..4d519b002affc9f5a07649f83b4478d20297cc0f 100644 (file)
@@ -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);
        },
 
        /**
git clone https://git.99rst.org/PROJECT