Skip to content

Commit c5ae3fe

Browse files
Fix mkReverseRecord for ::1 and 1:: being twice as long
1 parent a319670 commit c5ae3fe

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

dns/util/default.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ let
3737
# Returns the record of the ipv6 as a list
3838
mkRecordAux = v6:
3939
let
40-
splitted = lib.splitString ":" v6;
40+
v6' = if lib.hasPrefix "::" v6 then
41+
"0${v6}"
42+
else if lib.hasSuffix "::" v6 then
43+
"${v6}0"
44+
else
45+
v6;
46+
splitted = lib.splitString ":" v6';
4147
n = 8 - builtins.length (lib.filter (x: x != "") splitted);
4248
in
4349
lib.stringToCharacters (lib.concatMapStrings (align4BytesOrExpand n) splitted);

0 commit comments

Comments
 (0)