diff options
author | jim-p <jimp@pfsense.org> | 2015-03-25 10:36:50 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2015-03-25 10:40:50 -0400 |
commit | 3c3a3bf9c5a691786d65afa78914d5e498530663 (patch) | |
tree | c2fea2a7f0ded5e7dbc825d9c9887d392ba44ccb /etc | |
parent | d4d24d6a085462e2d863c0218252c21f603db524 (diff) | |
download | pfsense-3c3a3bf9c5a691786d65afa78914d5e498530663.zip pfsense-3c3a3bf9c5a691786d65afa78914d5e498530663.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')
-rwxr-xr-x | etc/rc.openvpn | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/etc/rc.openvpn b/etc/rc.openvpn index 9e0d18a..1474090 100755 --- a/etc/rc.openvpn +++ b/etc/rc.openvpn @@ -49,14 +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; } } } |