summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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