summaryrefslogtreecommitdiff
path: root/src/system/on-dhcp-event.sh
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2022-12-16 11:41:33 +0100
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2023-12-08 00:29:38 +0100
commitd95200e96763e4a7ed02577b1b177c84abb77838 (patch)
treeee6389af45a012f4a48bdaae5375873444061e96 /src/system/on-dhcp-event.sh
parentee5c78e966d3b6e98e7b4f94acb4ef88094b5e54 (diff)
downloadvyos-1x-d95200e96763e4a7ed02577b1b177c84abb77838.tar.gz
vyos-1x-d95200e96763e4a7ed02577b1b177c84abb77838.zip
dhcp: T3316: Migrate dhcp/dhcpv6 server to Kea
Diffstat (limited to 'src/system/on-dhcp-event.sh')
-rwxr-xr-xsrc/system/on-dhcp-event.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/system/on-dhcp-event.sh b/src/system/on-dhcp-event.sh
index 49e53d7e1..7b25bf338 100755
--- a/src/system/on-dhcp-event.sh
+++ b/src/system/on-dhcp-event.sh
@@ -15,20 +15,20 @@ if [ $# -lt 5 ]; then
fi
action=$1
-client_name=$2
-client_ip=$3
-client_mac=$4
-domain=$5
+client_name=$LEASE4_HOSTNAME
+client_ip=$LEASE4_ADDRESS
+client_mac=$LEASE4_HWADDR
+domain=$(echo "$client_name" | cut -d"." -f2-)
hostsd_client="/usr/bin/vyos-hostsd-client"
case "$action" in
- commit) # add mapping for new lease
+ leases4_renew|lease4_recover) # 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
+ if [ -z "$domain" ]; then
client_fqdn_name=$client_name
client_search_expr=$client_name
else
@@ -39,7 +39,7 @@ case "$action" in
exit 0
;;
- release) # delete mapping for released address
+ lease4_release|lease4_expire) # delete mapping for released address)
$hostsd_client --delete-hosts --tag "dhcp-server-$client_ip" --apply
exit 0
;;