summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sys/net/options.nix15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/net/options.nix b/sys/net/options.nix
index a0d29d5..2930567 100644
--- a/sys/net/options.nix
+++ b/sys/net/options.nix
@@ -87,9 +87,11 @@ with lib; {
doubleColon = hextets v6config.prefix + hextets config.suffix < 8;
joined =
- if v6config.bits != 0
- then "${v6config.prefix}${separator}${config.suffix}"
- else config.suffix;
+ if v6config.bits == 128
+ then v6config.prefix
+ else if v6config.bits == 0
+ then config.suffix
+ else "${v6config.prefix}${separator}${config.suffix}";
in
joined;
@@ -142,7 +144,7 @@ with lib; {
type = nullOr (submodule ({ config, ... }: {
options = {
bits = mkOption {
- type = addCheck (ints.between 0 64) (b: mod b 4 == 0) // {
+ type = addCheck (ints.between 0 128) (b: mod b 4 == 0) // {
description = "IPv6 subnet bits at nibble boundary";
};
};
@@ -164,7 +166,10 @@ with lib; {
config = {
cidr = "${config.subnet}/${toString config.bits}";
- subnet = "${config.prefix}::";
+ subnet =
+ if config.bits == 128 || length (splitString "::" config.prefix) > 1
+ then config.prefix
+ else "${config.prefix}::";
};
}));
};