Commit 8c8d7f93 authored by Christian Hesse's avatar Christian Hesse

ipv6-update: get values into array

... and concatenate name and regexp - just either of both is set.
parent f559c4ac
...@@ -25,7 +25,8 @@ if ($OldPrefix != $PdPrefix) do={ ...@@ -25,7 +25,8 @@ if ($OldPrefix != $PdPrefix) do={
/ ipv6 firewall address-list set address=$PdPrefix $AddrList; / ipv6 firewall address-list set address=$PdPrefix $AddrList;
:foreach Record in=[ / ip dns static find where comment~("^ipv6-pool-" . $Pool . ",") ] do={ :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 ]; :local Prefix [ / ipv6 address get [ find where interface=($Comment->"interface") from-pool=$Pool global ] address ];
:set Prefix [ :pick $Prefix 0 [ :find $Prefix "::/64" ] ]; :set Prefix [ :pick $Prefix 0 [ :find $Prefix "::/64" ] ];
...@@ -33,12 +34,8 @@ if ($OldPrefix != $PdPrefix) do={ ...@@ -33,12 +34,8 @@ if ($OldPrefix != $PdPrefix) do={
:set Prefix ($Prefix . ":"); :set Prefix ($Prefix . ":");
} }
:local Name [ / ip dns static get $Record name ]; :log info ("Updating DNS record for " . ($RecordVal->"name") . ($RecordVal->"regexp") . \
:if ([ :len $Name ] = 0) do={ " to " . $Prefix . ":" . ($Comment->"suffix"));
:set Name [ / ip dns static get $Record regex ];
}
:log info ("Updating DNS record for " . $Name . " to " . $Prefix . ":" . ($Comment->"suffix"));
/ ip dns static set address=($Prefix . ":" . ($Comment->"suffix")) $Record; / ip dns static set address=($Prefix . ":" . ($Comment->"suffix")) $Record;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment