summaryrefslogtreecommitdiffstats
path: root/etc/rc.openvpn
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@world.inf.org>2013-10-01 22:03:16 -0700
committerPhil Davis <phil.davis@world.inf.org>2013-10-01 22:03:16 -0700
commit634054cc6935e35a8eb079d095abc7208ea1638b (patch)
treee56aabca7545158baab3b8e010b1a4399b845d76 /etc/rc.openvpn
parent78b2a705de9fe698709356e25505d0cabf839ffe (diff)
downloadpfsense-634054cc6935e35a8eb079d095abc7208ea1638b.zip
pfsense-634054cc6935e35a8eb079d095abc7208ea1638b.tar.gz
Check for disabled OpenVPN instances in openvpn_resync_if_needed
It is much cleaner if we check first for disabled OpenVPN instances, before diving into all the other checks. Note, the final openvpn_resync() does call other routines that finally check if the instance is disabled, but there are so many checks here for various conditions to be met before calling openvpn_resync that it looks better (safer) to bail out early if the instance is disabled.
Diffstat (limited to 'etc/rc.openvpn')
-rwxr-xr-xetc/rc.openvpn26
1 files changed, 15 insertions, 11 deletions
diff --git a/etc/rc.openvpn b/etc/rc.openvpn
index 857dee2..303b572 100755
--- a/etc/rc.openvpn
+++ b/etc/rc.openvpn
@@ -42,17 +42,21 @@ function openvpn_resync_if_needed ($mode, $ovpn_settings, $interface) {
global $g, $config;
$resync_needed = true;
- if (!empty($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 (($current_device == $new_device) && ($current_device != $this_device) && ($new_device != $this_device))
- $resync_needed = false;
+ if (isset($ovpn_settings['disable'])) {
+ $resync_needed = false;
+ } else {
+ if (!empty($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 (($current_device == $new_device) && ($current_device != $this_device) && ($new_device != $this_device))
+ $resync_needed = false;
+ }
}
}
}
OpenPOWER on IntegriCloud