summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2013-05-06 23:36:33 -0700
committerErmal Luçi <eri@pfsense.org>2013-05-06 23:36:33 -0700
commit7610866f5c0761e0236bda7b298acca53e61f9c9 (patch)
tree31f0929f640fcb2b114f91f8b568917fae2d342c
parent8edaa92ccbfd30a66e5bb4bcacd6ba5da7001146 (diff)
parent1f64b66bf01b279203dd143dac0120f987452a9d (diff)
downloadpfsense-7610866f5c0761e0236bda7b298acca53e61f9c9.zip
pfsense-7610866f5c0761e0236bda7b298acca53e61f9c9.tar.gz
Merge pull request #625 from phil-davis/master
Fixup handling gateway argument to rc.openvpn
-rw-r--r--etc/inc/gwlb.inc4
-rwxr-xr-xetc/rc.openvpn18
2 files changed, 14 insertions, 8 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index 088f251..5864733 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -92,7 +92,7 @@ rrd interval 60s;
## These parameters can be overridden in a specific alarm configuration
alarm default {
command on "/usr/local/sbin/pfSctl -c 'service reload dyndns %T' -c 'service reload ipsecdns' -c 'service reload openvpn %T' -c 'filter reload' "
- command off "/usr/local/sbin/pfSctl -c 'service reload dyndnsall' -c 'service reload ipsecdns' -c 'service reload openvpn' -c 'filter reload' "
+ command off "/usr/local/sbin/pfSctl -c 'service reload dyndns %T' -c 'service reload ipsecdns' -c 'service reload openvpn %T' -c 'filter reload' "
combine 10s
}
@@ -836,7 +836,7 @@ function lookup_gateway_interface_by_name($name) {
$gateways_arr = return_gateways_array(false, true);
if (!empty($gateways_arr[$name])) {
- $interfacegw = $gateways_arr[$name]['interface'];
+ $interfacegw = $gateways_arr[$name]['friendlyiface'];
return ($interfacegw);
}
diff --git a/etc/rc.openvpn b/etc/rc.openvpn
index 3f6af1f..f2a96e0 100755
--- a/etc/rc.openvpn
+++ b/etc/rc.openvpn
@@ -40,13 +40,17 @@ require_once("openvpn.inc");
/* make sure to wait until the boot scripts have finished */
if (file_exists("{$g['varrun_path']}/booting"))
- return;;
+ return;
$argument = trim($argv[1], " \n");
-if(isset($config['openvpn']['enable']))
- log_error("OpenVPN: One or more OpenVPN tunnel endpoints may have changed its IP. Reloading.");
-else
+if(is_array($config['openvpn']['openvpn-server']) || is_array($config['openvpn']['openvpn-server'])) {
+ if (empty($argument) || $argument == "all")
+ $log_text = "all";
+ else
+ $log_text = "endpoints that may use " . $argument;
+ log_error("OpenVPN: One or more OpenVPN tunnel endpoints may have changed its IP. Reloading " . $log_text . ".");
+} else
return;
$gwgroups = array();
@@ -54,23 +58,25 @@ $openvpnlck = lock('openvpn', LOCK_EX);
if (empty($argument) || $argument == "all")
$interface = "";
else {
+ // e.g. $argument = "WANGW", $interface = "wan"
$interface = lookup_gateway_interface_by_name($argument);
if (empty($interface))
$interface = $argument;
else
+ // e.g. $argument = "WANGW", $gwgroups = array of gateway groups that use "wan"
$gwgroups = gateway_is_gwgroup_member($argument);
}
if(is_array($config['openvpn']['openvpn-server'])) {
foreach($config['openvpn']['openvpn-server'] as &$server) {
- if ($server['interface'] == $interface || empty($interface) || (!empty($gwgroups) && in_array($argument, $gwgroups)))
+ if ($server['interface'] == $interface || empty($interface) || (!empty($gwgroups) && in_array($server['interface'], $gwgroups)))
openvpn_resync('server', $server);
}
}
if (is_array($config['openvpn']['openvpn-client'])) {
foreach($config['openvpn']['openvpn-client'] as &$client) {
- if ($client['interface'] == $interface || empty($interface) || (!empty($gwgroups) && in_array($argument, $gwgroups)))
+ if ($client['interface'] == $interface || empty($interface) || (!empty($gwgroups) && in_array($client['interface'], $gwgroups)))
openvpn_resync('client', $client);
}
}
OpenPOWER on IntegriCloud