mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-06-23 18:18:38 +02:00
ipv6-update: calculate address with bitwise operator
Support for bitwise operator was added in RouterOS 6.46beta38.
This commit is contained in:
parent
e37af0065c
commit
bccdb47fde
1 changed files with 4 additions and 7 deletions
11
ipv6-update
11
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 . ":");
|
||||
}
|
||||
: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 " . $Prefix . ":" . ($Comment->"suffix"));
|
||||
/ ip dns static set address=($Prefix . ":" . ($Comment->"suffix")) $Record;
|
||||
:log info ("Updating DNS record for " . ($RecordVal->"name") . ($RecordVal->"regexp") . " to " . $Address);
|
||||
/ ip dns static set address=$Address $Record;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue