aboutsummaryrefslogtreecommitdiffstats
path: root/dhcp-to-dns
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-06-02 22:05:21 +0200
committerGravatar Christian Hesse <mail@eworm.de>2020-06-02 22:09:13 +0200
commitbfcf861b51039c394cf91b65db4cdd4fe4cd3846 (patch)
tree455ca0dc2266cc1ac51d5812171bf565e08da551 /dhcp-to-dns
parent75979116727eed330b404dfb9c01354704193fc9 (diff)
dhcp-to-dns: add a marker for new records
Diffstat (limited to 'dhcp-to-dns')
-rw-r--r--dhcp-to-dns8
1 files changed, 7 insertions, 1 deletions
diff --git a/dhcp-to-dns b/dhcp-to-dns
index f88599c..f883cd0 100644
--- a/dhcp-to-dns
+++ b/dhcp-to-dns
@@ -21,6 +21,12 @@
: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={
+ / 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;
+}
+:local PlaceBefore [ / ip dns static find where comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled ];
+
:foreach DnsRecord in=[ / ip dns static find where comment ~ $CommentPrefix ] do={
:local DnsRecordVal [ / ip dns static get $DnsRecord ];
:local MacAddress [ $CharacterReplace ($DnsRecordVal->"comment") $CommentPrefix "" ];
@@ -63,6 +69,6 @@
}
} else={
$LogPrintExit info ("Adding new DNS entry for " . $Fqdn . ", address is " . $LeaseVal->"address" . ".") false;
- / ip dns static add name=$Fqdn address=($LeaseVal->"address") ttl=$Ttl comment=$Comment;
+ / ip dns static add name=$Fqdn address=($LeaseVal->"address") ttl=$Ttl comment=$Comment place-before=$PlaceBefore;
}
}