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
committerRenato Botelho <garga@FreeBSD.org>2013-10-23 09:58:03 -0200
commitf8804b74f91523f447ce939250f4180dcc201bfa (patch)
tree8c2fbc4fcc012104eef69b7df824c32deb566e77 /etc/rc.openvpn
parent4bf23d320bc96eeabf2daf9024583f2cc5a6662a (diff)
downloadpfsense-f8804b74f91523f447ce939250f4180dcc201bfa.zip
pfsense-f8804b74f91523f447ce939250f4180dcc201bfa.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 8cf9ea2..7ec7df8 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