summaryrefslogtreecommitdiffstats
path: root/etc/rc.openvpn
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2015-03-25 10:40:00 -0400
committerjim-p <jimp@pfsense.org>2015-03-25 10:40:40 -0400
commita3cecbc37572679807fdb4aa7acb0c606cb5b178 (patch)
treeae54ad8b36e940267cb3df22c3a585ddf8e8fcc1 /etc/rc.openvpn
parent4aefcf915112b38784b06abc8dd9a26d9a4960b3 (diff)
downloadpfsense-a3cecbc37572679807fdb4aa7acb0c606cb5b178.zip
pfsense-a3cecbc37572679807fdb4aa7acb0c606cb5b178.tar.gz
Eliminate the "this_device" test from the resync check in rc.openvpn.
It is not necessary to check, as the only times a gateway event should trigger the VPN to restart are when the current and new devices differ. This also allows us to simplify the code a bit and eliminate some single-use variables. See the discussion at https://github.com/pfsense/pfsense/commit/4aefcf915112b38784b06abc8dd9a26d9a4960b3
Diffstat (limited to 'etc/rc.openvpn')
-rwxr-xr-xetc/rc.openvpn13
1 files changed, 4 insertions, 9 deletions
diff --git a/etc/rc.openvpn b/etc/rc.openvpn
index e3af785..ce5ea96 100755
--- a/etc/rc.openvpn
+++ b/etc/rc.openvpn
@@ -49,15 +49,10 @@ function openvpn_resync_if_needed ($mode, $ovpn_settings, $interface) {
$mode_id = $mode . $ovpn_settings['vpnid'];
$fpath = "{$g['varetc_path']}/openvpn/{$mode_id}.interface";
if (file_exists($fpath)) {
- $current_device = file_get_contents($fpath);
- $current_device = trim($current_device, " \t\n");
- $new_device = get_failover_interface($ovpn_settings['interface']);
- if (isset($config['interfaces'][$interface])) {
- $this_device = $config['interfaces'][$interface]['if'];
- /* If the "current", "new", and "this" device are ALL the same, no resync should be necessary. */
- if (($current_device == $new_device) && ($current_device == $this_device))
- $resync_needed = false;
- }
+ /* Compare the interface currently used by the VPN with the interface that should be used.
+ If the VPN should stay on the same interface, do not resync */
+ if (trim(file_get_contents($fpath), " \t\n") == get_failover_interface($ovpn_settings['interface'])) {
+ $resync_needed = false;
}
}
}
OpenPOWER on IntegriCloud