diff options
author | Ermal <eri@pfsense.org> | 2010-03-29 17:22:32 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-03-29 17:22:32 +0000 |
commit | c7f60193594ccb20e22150c6058570fbc685ce75 (patch) | |
tree | e065b9ac0cc6600b70bf53dfdbcb698f95724b46 /etc | |
parent | 9a985f9e4bb5ecd6b985d0e7e471d0d4240068ce (diff) | |
download | pfsense-c7f60193594ccb20e22150c6058570fbc685ce75.zip pfsense-c7f60193594ccb20e22150c6058570fbc685ce75.tar.gz |
Ticket #449. Teach OpenVPN to reload only tunnels for the specified interface. Use this is rc.newwanip script to reload only these tunnels.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/openvpn.inc | 18 | ||||
-rwxr-xr-x | etc/rc.newwanip | 3 |
2 files changed, 15 insertions, 6 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index 19be97e..b96afad 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -653,7 +653,7 @@ function openvpn_resync($mode, & $settings) { } // Resync and restart all VPNs -function openvpn_resync_all() { +function openvpn_resync_all($interface = "") { global $g, $config; // delay our setup until the system @@ -682,13 +682,21 @@ function openvpn_resync_all() { } */ - if (is_array($config['openvpn']['openvpn-server'])) - foreach ($config['openvpn']['openvpn-server'] as & $settings) + if (is_array($config['openvpn']['openvpn-server'])) { + foreach ($config['openvpn']['openvpn-server'] as & $settings) { + if (!empty($interface) && $interface != $settings['interface']) + continue; openvpn_resync('server', $settings); + } + } - if (is_array($config['openvpn']['openvpn-client'])) - foreach ($config['openvpn']['openvpn-client'] as & $settings) + if (is_array($config['openvpn']['openvpn-client'])) { + foreach ($config['openvpn']['openvpn-client'] as & $settings) { + if (!empty($interface) && $interface != $settings['interface']) + continue; openvpn_resync('client', $settings); + } + } if (is_array($config['openvpn']['openvpn-csc'])) foreach ($config['openvpn']['openvpn-csc'] as & $settings) diff --git a/etc/rc.newwanip b/etc/rc.newwanip index aad0baa..4dd7f41 100755 --- a/etc/rc.newwanip +++ b/etc/rc.newwanip @@ -39,6 +39,7 @@ require_once("filter.inc"); require_once("shaper.inc"); require_once("ipsec.inc"); require_once("vpn.inc"); +require_once("openvpn.inc"); /* Interface IP address has changed */ @@ -82,7 +83,7 @@ file_put_contents("/tmp/update_dyndns", $interface); vpn_ipsec_force_reload(); /* start OpenVPN server & clients */ -exec("killall -HUP openvpn 2>/dev/null"); +openvpn_resync_all($interface); /* signal filter reload */ unlink_if_exists("/tmp/config.cache"); |