diff options
Diffstat (limited to 'dhcp-to-dns')
-rw-r--r-- | dhcp-to-dns | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/dhcp-to-dns b/dhcp-to-dns index 4e2c7f2..3a95eb6 100644 --- a/dhcp-to-dns +++ b/dhcp-to-dns @@ -22,7 +22,7 @@ :local Ttl 5m; :local CommentPrefix "managed by dhcp-to-dns for "; -:if ([ / ip dns static print count-only where comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled ] = 0) do={ +: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; $LogPrintExit warning "Added disabled static dns record with comment '--- dhcp-to-dns above ---'." false; } @@ -31,7 +31,7 @@ :foreach DnsRecord in=[ / ip dns static find where comment ~ $CommentPrefix ] do={ :local DnsRecordVal [ / ip dns static get $DnsRecord ]; :local MacAddress [ $CharacterReplace ($DnsRecordVal->"comment") $CommentPrefix "" ]; - :if ([ / ip dhcp-server lease print count-only where mac-address=$MacAddress address=($DnsRecordVal->"address") dynamic=yes status=bound ] > 0) do={ + :if ([ :len [ / ip dhcp-server lease find where mac-address=$MacAddress address=($DnsRecordVal->"address") dynamic=yes status=bound ] ] > 0) do={ $LogPrintExit debug ("Lease for " . $MacAddress . " (" . $DnsRecordVal->"name" . ") still exists. Not deleting DNS entry.") false; } else={ :local Found false; |