From 8c8d7f93f19778b9a41e7dc647c42db2a9a3a945 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 29 Aug 2019 13:58:18 +0200 Subject: ipv6-update: get values into array ... and concatenate name and regexp - just either of both is set. --- ipv6-update | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ipv6-update b/ipv6-update index 5d5a3dc..e21e6bb 100644 --- a/ipv6-update +++ b/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; } } -- cgit v1.2.3-54-g00ecf