aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2019-02-08 13:03:42 +0100
committerGravatar Christian Hesse <mail@eworm.de>2019-02-08 13:03:42 +0100
commita47aa45253009c877d3ee551a39e2dadbe4920b5 (patch)
tree76c3e47f864b126355bfc02422b9f9e860a2f95b
parent0a34f4c2c218734a6b4f82e2718538138becf21c (diff)
dhcp-to-dns: use mac-address if hostname is empty
-rw-r--r--dhcp-to-dns3
1 files changed, 3 insertions, 0 deletions
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);