diff options
author | Saurabh Mohan <saurabh.mohan@vyatta.com> | 2013-02-05 15:00:20 -0800 |
---|---|---|
committer | Saurabh Mohan <saurabh.mohan@vyatta.com> | 2013-02-05 15:00:20 -0800 |
commit | 19a58bed0818f19c1e970c2bc5e128325a322c54 (patch) | |
tree | e61c50b2c88900151f0b2cc7e1edac087a70585a /scripts/vyatta-dmvpn-op.pl | |
parent | ce9f2a2431952aa429553c3d181e0ea976004891 (diff) | |
download | vyatta-op-vpn-19a58bed0818f19c1e970c2bc5e128325a322c54.tar.gz vyatta-op-vpn-19a58bed0818f19c1e970c2bc5e128325a322c54.zip |
Merge + support show vpn ipsec sa detail/statistics profile
Diffstat (limited to 'scripts/vyatta-dmvpn-op.pl')
-rw-r--r-- | scripts/vyatta-dmvpn-op.pl | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/scripts/vyatta-dmvpn-op.pl b/scripts/vyatta-dmvpn-op.pl index 4a33498..8f27596 100644 --- a/scripts/vyatta-dmvpn-op.pl +++ b/scripts/vyatta-dmvpn-op.pl @@ -33,16 +33,30 @@ sub clear_tunnel { print "Resetting tunnel $tunnel with profile $profile...\n"; # turn down the connection - `sudo ipsec down dmvpn-$profile-tunnel-$tunnel`; + `sudo ipsec down vpnprof-tunnel-$tunnel`; # sleep for 1/4th of a second for connection to go down `sudo sleep 0.25`; - # turn connection up - `sudo ipsec up dmvpn-$profile-tunnel-$tunnel`; + # turn connection up. For conns with 'right=%any' it's useless to up, so commented it + #`sudo ipsec up vpnprof-tunnel-$tunnel`; # sleep for 3/4th of a second for connection to come up - `sudo sleep 0.75`; + #`sudo sleep 0.75`; + + my @addresses = split(' ', `cli-shell-api returnActiveValues interfaces tunnel $tunnel address`); + for my $addr (@addresses) { + $addr =~ /'(.*)\.(.*)\.(.*)\.(.*)\//; + my $pattern = "$1.$2.$3.$4-to-"; + my $line = `sudo ipsec statusall | grep $pattern | head -n 1`; + if ($line =~ /\"(.*-to-.*)\"/) { + my $conn = $1; + `sudo ipsec down $conn`; + #Actually, we don't need timeouts here cause this script will wait child process to be finished. + `sudo ipsec up $conn`; + } + } + } if ($op eq '') { |