Project

General

Profile

« Previous | Next » 

Revision aa752473

Added by Renato Botelho over 12 years ago

Only reload racoon when there is at least one tunnel enabled on the interface used to call rc.newwanip(v6). It fixes #2922

View differences:

etc/inc/vpn.inc
998 998
 * For all other occasions the normal vpn_ipsec_configure()
999 999
 * will gracefully reload the settings without restarting
1000 1000
 */
1001
function vpn_ipsec_force_reload() {
1002
	global $config;
1003
	global $g;
1001
function vpn_ipsec_force_reload($interface = "") {
1002
	global $g, $config;
1004 1003

  
1005 1004
	$ipseccfg = $config['ipsec'];
1006 1005

  
1006
	if (!empty($interface) && is_array($ipseccfg['phase1'])) {
1007
		$found = false;
1008
		foreach ($ipseccfg['phase1'] as $ipsec) {
1009
			if (!isset($ipsec['disabled']) && ($ipsec['interface'] == $interface)) {
1010
				$found = true;
1011
				break;
1012
			}
1013
		}
1014
		if (!$found) {
1015
			log_error(sprintf(gettext("Ignoring IPsec racoon daemon reload since there are no tunnels on interface %s"), $interface));
1016
			return;
1017
		}
1018
	}
1019

  
1007 1020
	/* send a SIGKILL to be sure */
1008 1021
	killbypid("{$g['varrun_path']}/racoon.pid");
1009 1022

  
etc/rc.newwanip
171 171
	 * could be failing back in which case we need to switch IPs back anyhow. */
172 172

  
173 173
	/* reconfigure IPsec tunnels */
174
	vpn_ipsec_force_reload();
174
	vpn_ipsec_force_reload($interface);
175 175

  
176 176
	/* start OpenVPN server & clients */
177 177
	if (substr($interface_real, 0, 4) != "ovpn")
......
194 194
services_dyndns_configure($interface);
195 195

  
196 196
/* reconfigure IPsec tunnels */
197
vpn_ipsec_force_reload();
197
vpn_ipsec_force_reload($interface);
198 198

  
199 199
/* start OpenVPN server & clients */
200 200
if (substr($interface_real, 0, 4) != "ovpn")
etc/rc.newwanipv6
135 135
		// Still need to sync VPNs on PPPoE and such, as even with the same IP the VPN software is unhappy with the IP disappearing.
136 136
		if (in_array($config['interfaces'][$interface]['ipaddrv6'], array('pppoe', 'pptp', 'ppp'))) {
137 137
			/* reconfigure IPsec tunnels */
138
			vpn_ipsec_force_reload();
138
			vpn_ipsec_force_reload($interface);
139 139

  
140 140
			/* start OpenVPN server & clients */
141 141
			openvpn_resync_all($interface);
......
154 154
services_dyndns_configure($interface);
155 155

  
156 156
/* reconfigure IPsec tunnels */
157
vpn_ipsec_force_reload();
157
vpn_ipsec_force_reload($interface);
158 158

  
159 159
/* start OpenVPN server & clients */
160 160
if (substr($interface_real, 0, 4) != "ovpn")

Also available in: Unified diff