diff options
author | Guillaume Mazoyer <respawneral@gmail.com> | 2014-06-20 20:42:58 +0200 |
---|---|---|
committer | Guillaume Mazoyer <respawneral@gmail.com> | 2014-06-20 20:42:58 +0200 |
commit | 4fc9117ddb70b3d62f6672ab3cfe51202f128872 (patch) | |
tree | b0f5a6f282f0427f01a4f8176b5e5a78d366419a /routers | |
parent | 9dcde5b501552b63314ca2b142ff2b849c4a023d (diff) |
Remove useless code.
Fix undefined variable.
Fix BIRD commands.
Diffstat (limited to 'routers')
-rw-r--r-- | routers/bird.php | 24 |
1 files changed, 6 insertions, 18 deletions
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.'); } |