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/quagga.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'routers/quagga.php') diff --git a/routers/quagga.php b/routers/quagga.php index bc91cdf..01d4387 100644 --- a/routers/quagga.php +++ b/routers/quagga.php @@ -109,17 +109,9 @@ final class Quagga 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[] = $vtysh.'show bgp ipv6 unicast '.$parameter.'"'; - } + $commands[] = $vtysh.'show bgp ipv6 unicast '.$parameter.'"'; } else if (match_ipv4($parameter, false)) { - if ($this->global_config['misc']['disable_ipv4']) { - throw new Exception('IPv4 is disabled.'); - } else { - $commands[] = $vtysh.'show bgp ipv4 unicast '.$parameter.'"'; - } + $commands[] = $vtysh.'show bgp ipv4 unicast '.$parameter.'"'; } else { throw new Exception('The parameter is not an IP address.'); } -- cgit v1.2.3