summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarat Nepomnyashy <marat@vyatta.com>2008-02-22 16:28:25 -0800
committerMarat Nepomnyashy <marat@vyatta.com>2008-02-22 16:28:25 -0800
commit549f626d730702fb9da846febb4e0d563cb4312c (patch)
tree2585b08ce37d23c6fc78e0018bfc1fe80038b97b
parenta4f68f371730e3d55e72ece0532635aaf8553763 (diff)
downloadvyatta-op-vpn-549f626d730702fb9da846febb4e0d563cb4312c.tar.gz
vyatta-op-vpn-549f626d730702fb9da846febb4e0d563cb4312c.zip
Initialize variable and check for invalid args.
-rwxr-xr-xscripts/vyatta-vpn-op.pl14
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/vyatta-vpn-op.pl b/scripts/vyatta-vpn-op.pl
index bd785e2..4b519ba 100755
--- a/scripts/vyatta-vpn-op.pl
+++ b/scripts/vyatta-vpn-op.pl
@@ -4,9 +4,16 @@ use strict;
use lib "/opt/vyatta/share/perl5/";
use Getopt::Long;
-my $op;
+my $op='';
GetOptions("op=s" => \$op);
+if ($op eq '') {
+ die 'No op specified';
+}
+
+if ($op eq 'clear-vpn-ipsec-process') {
+ system '/usr/sbin/ipsec setup restart';
+}
if ($op eq 'show-vpn-debug') {
system '/usr/sbin/ipsec auto --status';
}
@@ -14,8 +21,5 @@ if ($op eq 'show-vpn-debug-detail') {
system '/usr/sbin/ipsec barf';
}
-if ($op eq 'clear-vpn-ipsec-process') {
- system '/usr/sbin/ipsec setup restart';
-}
-
+die "Unknown op: $op";