summaryrefslogtreecommitdiffstats
path: root/etc/inc/openvpn.inc
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2014-11-22 12:42:53 -0600
committerChris Buechler <cmb@pfsense.org>2014-11-22 12:42:53 -0600
commit93ead355d44d836a940ba0f1d6d7bb51712e9245 (patch)
treec564515e266e3501e59952f85155dca9b289e020 /etc/inc/openvpn.inc
parente295e7ca444fac62ba10127fa4e85875253ca399 (diff)
downloadpfsense-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.inc11
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']))
OpenPOWER on IntegriCloud