diff options
author | Phil Davis <phil.davis@world.inf.org> | 2013-03-29 14:25:34 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@world.inf.org> | 2013-03-29 14:25:34 +0545 |
commit | 99cc103b86713a3e192b787a372172681173dc52 (patch) | |
tree | 498c427a874747e2f9006ee4a1c013dca6975136 | |
parent | a8f5790a30d1b510833264da48f082da2ef6201c (diff) | |
download | pfsense-99cc103b86713a3e192b787a372172681173dc52.zip pfsense-99cc103b86713a3e192b787a372172681173dc52.tar.gz |
Provide openvpn_resync_gwgroup function
Allows all OpenVPN servers and clients that use a particular gateway group to be resynced in one easy call.
-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 18267d5..1b801ed 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; |