summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2021-04-14 00:26:18 +0300
committerzsdc <taras@vyos.io>2021-04-14 00:26:18 +0300
commit13abffe43b2a5c41bb4ec4675c227f6cf1f868da (patch)
tree01eac5001b3ba572d936a1426d4d6cc27545a8ac
parentfe0ff9e748aa2f21be0804106499796ba870c28d (diff)
downloadvyos-1x-13abffe43b2a5c41bb4ec4675c227f6cf1f868da.tar.gz
vyos-1x-13abffe43b2a5c41bb4ec4675c227f6cf1f868da.zip
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.
-rw-r--r--src/etc/dhcp/dhclient-enter-hooks.d/02-vyos-stopdhclient2
1 files changed, 1 insertions, 1 deletions
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