From 08fbbb8d0f8221fcf28273a804bb6b96dd0ecf71 Mon Sep 17 00:00:00 2001 From: sarthurdev <965089+sarthurdev@users.noreply.github.com> Date: Fri, 19 Jan 2024 21:09:25 +0100 Subject: dhcp: T5948: Strip trailing dot, detect if hostname is FQDN --- src/system/on-dhcp-event.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/system/on-dhcp-event.sh b/src/system/on-dhcp-event.sh index 3c11105d4..52fadd428 100755 --- a/src/system/on-dhcp-event.sh +++ b/src/system/on-dhcp-event.sh @@ -63,7 +63,7 @@ case "$action" in client_ip=${!client_ip_var} client_mac=${!client_mac_var} - client_name=${!client_name_var//./} + client_name=${!client_name_var%.} client_subnet_id=${!client_subnet_id_var} if [ -z "$client_name" ]; then @@ -73,7 +73,7 @@ case "$action" in client_domain=$(get_subnet_domain_name $client_subnet_id) - if [ -n "$client_domain" ]; then + if [[ -n "$client_domain" ]] && ! [[ $client_name =~ .*$client_domain$ ]]; then client_name="$client_name.$client_domain" fi -- cgit v1.2.3