base-files: add support for retrieving IPv6 assignments
authorMark Baker <mark@vpost.net>
Thu, 2 Feb 2023 01:30:57 +0000 (20:30 -0500)
committerPaul Spooren <mail@aparcar.org>
Fri, 24 Feb 2023 22:56:36 +0000 (23:56 +0100)
In DHCPv6-PD enabled environments, addresses are assigned to interfaces.
These new functions retrieve the IPv6 assigned prefix(es).

Signed-off-by: Mark Baker <mark@vpost.net>
package/base-files/files/lib/functions/network.sh

index 055f18c11e0c5fd6c8f14bf9128c1f708da2bd9d..4851a5817ada074ee57b3a95a712253c4d34ecf1 100644 (file)
@@ -90,6 +90,13 @@ network_get_prefix6() {
        __network_ifstatus "$1" "$2" "['ipv6-prefix'][0]['address','mask']" "/"
 }
 
+# determine first IPv6 prefix assignment of given logical interface
+# 1: destination variable
+# 2: interface
+network_get_prefix_assignment6() {
+       __network_ifstatus "$1" "$2" "['ipv6-prefix-assignment'][0]['address','mask']" "/"
+}
+
 # determine all IPv4 addresses of given logical interface
 # 1: destination variable
 # 2: interface
@@ -187,6 +194,13 @@ network_get_prefixes6() {
        __network_ifstatus "$1" "$2" "['ipv6-prefix'][*]['address','mask']" "/ "
 }
 
+# determine all IPv6 prefix assignments of given logical interface
+# 1: destination variable
+# 2: interface
+network_get_prefix_assignments6() {
+       __network_ifstatus "$1" "$2" "['ipv6-prefix-assignment'][*]['address','mask']" "/ "
+}
+
 # determine IPv4 gateway of given logical interface
 # 1: destination variable
 # 2: interface