diff options
author | Ermal Luçi <eri@pfsense.org> | 2013-04-03 02:56:12 -0700 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2013-04-03 02:56:12 -0700 |
commit | 24d8c77d3615783a03bca7e78891f964c59fbcfd (patch) | |
tree | 499b88499a1fefdb1af5abfaf425ec7c074c0178 /etc | |
parent | ae5f96c807010d6bf208717d5b18f053d439ed54 (diff) | |
parent | 30ca7b7ebcb6d48a6bd8bc57ddffcf6c64c68e7b (diff) | |
download | pfsense-24d8c77d3615783a03bca7e78891f964c59fbcfd.zip pfsense-24d8c77d3615783a03bca7e78891f964c59fbcfd.tar.gz |
Merge pull request #499 from phil-davis/master
Resync relevant OpenVPN instances when gateway group settings are modified
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/openvpn.inc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index 43d55c7..a5244fd 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -938,6 +938,35 @@ function openvpn_resync_all($interface = "") { } +// Resync and restart all VPNs using a gateway group. +function openvpn_resync_gwgroup($gwgroupname = "") { + global $g, $config; + + if ($gwgroupname <> "") { + if (is_array($config['openvpn']['openvpn-server'])) { + foreach ($config['openvpn']['openvpn-server'] as & $settings) { + if ($gwgroupname == $settings['interface']) { + log_error("Resyncing OpenVPN for gateway group " . $gwgroupname . " server " . $settings["description"] . "."); + openvpn_resync('server', $settings); + } + } + } + + if (is_array($config['openvpn']['openvpn-client'])) { + foreach ($config['openvpn']['openvpn-client'] as & $settings) { + if ($gwgroupname == $settings['interface']) { + log_error("Resyncing OpenVPN for gateway group " . $gwgroupname . " client " . $settings["description"] . "."); + openvpn_resync('client', $settings); + } + } + } + + // Note: no need to resysnc Client Specific (csc) here, as changes to the OpenVPN real interface do not effect these. + + } else + log_error("openvpn_resync_gwgroup called with null gwgroup parameter."); +} + function openvpn_get_active_servers($type="multipoint") { global $config, $g; |