summaryrefslogtreecommitdiff
path: root/src/system
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-02-23 19:32:11 +0100
committerGitHub <noreply@github.com>2021-02-23 19:32:11 +0100
commit5751f90bda6c6dcb207e5ed11b80e0b9532e0f00 (patch)
tree5541b33ae3af067a6c0ee221147e423617052ece /src/system
parent162f2f00ab1fb3f01e1120945960d2677543dc3e (diff)
parent2f8b33a26e63e5b9ac4e697b9312f2238d6241f3 (diff)
downloadvyos-1x-5751f90bda6c6dcb207e5ed11b80e0b9532e0f00.tar.gz
vyos-1x-5751f90bda6c6dcb207e5ed11b80e0b9532e0f00.zip
Merge pull request #740 from DmitriyEshenko/1x2302202001
dhcp-server: T2927: Add empty args if does not possible to determine …
Diffstat (limited to 'src/system')
-rwxr-xr-xsrc/system/on-dhcp-event.sh25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/system/on-dhcp-event.sh b/src/system/on-dhcp-event.sh
index a062dc810..49e53d7e1 100755
--- a/src/system/on-dhcp-event.sh
+++ b/src/system/on-dhcp-event.sh
@@ -21,21 +21,20 @@ client_mac=$4
domain=$5
hostsd_client="/usr/bin/vyos-hostsd-client"
-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
-else
- client_fqdn_name=$client_name.$domain
- client_search_expr="$client_name\\.$domain"
-fi
-
case "$action" in
commit) # add mapping for new lease
+ 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
+ else
+ client_fqdn_name=$client_name.$domain
+ client_search_expr="$client_name\\.$domain"
+ fi
$hostsd_client --add-hosts "$client_fqdn_name,$client_ip" --tag "dhcp-server-$client_ip" --apply
exit 0
;;