From 944a665cfc19cca1af9d46a70fb31ba1f4893d68 Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Thu, 21 Feb 2019 19:13:59 +0100
Subject: [dhcp] T1211: avoid blank DHCP hostnames taking down DNS

---
 src/system/on-dhcp-event.sh | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'src')

diff --git a/src/system/on-dhcp-event.sh b/src/system/on-dhcp-event.sh
index d671bffd6..02bbd4c3c 100755
--- a/src/system/on-dhcp-event.sh
+++ b/src/system/on-dhcp-event.sh
@@ -22,6 +22,11 @@ domain=$5
 file=/etc/hosts
 changes=0
 
+if [ -z "$client_name" ]; then
+    logger -s -t on-dhcp-event "Client name was empty, using MAC \"$client_mac\" instead"
+    client_name=$(echo "client-"$client_mac | tr : -)
+fi
+
 if [ "$domain" == "..YYZ!" ]; then
     client_fqdn_name=$client_name
     client_search_expr=$client_name
-- 
cgit v1.2.3