From 669fb2ebd03ac5e9b0806acb1c200e71e69b3d47 Mon Sep 17 00:00:00 2001 From: Guillaume Mazoyer Date: Mon, 13 Jun 2016 00:00:32 +0200 Subject: Catch use of disable IP version before instanciating the router object. Simplify the code and avoid unneeded computation. --- routers/bird.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'routers/bird.php') 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.'); } -- cgit v1.2.3