]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
cli: add cidr6 data type
authorJohn Crispin <john@phrozen.org>
Fri, 6 Feb 2026 06:35:24 +0000 (07:35 +0100)
committerFelix Fietkau <nbd@nbd.name>
Sat, 7 Feb 2026 09:04:18 +0000 (10:04 +0100)
Signed-off-by: John Crispin <john@phrozen.org>
package/utils/cli/files/usr/share/ucode/cli/types.uc

index 62f9683b45dae6a5b7305895a4e52634ab6b4890..39f369f38628fd9d3d8bc05e9a425701a4a2bac7 100644 (file)
@@ -190,6 +190,15 @@ const types = {
                        return;
                }
        },
+       cidr6: {
+               parse: function(ctx, name, val) {
+                       let m = split(val, '/', 2);
+                       if (m && +m[1] <= 128 && length(iptoarr(m[0])) == 16)
+                               return val;
+                       ctx.invalid_argument("value for %s is not cidr6 (e.g. 2001:db8::1/64)", name);
+                       return;
+               }
+       },
 };
 
 return types;