mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
ipv6-update: get values into array
... and concatenate name and regexp - just either of both is set.
This commit is contained in:
parent
f559c4ac92
commit
8c8d7f93f1
1 changed files with 4 additions and 7 deletions
11
ipv6-update
11
ipv6-update
|
@ -25,7 +25,8 @@ if ($OldPrefix != $PdPrefix) do={
|
|||
/ ipv6 firewall address-list set address=$PdPrefix $AddrList;
|
||||
|
||||
:foreach Record in=[ / ip dns static find where comment~("^ipv6-pool-" . $Pool . ",") ] do={
|
||||
:local Comment [ $ParseKeyValueStore [ / ip dns static get $Record comment ] ];
|
||||
:local RecordVal [ / ip dns static get $Record ];
|
||||
: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" ] ];
|
||||
|
@ -33,12 +34,8 @@ if ($OldPrefix != $PdPrefix) do={
|
|||
: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 " . $Prefix . ":" . ($Comment->"suffix"));
|
||||
:log info ("Updating DNS record for " . ($RecordVal->"name") . ($RecordVal->"regexp") . \
|
||||
" to " . $Prefix . ":" . ($Comment->"suffix"));
|
||||
/ ip dns static set address=($Prefix . ":" . ($Comment->"suffix")) $Record;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue