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 | |
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')
-rw-r--r-- | scripts/vyatta-dmvpn-op.pl | 22 | ||||
-rw-r--r-- | scripts/vyatta-op-vpnprof.pl | 5 |
2 files changed, 23 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 '') { diff --git a/scripts/vyatta-op-vpnprof.pl b/scripts/vyatta-op-vpnprof.pl index 2f173fb..3988e04 100644 --- a/scripts/vyatta-op-vpnprof.pl +++ b/scripts/vyatta-op-vpnprof.pl @@ -24,6 +24,7 @@ GetOptions("show-ipsec-sa!" => \$show_ipsec_sa, "show-ipsec-sa-profile-detail=s" => \$show_ipsec_sa_profile_detail, "show-ipsec-sa-stats!" => \$show_ipsec_sa_stats, "show-ipsec-sa-stats-profile=s" => \$show_ipsec_sa_stats_profile, + "show-ipsec-sa-stats-conn=s{2}" => \@show_ipsec_sa_stats_conn, "show-ipsec-sa-conn-detail=s{2}" => \@show_ipsec_sa_conn_detail, "show-ipsec-sa-conn=s{2}" => \@show_ipsec_sa_conn); @@ -57,3 +58,7 @@ if (defined $show_ipsec_sa_stats) { if (defined $show_ipsec_sa_stats_profile) { Vyatta::vpnprof::OPMode::show_ipsec_sa_stats_profile($show_ipsec_sa_stats_profile); } +if (defined @show_ipsec_sa_stats_conn) { + Vyatta::vpnprof::OPMode::show_ipsec_sa_stats_conn(@show_ipsec_sa_stats_conn); +} + |