summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2021-04-14 00:26:18 +0300
committerChristian Poessinger <christian@poessinger.com>2021-04-14 08:04:38 +0200
commit9b7a4861b35109c47f4b1bc1d688dff928c6f023 (patch)
treef1ee852951dd03643f518e00158fd5f4d9cb2b07 /src
parent86cb96ae1861908ea1fa6d1b0cbd1832661c8571 (diff)
downloadvyos-1x-9b7a4861b35109c47f4b1bc1d688dff928c6f023.tar.gz
vyos-1x-9b7a4861b35109c47f4b1bc1d688dff928c6f023.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. (cherry picked from commit 13abffe43b2a5c41bb4ec4675c227f6cf1f868da)
Diffstat (limited to 'src')
-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