diff options
author | Daniil Baturin <daniil@baturin.org> | 2017-07-03 22:51:12 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-03 22:51:12 +0700 |
commit | cce844b42a29bc00185555bbf7a2ec989eec8d8b (patch) | |
tree | 8f907e839ec936d691983781fad8ea59439a0395 | |
parent | b1159f96a27fa39b8b3b71940efff602b468cf65 (diff) | |
parent | 46c10df71f00f215d6aaa15a3b00e946679a0328 (diff) | |
download | vyatta-op-vpn-cce844b42a29bc00185555bbf7a2ec989eec8d8b.tar.gz vyatta-op-vpn-cce844b42a29bc00185555bbf7a2ec989eec8d8b.zip |
Merge pull request #19 from jules-vyos/current
Two fixes - for T319 and T303
-rw-r--r-- | lib/OPMode.pm | 12 | ||||
-rw-r--r-- | scripts/vyatta-show-ipsec-status.pl | 5 |
2 files changed, 10 insertions, 7 deletions
diff --git a/lib/OPMode.pm b/lib/OPMode.pm index ed57ea2..e304b2f 100644 --- a/lib/OPMode.pm +++ b/lib/OPMode.pm @@ -837,8 +837,8 @@ sub get_connection_status (my $peerid, my $tun) = @_; my %th = get_tunnel_info_peer($peerid); for my $peer ( keys %th ) { - if (%{$th{$peer}}->{_tunnelnum} eq $tun){ - return %{$th{$peer}}->{_state}; + if (${$th{$peer}}{_tunnelnum} eq $tun){ + return ${$th{$peer}}{_state}; } } } @@ -847,10 +847,10 @@ sub get_peer_ike_status my ($peerid) = @_; my %th = get_tunnel_info_peer($peerid); for my $peer ( keys %th ) { - if (%{$th{$peer}}->{_ikestate} eq 'up'){ + if (${$th{$peer}}{_ikestate} eq 'up'){ return 'up'; } - if (%{$th{$peer}}->{_ikestate} eq 'init'){ + if (${$th{$peer}}{_ikestate} eq 'init'){ return 'init'; } } @@ -862,7 +862,7 @@ sub show_ipsec_sa_natt my %tunnel_hash = get_tunnel_info(); my %tmphash = (); for my $peer ( keys %tunnel_hash ) { - if (%{$tunnel_hash{$peer}}->{_natt} == 1 ){ + if (${$tunnel_hash{$peer}>{_natt} == 1 ){ $tmphash{$peer} = \%{$tunnel_hash{$peer}}; } } @@ -905,7 +905,7 @@ sub show_ike_sa_natt my %tunnel_hash = get_tunnel_info(); my %tmphash = (); for my $peer ( keys %tunnel_hash ) { - if (%{$tunnel_hash{$peer}}->{_natt} == 1 ){ + if (${$tunnel_hash{$peer}}{_natt} == 1 ){ $tmphash{$peer} = \%{$tunnel_hash{$peer}}; } } diff --git a/scripts/vyatta-show-ipsec-status.pl b/scripts/vyatta-show-ipsec-status.pl index a96d1dd..bff36c8 100644 --- a/scripts/vyatta-show-ipsec-status.pl +++ b/scripts/vyatta-show-ipsec-status.pl @@ -98,7 +98,10 @@ sub relate_intfs_with_localips { # my $process_id = `sudo cat /var/run/charon.pid`; -my $active_tunnels = `sudo ipsec status 2>/dev/null | grep 'newest IPsec SA: #' | grep -v 'newest IPsec SA: #0' | wc -l`; +# Update to deal with new strongswan syntax for ipsec status command. +my $sa_summary = `sudo ipsec status 2>/dev/null | grep "Security Associations" `; +my $active_tunnels; +($active_tunnels) = $sa_summary =~ /\((.*?) up/; chomp $process_id; chomp $active_tunnels; my @vpn_interfaces = get_vpn_intfs(); |