diff options
author | UnicronNL <khagen@multi.eu> | 2016-03-23 13:10:43 +0100 |
---|---|---|
committer | UnicronNL <khagen@multi.eu> | 2016-03-23 13:10:43 +0100 |
commit | 7308178f1b9925064b728a53d79bbdcaef6eaf20 (patch) | |
tree | c123ebafc271f8ab82ea9d186aab1a51b37abb78 /scripts | |
parent | 82b5e5a3763affe18d77f707f614ccc56d0c84d6 (diff) | |
download | vyatta-cfg-vpn-7308178f1b9925064b728a53d79bbdcaef6eaf20.tar.gz vyatta-cfg-vpn-7308178f1b9925064b728a53d79bbdcaef6eaf20.zip |
load swanctl configuration on ipsec start
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/dmvpn-config.pl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/dmvpn-config.pl b/scripts/dmvpn-config.pl index 5052211..6fa180d 100755 --- a/scripts/dmvpn-config.pl +++ b/scripts/dmvpn-config.pl @@ -491,11 +491,35 @@ if ( is_vpn_running() ) { else { if ( !defined($update_interval) ) { vpn_exec( 'ipsec start >&/dev/null', 'start ipsec' ); + my $counter = 10; + while($counter > 0){ + if (-e "/var/run/charon.pid") { + vpn_exec( 'swanctl -q >&/dev/null', 'reload changes to swanctl.conf' ); + last; + } + $counter--; + sleep(1); + if($counter == 0){ + vpn_die("$vpn_cfg_err Ipsec is not running."); + } + } } else { vpn_exec( 'ipsec start --auto-update ' . $update_interval . ' >&/dev/null', 'start ipsec with auto-update $update_interval' ); + my $counter = 10; + while($counter > 0){ + if (-e "/var/run/charon.pid") { + vpn_exec( 'swanctl -q >&/dev/null', 'reload changes to swanctl.conf' ); + last; + } + $counter--; + sleep(1); + if($counter == 0){ + vpn_die("$vpn_cfg_err Ipsec is not running."); + } + } } } |