summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2024-01-19 21:09:25 +0100
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2024-01-19 21:09:25 +0100
commit08fbbb8d0f8221fcf28273a804bb6b96dd0ecf71 (patch)
tree44bf7f9d8f5ccfa84f5c92fd6e652f333917d1fd /src
parentc1aa7eee7d3023730066ffd23e5829c325bcfd23 (diff)
downloadvyos-1x-08fbbb8d0f8221fcf28273a804bb6b96dd0ecf71.tar.gz
vyos-1x-08fbbb8d0f8221fcf28273a804bb6b96dd0ecf71.zip
dhcp: T5948: Strip trailing dot, detect if hostname is FQDN
Diffstat (limited to 'src')
-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