summaryrefslogtreecommitdiff
path: root/scripts/vyatta-gateway-static_route-check.pl
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-16 09:58:58 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-16 09:58:58 -0700
commitf9ab046eddd19417c0b2bbe4c5afed2d4516b53f (patch)
treed563f2cb1b9d869ada58d94a4bf1e0b5181c8b21 /scripts/vyatta-gateway-static_route-check.pl
parent8b782b88bd535d739166d21a4cbb95931fff2ce0 (diff)
downloadvyatta-cfg-quagga-f9ab046eddd19417c0b2bbe4c5afed2d4516b53f.tar.gz
vyatta-cfg-quagga-f9ab046eddd19417c0b2bbe4c5afed2d4516b53f.zip
Reindent perl code
Make it look nice and tidy
Diffstat (limited to 'scripts/vyatta-gateway-static_route-check.pl')
-rwxr-xr-xscripts/vyatta-gateway-static_route-check.pl51
1 files changed, 27 insertions, 24 deletions
diff --git a/scripts/vyatta-gateway-static_route-check.pl b/scripts/vyatta-gateway-static_route-check.pl
index 51de1604..f550180d 100755
--- a/scripts/vyatta-gateway-static_route-check.pl
+++ b/scripts/vyatta-gateway-static_route-check.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# Module: vyatta-gateway-static_route-check.pl
+# Module: vyatta-gateway-static_route-check.pl
#
# **** License ****
# This program is free software; you can redistribute it and/or modify
@@ -35,37 +35,40 @@ use lib "/opt/vyatta/share/perl5/";
use NetAddr::IP;
use Vyatta::Config;
+if ( ( $#ARGV == 1 ) && ( $ARGV[0] eq '0.0.0.0/0' ) ) {
-if (($#ARGV == 1) && ($ARGV[0] eq '0.0.0.0/0')) {
# check when deleting static-route
my $vcCHECK_GATEWAY = new Vyatta::Config();
$vcCHECK_GATEWAY->setLevel('system');
if ( $vcCHECK_GATEWAY->exists('.') ) {
- my $gateway_ip = $vcCHECK_GATEWAY->returnValue('gateway-address');
- if ( defined($gateway_ip) && $gateway_ip eq $ARGV[1] ) {
- exit 1;
- }
+ my $gateway_ip = $vcCHECK_GATEWAY->returnValue('gateway-address');
+ if ( defined($gateway_ip) && $gateway_ip eq $ARGV[1] ) {
+ exit 1;
+ }
}
-
-} elsif ($#ARGV == 0) {
- # check when deleting gateway-address
+
+}
+elsif ( $#ARGV == 0 ) {
+
+ # check when deleting gateway-address
my $vcCHECK_STATIC_ROUTE = new Vyatta::Config();
$vcCHECK_STATIC_ROUTE->setLevel('protocols static');
if ( $vcCHECK_STATIC_ROUTE->exists('.') ) {
- my @routes = $vcCHECK_STATIC_ROUTE->listNodes("route");
- if (@routes > 0) {
- foreach my $route (@routes) {
- if ($route eq '0.0.0.0/0') {
- my @next_hops = $vcCHECK_STATIC_ROUTE->listNodes("route $route next-hop");
- foreach my $next_hop (@next_hops) {
- if ($next_hop eq $ARGV[0]) {
- exit 1;
- }
- }
- }
- }
- }
+ my @routes = $vcCHECK_STATIC_ROUTE->listNodes("route");
+ if ( @routes > 0 ) {
+ foreach my $route (@routes) {
+ if ( $route eq '0.0.0.0/0' ) {
+ my @next_hops =
+ $vcCHECK_STATIC_ROUTE->listNodes("route $route next-hop");
+ foreach my $next_hop (@next_hops) {
+ if ( $next_hop eq $ARGV[0] ) {
+ exit 1;
+ }
+ }
+ }
+ }
+ }
}
}
-
-exit 0;
+
+exit 0;