aboutsummaryrefslogtreecommitdiffstats
path: root/dhcp-to-dns
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-09-19 22:33:15 +0200
committerGravatar Christian Hesse <mail@eworm.de>2020-09-19 22:36:47 +0200
commit9f3e39206c0c03978bfbe59f9a61974b964167b7 (patch)
tree25f0c52bd0e155eefd5a365196f64e30849c0461 /dhcp-to-dns
parent956244d53b19ecd1c7e1d54ac4b9350db83cff12 (diff)
dhcp-to-dns: also act on static leases
Since commit 0560f828 we act on bound leases only. That keeps offline clients away, so act on static leases as well.
Diffstat (limited to 'dhcp-to-dns')
-rw-r--r--dhcp-to-dns8
1 files changed, 4 insertions, 4 deletions
diff --git a/dhcp-to-dns b/dhcp-to-dns
index ddda171..4ea4f59 100644
--- a/dhcp-to-dns
+++ b/dhcp-to-dns
@@ -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 ([ :len [ / ip dhcp-server lease find 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") status=bound ] ] > 0) do={
$LogPrintExit debug ("Lease for " . $MacAddress . " (" . $DnsRecordVal->"name" . ") still exists. Not deleting DNS entry.") false;
} else={
:local Found false;
@@ -40,7 +40,7 @@
}
}
-:foreach Lease in=[ / ip dhcp-server lease find where dynamic=yes status=bound ] do={
+:foreach Lease in=[ / ip dhcp-server lease find where status=bound ] do={
:local LeaseVal [ / ip dhcp-server lease get $Lease ];
:local Comment ($CommentPrefix . $LeaseVal->"mac-address");
:local HostName [ $IfThenElse ([ :len ($LeaseVal->"host-name") ] = 0) \
@@ -52,13 +52,13 @@
:if ([ :len $DnsRecord ] > 0) do={
:local DnsIp [ / ip dns static get $DnsRecord address ];
- :local DupMacLeases [ / ip dhcp-server lease find where mac-address=($LeaseVal->"mac-address") dynamic=yes status=bound ];
+ :local DupMacLeases [ / ip dhcp-server lease find where mac-address=($LeaseVal->"mac-address") status=bound ];
:if ([ :len $DupMacLeases ] > 1) do={
:set ($LeaseVal->"address") [ / ip dhcp-server lease get ($DupMacLeases->([ :len $DupMacLeases ] - 1)) address ];
}
:if ([ :len ($LeaseVal->"host-name") ] > 0) do={
- :set ($LeaseVal->"address") [ / ip dhcp-server lease get ([ find where host-name=($LeaseVal->"host-name") dynamic=yes status=bound ]->0) address ];
+ :set ($LeaseVal->"address") [ / ip dhcp-server lease get ([ find where host-name=($LeaseVal->"host-name") status=bound ]->0) address ];
}
:if ($DnsIp = $LeaseVal->"address") do={