diff options
author | Guillaume Mazoyer <gmazoyer@gravitons.in> | 2016-06-13 00:00:32 +0200 |
---|---|---|
committer | Guillaume Mazoyer <gmazoyer@gravitons.in> | 2016-06-13 00:00:32 +0200 |
commit | 669fb2ebd03ac5e9b0806acb1c200e71e69b3d47 (patch) | |
tree | 39aa2352c0f14e3f94dcf4c0237e8fc81c9a0bd7 /routers/bird.php | |
parent | 28bf462793fc9c15e70b73d3eb2223f6328abb84 (diff) |
Catch use of disable IP version before instanciating the router object.
Simplify the code and avoid unneeded computation.
Diffstat (limited to 'routers/bird.php')
-rw-r--r-- | routers/bird.php | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/routers/bird.php b/routers/bird.php index 34f1a96..5219cc2 100644 --- a/routers/bird.php +++ b/routers/bird.php @@ -110,17 +110,9 @@ final class Bird extends Router { switch ($command) { case 'bgp': if (match_ipv6($parameter, false)) { - if ($this->global_config['misc']['disable_ipv6']) { - throw new Exception('IPv6 is disabled.'); - } else { - $commands[] = $birdc6.' \'show route for '.$parameter.'\''; - } + $commands[] = $birdc6.' \'show route for '.$parameter.'\''; } else if (match_ipv4($parameter, false)) { - if ($this->global_config['misc']['disable_ipv4']) { - throw new Exception('IPv4 is disabled.'); - } else { - $commands[] = $birdc.' \'show route for '.$parameter.'\''; - } + $commands[] = $birdc.' \'show route for '.$parameter.'\''; } else { throw new Exception('The parameter is not an IP address.'); } |