summaryrefslogtreecommitdiff
path: root/src/system/on-dhcp-event.sh
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-01-19 21:22:33 +0100
committerGitHub <noreply@github.com>2024-01-19 21:22:33 +0100
commit7e6aa37725e60936a2ae9f4369e19bec1a7fc9b6 (patch)
tree3008f26881fdb0ae19a347490aa44c80d5bc354a /src/system/on-dhcp-event.sh
parentc7d35deb8ea2fb15796fb98b103f027b927a020f (diff)
parent08fbbb8d0f8221fcf28273a804bb6b96dd0ecf71 (diff)
downloadvyos-1x-7e6aa37725e60936a2ae9f4369e19bec1a7fc9b6.tar.gz
vyos-1x-7e6aa37725e60936a2ae9f4369e19bec1a7fc9b6.zip
Merge pull request #2857 from sarthurdev/T5948_1
dhcp: T5948: Strip trailing dot, detect if hostname is FQDN
Diffstat (limited to 'src/system/on-dhcp-event.sh')
-rwxr-xr-xsrc/system/on-dhcp-event.sh4
1 files 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