diff options
author | Chris Buechler <cmb@pfsense.org> | 2014-11-22 12:42:53 -0600 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2014-11-22 12:42:53 -0600 |
commit | 93ead355d44d836a940ba0f1d6d7bb51712e9245 (patch) | |
tree | c564515e266e3501e59952f85155dca9b289e020 /etc/inc/openvpn.inc | |
parent | e295e7ca444fac62ba10127fa4e85875253ca399 (diff) | |
download | pfsense-93ead355d44d836a940ba0f1d6d7bb51712e9245.zip pfsense-93ead355d44d836a940ba0f1d6d7bb51712e9245.tar.gz |
In some circumstances, OpenVPN doesn't exit on SIGTERM. SIGKILL it when that happens. Ticket #3894
Diffstat (limited to 'etc/inc/openvpn.inc')
-rw-r--r-- | etc/inc/openvpn.inc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index ad79392..832bcd7 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -842,9 +842,16 @@ function openvpn_restart($mode, $settings) { /* send a term signal to the process */ posix_kill($pid, SIGTERM); - /* wait until the process exits */ - while(posix_kill($pid, 0)) + /* wait until the process exits, or timeout and kill it */ + $i = 0; + while(posix_kill($pid, 0)) { usleep(250000); + if ($i > 10) { + log_error("OpenVPN ID $mode_id PID $pid still running, killing."); + posix_kill($pid, SIGKILL); + } + $i++; + } } if (isset($settings['disable'])) |