diff options
author | John Southworth <john.southworth@vyatta.com> | 2011-01-28 11:42:02 -0600 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2011-01-28 11:42:02 -0600 |
commit | b0dfa14d58b980d82b5f5547132a90b148e216a3 (patch) | |
tree | 1fc7e44b99d62a1ebcbecac8067e7b09df4085c3 /scripts | |
parent | fa7fddc8531a3462a8614aa77113ce35766ffdc0 (diff) | |
download | vyatta-op-vpn-b0dfa14d58b980d82b5f5547132a90b148e216a3.tar.gz vyatta-op-vpn-b0dfa14d58b980d82b5f5547132a90b148e216a3.zip |
Work on new IPsec operational mode script. Fixed script to work when not in configure mode
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vyatta-op-vpn.pl | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/scripts/vyatta-op-vpn.pl b/scripts/vyatta-op-vpn.pl index 10e2300..63e0455 100755 --- a/scripts/vyatta-op-vpn.pl +++ b/scripts/vyatta-op-vpn.pl @@ -22,13 +22,15 @@ # # **** End License **** # -use lib "/opt/vyatta/share/perl5"; -use Vyatta::Config; use Getopt::Long; use strict; -my $statusall = $ARGV[0]; +sub process_shell_api { + my $path = pop(@_); + my $output = `cli-shell-api returnActiveValue $path`; + return $output; +} sub get_tunnel_info { my $cmd = "sudo ipsec statusall |"; open(IPSECSTATUS, $cmd); @@ -130,14 +132,17 @@ sub get_tunnel_info { for my $connectid ( keys %tunnel_hash) { # Get the static information from the Vyatta Configuration (my $peer, my $tunid) = ($connectid =~ /peer-(.*)-tunnel-(.*)/); - my $config = new Vyatta::Config; my $peerip = $peer; - $config->setLevel('vpn ipsec site-to-site'); - $tunnel_hash{$connectid}->{_leftid} = $config->returnValue("peer $peer authentication id"); - $tunnel_hash{$connectid}->{_rightid} = $config->returnValue("peer $peer authentication remote-id"); - $tunnel_hash{$connectid}->{_leftip} = $config->returnValue("peer $peer local-ip"); - $tunnel_hash{$connectid}->{_srcnet} = $config->returnValue("peer $peer tunnel $tunid local-subnet"); - $tunnel_hash{$connectid}->{_dstnet} = $config->returnValue("peer $peer tunnel $tunid remote-subnet"); + $tunnel_hash{$connectid}->{_leftid} = process_shell_api( + "vpn ipsec site-to-site peer $peer authentication id"); + $tunnel_hash{$connectid}->{_rightid} = process_shell_api( + "vpn ipsec site-to-site peer $peer authentication remote-id"); + $tunnel_hash{$connectid}->{_leftip} = process_shell_api( + "vpn ipsec site-to-site peer $peer local-ip"); + $tunnel_hash{$connectid}->{_srcnet} = process_shell_api( + "vpn ipsec site-to-site peer $peer tunnel $tunid local-subnet"); + $tunnel_hash{$connectid}->{_dstnet} = process_shell_api( + "vpn ipsec site-to-site peer $peer tunnel $tunid remote-subnet"); if ($peerip =~ /\@.*/){ $peerip = "0.0.0.0"; } elsif ($peerip =~ /"any"/){ |