From 4fc9117ddb70b3d62f6672ab3cfe51202f128872 Mon Sep 17 00:00:00 2001 From: Guillaume Mazoyer Date: Fri, 20 Jun 2014 20:42:58 +0200 Subject: Remove useless code. Fix undefined variable. Fix BIRD commands. --- routers/bird.php | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'routers') diff --git a/routers/bird.php b/routers/bird.php index 55f7ff9..16703c8 100644 --- a/routers/bird.php +++ b/routers/bird.php @@ -29,13 +29,9 @@ final class Bird extends Router { switch ($command) { case 'bgp': if (match_ipv4($parameters)) { - $commands[] = 'birdc'; - $commands[] = 'show route for '.$parameters; - $commands[] = 'exit'; + $commands[] = 'birdc show route for '.$parameters; } else if (match_ipv6($parameters)) { - $commands[] = 'birdc6'; - $commands[] = 'show route for '.$parameters; - $commands[] = 'exit'; + $commands[] = 'birdc6 show route for '.$parameters; } else { throw new Exception('The parameter is not an IPv4/IPv6 address.'); } @@ -43,12 +39,8 @@ final class Bird extends Router { case 'as-path-regex': if (match_aspath_regex($parameters)) { - $commands[] = 'birdc'; - $commands[] = 'show route where bgp_path ~ [= '.$parameters.' =]'; - $commands[] = 'exit'; - $commands[] = 'birdc6'; - $commands[] = 'show route where bgp_path ~ [= '.$parameters.' =]'; - $commands[] = 'exit'; + $commands[] = 'birdc show route where bgp_path ~ [= '.$parameters.' =]'; + $commands[] = 'birdc6 show route where bgp_path ~ [= '.$parameters.' =]'; } else { throw new Exception('The parameter is not an AS-Path regular expression like ".*XXXX YYYY.*".'); } @@ -56,12 +48,8 @@ final class Bird extends Router { case 'as': if (match_as($parameters)) { - $commands[] = 'birdc'; - $commands[] = 'show route where bgp_path ~ [= '.$parameters.' =]'; - $commands[] = 'exit'; - $commands[] = 'birdc6'; - $commands[] = 'show route where bgp_path ~ [= '.$parameters.' =]'; - $commands[] = 'exit'; + $commands[] = 'birdc show route where bgp_path ~ [= '.$parameters.' =]'; + $commands[] = 'birdc6 show route where bgp_path ~ [= '.$parameters.' =]'; } else { throw new Exception('The parameter is not an AS number.'); } -- cgit v1.2.3