aboutsummaryrefslogtreecommitdiffstats
path: root/ipv6-update
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-02-09 22:36:40 +0100
committerGravatar Christian Hesse <mail@eworm.de>2023-02-09 22:43:09 +0100
commita34d5d71417d0720e9695b2bfa8657f3734de3b6 (patch)
tree3055605bf98c00ee960294dc1ff8e96298c29436 /ipv6-update
parent769edbcf61a31e0664c43dcf7c8301ed89bed01a (diff)
ipv6-update: accept a single prefix only
Diffstat (limited to 'ipv6-update')
-rw-r--r--ipv6-update15
1 files changed, 9 insertions, 6 deletions
diff --git a/ipv6-update b/ipv6-update
index 13660c4..dd22538 100644
--- a/ipv6-update
+++ b/ipv6-update
@@ -51,12 +51,15 @@
:local RecordVal [ /ip/dns/static/get $Record ];
:local Comment [ $ParseKeyValueStore ($RecordVal->"comment") ];
- :local Prefix [ /ipv6/address/get [ find where from-pool=$Pool interface=($Comment->"interface") global ] address ];
- :set Prefix ([ :toip6 [ :pick $Prefix 0 [ :find $Prefix "/64" ] ] ] & ffff:ffff:ffff:ffff::);
- :local Address ($Prefix | ([ :toip6 ($RecordVal->"address") ] & ::ffff:ffff:ffff:ffff));
+ :local Prefix [ /ipv6/address/find where from-pool=$Pool interface=($Comment->"interface") global ];
+ :if ([ :len $Prefix ] = 1) do={
+ :set Prefix [ /ipv6/address/get $Prefix address ];
+ :set Prefix ([ :toip6 [ :pick $Prefix 0 [ :find $Prefix "/64" ] ] ] & ffff:ffff:ffff:ffff::);
+ :local Address ($Prefix | ([ :toip6 ($RecordVal->"address") ] & ::ffff:ffff:ffff:ffff));
- $LogPrintExit2 info $0 ("Updating DNS record for " . ($RecordVal->"name") . \
- ($RecordVal->"regexp") . " to " . $Address) false;
- /ip/dns/static/set address=$Address $Record;
+ $LogPrintExit2 info $0 ("Updating DNS record for " . ($RecordVal->"name") . \
+ ($RecordVal->"regexp") . " to " . $Address) false;
+ /ip/dns/static/set address=$Address $Record;
+ }
}
}