From 13abffe43b2a5c41bb4ec4675c227f6cf1f868da Mon Sep 17 00:00:00 2001 From: zsdc Date: Wed, 14 Apr 2021 00:26:18 +0300 Subject: dhclient: T3471: Fixed dhclient processes search Since in some cases a dhclient command may not end with an interface name, the way to find out a list of dhclients running for a current interface was replaced to catch PIDs regardless of the exact command syntax. --- src/etc/dhcp/dhclient-enter-hooks.d/02-vyos-stopdhclient | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/etc/dhcp') diff --git a/src/etc/dhcp/dhclient-enter-hooks.d/02-vyos-stopdhclient b/src/etc/dhcp/dhclient-enter-hooks.d/02-vyos-stopdhclient index d5d90632c..939055a63 100644 --- a/src/etc/dhcp/dhclient-enter-hooks.d/02-vyos-stopdhclient +++ b/src/etc/dhcp/dhclient-enter-hooks.d/02-vyos-stopdhclient @@ -11,7 +11,7 @@ if [ -z ${CONTROLLED_STOP} ] ; then ipversion_arg=`ps --no-headers --format args --pid $current_dhclient | awk '{ print $2 }'` # get list of all dhclient running for current interface - dhclients_pids=(`ps --no-headers --format pid,args -C dhclient | awk -v IFACE="/sbin/dhclient $ipversion_arg .*$interface$" '$0 ~ IFACE { print $1 }'`) + dhclients_pids=(`pgrep -f "dhclient $ipversion_arg.* $interface(\s|$)"`) logmsg info "Current dhclient PID: $current_dhclient, Parent PID: $master_dhclient, IP version: $ipversion_arg, All dhclients for interface $interface: ${dhclients_pids[@]}" # stop all dhclients for current interface, except current one -- cgit v1.2.3