summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@world.inf.org>2012-10-11 18:56:20 +0545
committerPhil Davis <phil.davis@world.inf.org>2012-10-11 18:56:20 +0545
commitb95f546023b3d9c3ff983bc7b21b944477b61b65 (patch)
treee0feb2b79188c5cda55efbd4ea471532dc4e332f
parentd0da2c8c3c41f0e2321a0da1747572e00a347cb6 (diff)
downloadpfsense-b95f546023b3d9c3ff983bc7b21b944477b61b65.zip
pfsense-b95f546023b3d9c3ff983bc7b21b944477b61b65.tar.gz
Handle case with no server or no client OpenVPN
If there are OpenVPN servers but not clients, this warning is emitted: Warning: Invalid argument supplied for foreach() in /etc/rc.openvpn on line 55 This fixes handles that case, and the case of OpenVPN clients but no servers.
-rwxr-xr-xetc/rc.openvpn18
1 files changed, 12 insertions, 6 deletions
diff --git a/etc/rc.openvpn b/etc/rc.openvpn
index 77e6a8c..08beee8 100755
--- a/etc/rc.openvpn
+++ b/etc/rc.openvpn
@@ -47,15 +47,21 @@
log_error("OpenVPN: One or more OpenVPN tunnel endpoints may have changed its IP. Reloading.");
$gwgroups = return_gateway_groups_array();
- foreach($config['openvpn']['openvpn-server'] as &$server) {
- if(is_array($gwgroups[$server['interface']])) {
- openvpn_resync('server', $server);
+ if(is_array($config['openvpn']['openvpn-server'])) {
+ foreach($config['openvpn']['openvpn-server'] as &$server) {
+ if(is_array($gwgroups[$server['interface']])) {
+ openvpn_resync('server', $server);
+ }
}
}
- foreach($config['openvpn']['openvpn-client'] as &$client) {
- if(is_array($gwgroups[$client['interface']])) {
- openvpn_resync('client', $client);
+
+ if(is_array($config['openvpn']['openvpn-client'])) {
+ foreach($config['openvpn']['openvpn-client'] as &$client) {
+ if(is_array($gwgroups[$client['interface']])) {
+ openvpn_resync('client', $client);
+ }
}
}
+
unlock($openvpnlck);
?>
OpenPOWER on IntegriCloud