mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Merge pull request #4072 from jwsi/openvpn-gwgroup
This commit is contained in:
commit
331876469b
@ -1577,21 +1577,33 @@ function openvpn_resync_all($interface = "") {
|
||||
log_error(gettext("Resyncing OpenVPN instances."));
|
||||
}
|
||||
|
||||
// Check if OpenVPN clients and servers require a resync.
|
||||
if (is_array($config['openvpn']['openvpn-server'])) {
|
||||
foreach ($config['openvpn']['openvpn-server'] as & $settings) {
|
||||
if ($interface <> "" && $interface != $settings['interface']) {
|
||||
continue;
|
||||
$mode_id = "server" . $settings['vpnid'];
|
||||
$fpath = "{$g['varetc_path']}/openvpn/{$mode_id}.interface";
|
||||
$gw_group_change = FALSE;
|
||||
$ip_change = ($interface === "") || ($interface === $settings['interface']);
|
||||
if (!$ip_change && file_exists($fpath)) {
|
||||
$gw_group_change = (trim(file_get_contents($fpath), " \t\n") != get_failover_interface($settings['interface']));
|
||||
}
|
||||
if ($ip_change || $gw_group_change) {
|
||||
openvpn_resync('server', $settings);
|
||||
}
|
||||
openvpn_resync('server', $settings);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($config['openvpn']['openvpn-client'])) {
|
||||
foreach ($config['openvpn']['openvpn-client'] as & $settings) {
|
||||
if ($interface <> "" && $interface != $settings['interface']) {
|
||||
continue;
|
||||
$mode_id = "client" . $settings['vpnid'];
|
||||
$fpath = "{$g['varetc_path']}/openvpn/{$mode_id}.interface";
|
||||
$gw_group_change = FALSE;
|
||||
$ip_change = ($interface === "") || ($interface === $settings['interface']);
|
||||
if (!$ip_change && file_exists($fpath)) {
|
||||
$gw_group_change = (trim(file_get_contents($fpath), " \t\n") != get_failover_interface($settings['interface']));
|
||||
}
|
||||
if ($ip_change || $gw_group_change) {
|
||||
openvpn_resync('client', $settings);
|
||||
}
|
||||
openvpn_resync('client', $settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user