aboutsummaryrefslogtreecommitdiffstats
path: root/dhcp-to-dns
diff options
context:
space:
mode:
Diffstat (limited to 'dhcp-to-dns')
-rw-r--r--dhcp-to-dns9
1 files changed, 3 insertions, 6 deletions
diff --git a/dhcp-to-dns b/dhcp-to-dns
index 3ee7155..d769bf6 100644
--- a/dhcp-to-dns
+++ b/dhcp-to-dns
@@ -4,6 +4,8 @@
#
# check DHCP leases and add/remove/update DNS entries
+:global CharacterReplace;
+
:global Identity;
:global Domain;
:global HostNameInZone;
@@ -39,12 +41,7 @@
:local Mac [ / ip dhcp-server lease get $Lease mac-address ];
:set DhcpIp [ / ip dhcp-server lease get $Lease address ];
:local Comment ("managed by dhcp-to-dns for " . $Mac);
- :set HostName [ / ip dhcp-server lease get $Lease host-name ];
-
- :while ($HostName ~ " ") do={
- :local Pos [ :find $HostName " " ];
- :set HostName ([ :pick $HostName 0 $Pos ] . [ :pick $HostName ($Pos + 1) 999 ]);
- };
+ :set HostName [ $CharacterReplace [ / ip dhcp-server lease get $Lease host-name ] " " "" ];
:if ([ :len $HostName ] > 0) do={
:set Fqdn ($HostName . "." . $Zone);