aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2019-04-04 15:27:55 +0200
committerGravatar Christian Hesse <mail@eworm.de>2019-04-04 22:37:13 +0200
commit50279efbdbba484428dec1c030e066d460433344 (patch)
treebd9fe3d129df83dbdc6da3e2ded241840c5238c5
parent228ec7106bd22e4ccca32e1b35ef2f7b70fddf57 (diff)
ipv6-update: fix with prefix containing section(s) of zeros
-rw-r--r--ipv6-update9
1 files changed, 6 insertions, 3 deletions
diff --git a/ipv6-update b/ipv6-update
index f8ad3c1..1b52efc 100644
--- a/ipv6-update
+++ b/ipv6-update
@@ -23,14 +23,17 @@ if ($OldPrefix != $PdPrefix) do={
:local Suffix [ :pick ($Comment->2) 7 99 ];
:local Prefix [ / ipv6 address get [ find where interface=$IntName from-pool=$Pool global ] address ];
- :local Prefix64 [ :pick $Prefix 0 [ :find $Prefix "::/64" ] ];
+ :set Prefix [ :pick $Prefix 0 [ :find $Prefix "::/64" ] ];
+ :if ($Prefix~"^[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:") do={ } else={
+ :set Prefix ($Prefix . ":");
+ }
:local Name [ / ip dns static get $Record name ];
:if ([ :len $Name ] = 0) do={
:set Name [ / ip dns static get $Record regex ];
}
- :log info ("Updating DNS record for " . $Name . " to " . $Prefix64 . ":" . $Suffix);
- / ip dns static set address=($Prefix64 . ":" . $Suffix) $Record;
+ :log info ("Updating DNS record for " . $Name . " to " . $Prefix . ":" . $Suffix);
+ / ip dns static set address=($Prefix . ":" . $Suffix) $Record;
}
}