From adfbd2a52d486b2d07fd6ea86f2f82b8c2641720 Mon Sep 17 00:00:00 2001 From: Fabian Franz Date: Fri, 1 Sep 2017 10:25:55 +0200 Subject: [PATCH] Add Filter reload to quagga start and reload action (#240) * Add Filter reload to quagga start and reload action Also replace " by ' * psr2; move filter rules after the service * fix typo --- .../OPNsense/Quagga/Api/ServiceController.php | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/ServiceController.php b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/ServiceController.php index 6a43e0bc6..e55258683 100644 --- a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/ServiceController.php +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/ServiceController.php @@ -41,17 +41,19 @@ use \OPNsense\Quagga\General; class ServiceController extends ApiControllerBase { /** - * start quagga service (in background) + * start quagga service and reload filter rules to pass OSPF + * before the bogon filter kills the routing protocol packets * @return array */ public function startAction() { if ($this->request->isPost()) { $backend = new Backend(); - $response = $backend->configdRun("quagga start", true); - return array("response" => $response); + $response = $backend->configdRun('quagga start'); + $backend->configdRun('filter reload'); + return array('response' => $response); } else { - return array("response" => array()); + return array('response' => array()); } } @@ -63,10 +65,10 @@ class ServiceController extends ApiControllerBase { if ($this->request->isPost()) { $backend = new Backend(); - $response = $backend->configdRun("quagga stop"); - return array("response" => $response); + $response = $backend->configdRun('quagga stop'); + return array('response' => $response); } else { - return array("response" => array()); + return array('response' => array()); } } @@ -78,10 +80,11 @@ class ServiceController extends ApiControllerBase { if ($this->request->isPost()) { $backend = new Backend(); - $response = $backend->configdRun("quagga restart"); - return array("response" => $response); + $response = $backend->configdRun('quagga restart'); + $backend->configdRun('filter reload'); + return array('response' => $response); } else { - return array("response" => array()); + return array('response' => array()); } } @@ -94,24 +97,24 @@ class ServiceController extends ApiControllerBase { $backend = new Backend(); $mdlGeneral = new General(); - $response = $backend->configdRun("quagga status"); + $response = $backend->configdRun('quagga status'); - if (strpos($response, "not running") > 0) { + if (strpos($response, 'not running') > 0) { if ($mdlGeneral->enabled->__toString() == 1) { - $status = "stopped"; + $status = 'stopped'; } else { - $status = "disabled"; + $status = 'disabled'; } - } elseif (strpos($response, "is running") > 0) { - $status = "running"; + } elseif (strpos($response, 'is running') > 0) { + $status = 'running'; } elseif ($mdlGeneral->enabled->__toString() == 0) { - $status = "disabled"; + $status = 'disabled'; } else { - $status = "unkown"; + $status = 'unknown'; } - return array("status" => $status); + return array('status' => $status); } /** @@ -139,9 +142,9 @@ class ServiceController extends ApiControllerBase $this->startAction(); } - return array("status" => "ok"); + return array('status' => 'ok'); } else { - return array("status" => "failed"); + return array('status' => 'failed'); } } }