Revision 99cc103b
Added by Phil Davis over 12 years ago
etc/inc/openvpn.inc | ||
---|---|---|
938 | 938 |
|
939 | 939 |
} |
940 | 940 |
|
941 |
// Resync and restart all VPNs using a gateway group. |
|
942 |
function openvpn_resync_gwgroup($gwgroupname = "") { |
|
943 |
global $g, $config; |
|
944 |
|
|
945 |
if ($gwgroupname <> "") { |
|
946 |
if (is_array($config['openvpn']['openvpn-server'])) { |
|
947 |
foreach ($config['openvpn']['openvpn-server'] as & $settings) { |
|
948 |
if ($gwgroupname == $settings['interface']) { |
|
949 |
log_error("Resyncing OpenVPN for gateway group " . $gwgroupname . " server " . $settings["description"] . "."); |
|
950 |
openvpn_resync('server', $settings); |
|
951 |
} |
|
952 |
} |
|
953 |
} |
|
954 |
|
|
955 |
if (is_array($config['openvpn']['openvpn-client'])) { |
|
956 |
foreach ($config['openvpn']['openvpn-client'] as & $settings) { |
|
957 |
if ($gwgroupname == $settings['interface']) { |
|
958 |
log_error("Resyncing OpenVPN for gateway group " . $gwgroupname . " client " . $settings["description"] . "."); |
|
959 |
openvpn_resync('client', $settings); |
|
960 |
} |
|
961 |
} |
|
962 |
} |
|
963 |
|
|
964 |
// Note: no need to resysnc Client Specific (csc) here, as changes to the OpenVPN real interface do not effect these. |
|
965 |
|
|
966 |
} else |
|
967 |
log_error("openvpn_resync_gwgroup called with null gwgroup parameter."); |
|
968 |
} |
|
969 |
|
|
941 | 970 |
function openvpn_get_active_servers($type="multipoint") { |
942 | 971 |
global $config, $g; |
943 | 972 |
|
Also available in: Unified diff
Provide openvpn_resync_gwgroup function
Allows all OpenVPN servers and clients that use a particular gateway group to be resynced in one easy call.