summaryrefslogtreecommitdiff
path: root/scripts/vyatta-show-vpn.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/vyatta-show-vpn.pl')
-rwxr-xr-xscripts/vyatta-show-vpn.pl12
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/vyatta-show-vpn.pl b/scripts/vyatta-show-vpn.pl
index 6f896c2..f1c1078 100755
--- a/scripts/vyatta-show-vpn.pl
+++ b/scripts/vyatta-show-vpn.pl
@@ -44,10 +44,14 @@ if ($arg0 eq 'secrets') {
print "Local Peer Secret\n";
print "-------- ------- ------\n";
foreach my $line (@raw_data) {
- if ($line =~ /PSK/) {
- my ($lip, $pip, $secret) = $line =~ /^(\S+)\s+(\S+)\s+\:\s+PSK\s+(\"\S+\")/;
- printf "%-15s %-15s %s\n", $lip, $pip, $secret;
- }
+ if ($line =~ /PSK/) {
+ my ($lip, $pip, $secret) = ('', '', '');
+ ($secret) = $line =~ /.*:\s+PSK\s+(\"\S+\")/;
+ ($lip, $pip) = $line =~ /^(\S+)\s+(\S+)\s+\:\s+PSK\s+\"\S+\"/;
+ $lip = '0.0.0.0' if ! defined $lip;
+ $pip = '0.0.0.0' if ! defined $pip;
+ printf "%-15s %-15s %s\n", $lip, $pip, $secret;
+ }
}
exit 0;
}