diff --git a/dhcp-to-dns b/dhcp-to-dns index dfb438f..83e312f 100644 --- a/dhcp-to-dns +++ b/dhcp-to-dns @@ -25,12 +25,13 @@ [ $IfThenElse ($HostNameInZone = true) ($Identity . ".") ] . $Domain); :local Ttl 5m; :local CommentPrefix "managed by dhcp-to-dns for "; +:local CommentString "--- dhcp-to-dns above ---"; -:if ([ :len [ / ip dns static find where comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled ] ] = 0) do={ - / ip dns static add comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled=yes; - $LogPrintExit2 warning $0 ("Added disabled static dns record with comment '--- dhcp-to-dns above ---'.") false; +:if ([ :len [ / ip dns static find where comment=$CommentString name=- type=NXDOMAIN disabled ] ] = 0) do={ + / ip dns static add comment=$CommentString name=- type=NXDOMAIN disabled=yes; + $LogPrintExit2 warning $0 ("Added disabled static dns record with comment '" . $CommentString . "'.") false; } -:local PlaceBefore ([ / ip dns static find where comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled ]->0); +:local PlaceBefore ([ / ip dns static find where comment=$CommentString name=- type=NXDOMAIN disabled ]->0); :foreach DnsRecord in=[ / ip dns static find where comment ~ $CommentPrefix ] do={ :local DnsRecordVal [ / ip dns static get $DnsRecord ];