From 32e011699156c6132a2a0bc95cbe36d572c571ac Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 14 Dec 2018 20:02:17 +0100 Subject: lib.krebs.genipv6: make net addresses 128 bit long --- lib/krebs/genipv6.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/krebs/genipv6.nix b/lib/krebs/genipv6.nix index af1df6d..b4806e1 100644 --- a/lib/krebs/genipv6.nix +++ b/lib/krebs/genipv6.nix @@ -12,7 +12,7 @@ let { inherit netname; netCIDR = "${netAddress}/${toString netPrefixLength}"; - netAddress = appendZeros netPrefixLength netPrefix; + netAddress = appendZeros addressLength netPrefix; netHash = toString { retiolum = 0; wirelum = 1; @@ -25,7 +25,7 @@ let { inherit subnetname; subnetCIDR = "${subnetAddress}/${toString subnetPrefixLength}"; - subnetAddress = appendZeros subnetPrefixLength subnetPrefix; + subnetAddress = appendZeros addressLength subnetPrefix; subnetHash = hashToLength 4 subnetname; subnetPrefix = joinAddress netPrefix subnetHash; subnetPrefixLength = netPrefixLength + 16; -- cgit v1.2.3 From d287baa0561f69a05930995e8ea1d662a13affee Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 14 Dec 2018 20:03:26 +0100 Subject: lib.krebs.genipv6: normalize net addresses --- lib/krebs/genipv6.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/krebs/genipv6.nix b/lib/krebs/genipv6.nix index b4806e1..1d3f398 100644 --- a/lib/krebs/genipv6.nix +++ b/lib/krebs/genipv6.nix @@ -12,7 +12,8 @@ let { inherit netname; netCIDR = "${netAddress}/${toString netPrefixLength}"; - netAddress = appendZeros addressLength netPrefix; + netAddress = + normalize-ip6-addr (appendZeros addressLength netPrefix); netHash = toString { retiolum = 0; wirelum = 1; @@ -25,7 +26,8 @@ let { inherit subnetname; subnetCIDR = "${subnetAddress}/${toString subnetPrefixLength}"; - subnetAddress = appendZeros addressLength subnetPrefix; + subnetAddress = + normalize-ip6-addr (appendZeros addressLength subnetPrefix); subnetHash = hashToLength 4 subnetname; subnetPrefix = joinAddress netPrefix subnetHash; subnetPrefixLength = netPrefixLength + 16; -- cgit v1.2.3