diff options
author | Christian Hesse <mail@eworm.de> | 2019-08-29 14:17:34 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2019-12-03 12:07:36 +0100 |
commit | bccdb47fdedf5cccd779fd54766db05dfd1741ab (patch) | |
tree | cdc151a20bb6856027df11e0dc069884cb86da71 /ipv6-update | |
parent | e37af0065c9e52243ea83780c73029b0ec8acf1c (diff) |
ipv6-update: calculate address with bitwise operatorrouteros-6.46beta38
Support for bitwise operator was added in RouterOS 6.46beta38.
Diffstat (limited to 'ipv6-update')
-rw-r--r-- | ipv6-update | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/ipv6-update b/ipv6-update index e21e6bb..86bd827 100644 --- a/ipv6-update +++ b/ipv6-update @@ -29,13 +29,10 @@ if ($OldPrefix != $PdPrefix) do={ :local Comment [ $ParseKeyValueStore ($RecordVal->"comment") ]; :local Prefix [ / ipv6 address get [ find where interface=($Comment->"interface") from-pool=$Pool global ] address ]; - :set Prefix [ :pick $Prefix 0 [ :find $Prefix "::/64" ] ]; - :if ($Prefix~"^[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:") do={ } else={ - :set Prefix ($Prefix . ":"); - } - - :log info ("Updating DNS record for " . ($RecordVal->"name") . ($RecordVal->"regexp") . \ - " to " . $Prefix . ":" . ($Comment->"suffix")); - / ip dns static set address=($Prefix . ":" . ($Comment->"suffix")) $Record; + :set Prefix [ :toip6 [ :pick $Prefix 0 [ :find $Prefix "/64" ] ] ]; + :local Address ($Prefix | ([ :toip6 ($RecordVal->"address") ] & ::ffff:ffff:ffff:ffff)); + + :log info ("Updating DNS record for " . ($RecordVal->"name") . ($RecordVal->"regexp") . " to " . $Address); + / ip dns static set address=$Address $Record; } } |