From 845c25f87c4cfa25058f561b938c487b224af00e Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 14 Nov 2019 22:16:33 +0100 Subject: dhcp-to-dns: act on hostname only if available --- dhcp-to-dns | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dhcp-to-dns b/dhcp-to-dns index 81b2964..edb50b4 100644 --- a/dhcp-to-dns +++ b/dhcp-to-dns @@ -49,7 +49,9 @@ :set ($LeaseVal->"address") [ / ip dhcp-server lease get ($DupMacLeases->([ :len $DupMacLeases ] - 1)) address ]; } - :set ($LeaseVal->"address") [ / ip dhcp-server lease get ([ find where host-name=($LeaseVal->"host-name") dynamic=yes ]->0) 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 ]->0) address ]; + } :if ($DnsIp = $LeaseVal->"address") do={ :log debug ("DNS entry for " . $Fqdn . " does not need updating."); -- cgit v1.2.3-70-g09d2