From a47aa45253009c877d3ee551a39e2dadbe4920b5 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 8 Feb 2019 13:03:42 +0100 Subject: dhcp-to-dns: use mac-address if hostname is empty --- dhcp-to-dns | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dhcp-to-dns b/dhcp-to-dns index d769bf6..8edb45b 100644 --- a/dhcp-to-dns +++ b/dhcp-to-dns @@ -42,6 +42,9 @@ :set DhcpIp [ / ip dhcp-server lease get $Lease address ]; :local Comment ("managed by dhcp-to-dns for " . $Mac); :set HostName [ $CharacterReplace [ / ip dhcp-server lease get $Lease host-name ] " " "" ]; + :if ($HostName = "") do={ + :set HostName [ $CharacterReplace [ / ip dhcp-server lease get $Lease mac-address ] ":" "-" ]; + } :if ([ :len $HostName ] > 0) do={ :set Fqdn ($HostName . "." . $Zone); -- cgit v1.2.3-70-g09d2