quagga -> frr

This commit is contained in:
Fabian Franz
2017-11-28 18:28:01 +01:00
parent 3270f88c2d
commit 084e020661
67 changed files with 23388 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
PLUGIN_NAME= frr
PLUGIN_VERSION= 1.0.0
PLUGIN_COMMENT= FRR Routing Suite
PLUGIN_DEPENDS= frr ruby
PLUGIN_MAINTAINER= franz.fabian.94@gmail.com
PLUGIN_DEVEL= YES
.include "../../Mk/plugins.mk"
+3
View File
@@ -0,0 +1,3 @@
FRRouting (FRR) is an IP routing protocol suite for Linux and Unix platforms
which includes protocol daemons for BGP, IS-IS, OSPF and RIP. FRR has its roots
in the Quagga project.
+86
View File
@@ -0,0 +1,86 @@
<?php
/*
Copyright (C) 2017 Fabian Franz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
function ospfd_enabled()
{
$model = new \OPNsense\Quagga\OSPF();
if ((string)$model->enabled == '1') {
return true;
}
return false;
}
function frr_firewall($fw)
{
if (ospfd_enabled()) {
$ospf = new \OPNsense\Quagga\OSPF();
foreach ($ospf->networks->network->__items as $network) {
if ((string)$network->enabled == '1') {
$fw->registerFilterRule(
1, /* priority */
array(
'ipprotocol' => 'inet',
'protocol' => 'ospf',
'statetype' => 'keep',
'label' => 'Pass OSPF (autogenerated)',
'from' => $network->ipaddr . '/' . $network->netmask,
'to' => '224.0.0.0/4',
'direction' => 'in',
'type' => 'pass',
'disablereplyto' => 1,
'quick' => true
),
null
);
}
}
}
}
function frr_services()
{
global $config;
$services = array();
if (isset($config['OPNsense']['quagga']['general']['enabled']) && $config['OPNsense']['quagga']['general']['enabled'] == 1) {
$services[] = array(
'description' => gettext('Quagga is a deamon to add support of various routing protocols.'),
'configd' => array(
'restart' => array('quagga restart'),
'start' => array('quagga start'),
'stop' => array('quagga stop'),
),
'name' => 'quagga',
'pidfile' => '/var/run/quagga/zebra.pid'
);
}
return $services;
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,139 @@
<?php
/**
* Copyright (C) 2017 Frank Wall
* Copyright (C) 2017 Michael Muenz
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Quagga\Api;
use \OPNsense\Base\ApiControllerBase;
use \OPNsense\Core\Backend;
use \OPNsense\Core\Config;
/**
* Class DiagnosticsController
* @package OPNsense\Quagga
*/
class DiagnosticsController extends ApiControllerBase
{
/**
* show ip bgp
* @return array
*/
public function showipbgpAction()
{
$backend = new Backend();
$response = json_decode(trim($backend->configdRun("quagga diag-bgp2")));
return array("response" => $response);
}
/**
* show ip bgp summary
* @return array
*/
public function showipbgpsummaryAction()
{
$backend = new Backend();
$response = $backend->configdRun("quagga diag-bgp summary");
return array("response" => $response);
}
public function showrunningconfigAction()
{
$backend = new Backend();
$response = $backend->configdRun("quagga general-runningconfig");
return array("response" => $response);
}
private function get_ospf_information($name)
{
$backend = new Backend();
return array("response" => json_decode(trim($backend->configdRun("quagga ospf-$name"))));
}
private function get_ospf3_information($name)
{
$backend = new Backend();
return array("response" => json_decode(trim($backend->configdRun("quagga ospfv3-$name"))));
}
// OSPFv2
public function ospfoverviewAction()
{
return $this->get_ospf_information('overview');
}
public function ospfneighborAction()
{
return $this->get_ospf_information('neighbor');
}
public function ospfrouteAction()
{
return $this->get_ospf_information('route');
}
public function ospfdatabaseAction()
{
return $this->get_ospf_information('database');
}
public function ospfinterfaceAction()
{
return $this->get_ospf_information('interface');
}
// OSPFv3
public function ospfv3overviewAction()
{
return $this->get_ospf3_information('overview');
}
public function ospfv3neighborAction()
{
return $this->get_ospf3_information('neighbor');
}
public function ospfv3routeAction()
{
return $this->get_ospf3_information('route');
}
public function ospfv3databaseAction()
{
return $this->get_ospf3_information('database');
}
public function ospfv3interfaceAction()
{
return $this->get_ospf3_information('interface');
}
// General
private function get_general_information($name)
{
$backend = new Backend();
return array("response" => json_decode(trim($backend->configdRun("quagga general-$name")), true));
}
public function generalroutesAction()
{
return $this->get_general_information('routes');
}
public function logAction()
{
return $this->get_general_information('log')['response']['general_log'];
}
public function generalroutes6Action()
{
return $this->get_general_information('routes6');
}
}
@@ -0,0 +1,75 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 Fabian Franz
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Quagga\Api;
use \OPNsense\Base\ApiControllerBase;
use \OPNsense\Quagga\General;
use \OPNsense\Core\Config;
class GeneralController extends ApiControllerBase
{
public function getAction()
{
// define list of configurable settings
$result = array();
if ($this->request->isGet()) {
$mdlGeneral = new General();
$result['general'] = $mdlGeneral->getNodes();
}
return $result;
}
public function setAction()
{
$result = array("result"=>"failed");
if ($this->request->isPost()) {
// load model and update with provided data
$mdlGeneral = new General();
$mdlGeneral->setNodes($this->request->getPost("general"));
// perform validation
$valMsgs = $mdlGeneral->performValidation();
foreach ($valMsgs as $field => $msg) {
if (!array_key_exists("validations", $result)) {
$result["validations"] = array();
}
$result["validations"]["general.".$msg->getField()] = $msg->getMessage();
}
// serialize model to config and save
if ($valMsgs->count() == 0) {
$mdlGeneral->serializeToConfig();
Config::getInstance()->save();
$result["result"] = "saved";
}
}
return $result;
}
}
@@ -0,0 +1,196 @@
<?php
/*
* Copyright (C) 2015-2017 Deciso B.V.
* Copyright (C) 2015 Jos Schellevis
* Copyright (C) 2017 Fabian Franz
* Copyright (C) 2017 Michael Muenz
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Quagga\Api;
use \OPNsense\Quagga\OSPF6;
use \OPNsense\Core\Config;
use \OPNsense\Base\ApiMutableModelControllerBase;
use \OPNsense\Base\UIModelGrid;
class Ospf6settingsController extends ApiMutableModelControllerBase
{
static protected $internalModelName = 'OSPF6';
static protected $internalModelClass = '\OPNsense\Quagga\OSPF6';
public function getAction()
{
$result = array();
if ($this->request->isGet()) {
$mdlospf6 = new OSPF6();
$result['ospf6'] = $mdlospf6->getNodes();
}
return $result;
}
public function setAction()
{
$result = array("result"=>"failed");
if ($this->request->isPost()) {
// load model and update with provided data
$mdlospf6 = new OSPF6();
$mdlospf6->setNodes($this->request->getPost("ospf6"));
// perform validation
$valMsgs = $mdlospf6->performValidation();
foreach ($valMsgs as $field => $msg) {
if (!array_key_exists("validations", $result)) {
$result["validations"] = array();
}
$result["validations"]["general.".$msg->getField()] = $msg->getMessage();
}
// serialize model to config and save
if ($valMsgs->count() == 0) {
$mdlospf6->serializeToConfig();
Config::getInstance()->save();
$result["result"] = "saved";
}
}
return $result;
}
/////////////////////////////////////////////////////////////////////
public function searchInterfaceAction()
{
$this->sessionClose();
$mdlOSPF6 = $this->getModel();
$grid = new UIModelGrid($mdlOSPF6->interfaces->interface);
return $grid->fetchBindRequest(
$this->request,
array("enabled", "interfacename", "area", "networktype")
);
}
public function getInterfaceAction($uuid = null)
{
$mdlOSPF6 = $this->getModel();
if ($uuid != null) {
$node = $mdlOSPF6->getNodeByReference('interfaces.interface.' . $uuid);
if ($node != null) {
// return node
return array("interface" => $node->getNodes());
}
} else {
$node = $mdlOSPF6->interfaces->interface->add();
return array("interface" => $node->getNodes());
}
return array();
}
public function addInterfaceAction()
{
$result = array("result" => "failed");
if ($this->request->isPost() && $this->request->hasPost("interface")) {
$result = array("result" => "failed", "validations" => array());
$mdlOSPF6 = $this->getModel();
$node = $mdlOSPF6->interfaces->interface->Add();
$node->setNodes($this->request->getPost("interface"));
$valMsgs = $mdlOSPF6->performValidation();
foreach ($valMsgs as $field => $msg) {
$fieldnm = str_replace($node->__reference, "interface", $msg->getField());
$result["validations"][$fieldnm] = $msg->getMessage();
}
if (count($result['validations']) == 0) {
// save config if validated correctly
$mdlOSPF6->serializeToConfig();
Config::getInstance()->save();
unset($result['validations']);
$result["result"] = "saved";
}
}
return $result;
}
public function delInterfaceAction($uuid)
{
$result = array("result" => "failed");
if ($this->request->isPost()) {
$mdlOSPF6 = $this->getModel();
if ($uuid != null) {
if ($mdlOSPF6->interfaces->interface->del($uuid)) {
$mdlOSPF6->serializeToConfig();
Config::getInstance()->save();
$result['result'] = 'deleted';
} else {
$result['result'] = 'not found';
}
}
}
return $result;
}
public function setInterfaceAction($uuid)
{
if ($this->request->isPost() && $this->request->hasPost("interface")) {
$mdlNetwork = $this->getModel();
if ($uuid != null) {
$node = $mdlNetwork->getNodeByReference('interfaces.interface.' . $uuid);
if ($node != null) {
$result = array("result" => "failed", "validations" => array());
$interfaceInfo = $this->request->getPost("interface");
$node->setNodes($interfaceInfo);
$valMsgs = $mdlNetwork->performValidation();
foreach ($valMsgs as $field => $msg) {
$fieldnm = str_replace($node->__reference, "interface", $msg->getField());
$result["validations"][$fieldnm] = $msg->getMessage();
}
if (count($result['validations']) == 0) {
// save config if validated correctly
$mdlNetwork->serializeToConfig();
Config::getInstance()->save();
$result = array("result" => "saved");
}
return $result;
}
}
}
return array("result" => "failed");
}
public function toggle_handler($uuid, $elements, $element)
{
$result = array("result" => "failed");
if ($this->request->isPost()) {
$mdlNetwork = $this->getModel();
if ($uuid != null) {
$node = $mdlNetwork->getNodeByReference($elements . '.'. $element .'.' . $uuid);
if ($node != null) {
if ($node->enabled->__toString() == "1") {
$result['result'] = "Disabled";
$node->enabled = "0";
} else {
$result['result'] = "Enabled";
$node->enabled = "1";
}
// if item has toggled, serialize to config and save
$mdlNetwork->serializeToConfig();
Config::getInstance()->save();
}
}
}
return $result;
}
public function toggleInterfaceAction($uuid)
{
return $this->toggle_handler($uuid, 'interfaces', 'interface');
}
}
@@ -0,0 +1,408 @@
<?php
/*
* Copyright (C) 2015-2017 Deciso B.V.
* Copyright (C) 2015 Jos Schellevis
* Copyright (C) 2017 Fabian Franz
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Quagga\Api;
use \OPNsense\Quagga\OSPF;
use \OPNsense\Core\Config;
use \OPNsense\Base\ApiMutableModelControllerBase;
use \OPNsense\Base\UIModelGrid;
class OspfsettingsController extends ApiMutableModelControllerBase
{
static protected $internalModelName = 'OSPF';
static protected $internalModelClass = '\OPNsense\Quagga\OSPF';
public function getAction()
{
$result = array();
if ($this->request->isGet()) {
$mdlospf = new OSPF();
$result['ospf'] = $mdlospf->getNodes();
}
return $result;
}
public function setAction()
{
$result = array("result"=>"failed");
if ($this->request->isPost()) {
// load model and update with provided data
$mdlospf = new OSPF();
$mdlospf->setNodes($this->request->getPost("ospf"));
// perform validation
$valMsgs = $mdlospf->performValidation();
foreach ($valMsgs as $field => $msg) {
if (!array_key_exists("validations", $result)) {
$result["validations"] = array();
}
$result["validations"]["general.".$msg->getField()] = $msg->getMessage();
}
// serialize model to config and save
if ($valMsgs->count() == 0) {
$mdlospf->serializeToConfig();
Config::getInstance()->save();
$result["result"] = "saved";
}
}
return $result;
}
/////////////////////////////////////////////////////////////////////
public function searchNetworkAction()
{
$this->sessionClose();
$mdlOSPF = $this->getModel();
$grid = new UIModelGrid($mdlOSPF->networks->network);
return $grid->fetchBindRequest(
$this->request,
array("enabled", "ipaddr", "netmask", "area")
);
}
public function searchInterfaceAction()
{
$this->sessionClose();
$mdlOSPF = $this->getModel();
$grid = new UIModelGrid($mdlOSPF->interfaces->interface);
return $grid->fetchBindRequest(
$this->request,
array("enabled", "interfacename", "networktype", "authtype", "area")
);
}
public function searchPrefixlistAction()
{
$this->sessionClose();
$mdlOSPF = $this->getModel();
$grid = new UIModelGrid($mdlOSPF->prefixlists->prefixlist);
return $grid->fetchBindRequest(
$this->request,
array("enabled", "name", "seqnumber", "action", "network" )
);
}
public function getNetworkAction($uuid = null)
{
$mdlOSPF = $this->getModel();
if ($uuid != null) {
$node = $mdlOSPF->getNodeByReference('networks.network.' . $uuid);
if ($node != null) {
// return node
return array("network" => $node->getNodes());
}
} else {
$node = $mdlOSPF->networks->network->add();
return array("network" => $node->getNodes());
}
return array();
}
public function getInterfaceAction($uuid = null)
{
$mdlOSPF = $this->getModel();
if ($uuid != null) {
$node = $mdlOSPF->getNodeByReference('interfaces.interface.' . $uuid);
if ($node != null) {
// return node
return array("interface" => $node->getNodes());
}
} else {
$node = $mdlOSPF->interfaces->interface->add();
return array("interface" => $node->getNodes());
}
return array();
}
public function getPrefixlistAction($uuid = null)
{
$mdlOSPF = $this->getModel();
if ($uuid != null) {
$node = $mdlOSPF->getNodeByReference('prefixlists.prefixlist.' . $uuid);
if ($node != null) {
// return node
return array("prefixlist" => $node->getNodes());
}
} else {
$node = $mdlOSPF->prefixlists->prefixlist->add();
return array("prefixlist" => $node->getNodes());
}
return array();
}
public function addNetworkAction()
{
$result = array("result" => "failed");
if ($this->request->isPost() && $this->request->hasPost("network")) {
$result = array("result" => "failed", "validations" => array());
$mdlOSPF = $this->getModel();
$node = $mdlOSPF->networks->network->Add();
$node->setNodes($this->request->getPost("network"));
$valMsgs = $mdlOSPF->performValidation();
foreach ($valMsgs as $field => $msg) {
$fieldnm = str_replace($node->__reference, "network", $msg->getField());
$result["validations"][$fieldnm] = $msg->getMessage();
}
if (count($result['validations']) == 0) {
// save config if validated correctly
$mdlOSPF->serializeToConfig();
Config::getInstance()->save();
unset($result['validations']);
$result["result"] = "saved";
}
}
return $result;
}
public function addInterfaceAction()
{
$result = array("result" => "failed");
if ($this->request->isPost() && $this->request->hasPost("interface")) {
$result = array("result" => "failed", "validations" => array());
$mdlOSPF = $this->getModel();
$node = $mdlOSPF->interfaces->interface->Add();
$node->setNodes($this->request->getPost("interface"));
$valMsgs = $mdlOSPF->performValidation();
foreach ($valMsgs as $field => $msg) {
$fieldnm = str_replace($node->__reference, "interface", $msg->getField());
$result["validations"][$fieldnm] = $msg->getMessage();
}
if (count($result['validations']) == 0) {
// save config if validated correctly
$mdlOSPF->serializeToConfig();
Config::getInstance()->save();
unset($result['validations']);
$result["result"] = "saved";
}
}
return $result;
}
public function addPrefixlistAction()
{
$result = array("result" => "failed");
if ($this->request->isPost() && $this->request->hasPost("prefixlist")) {
$result = array("result" => "failed", "validations" => array());
$mdlOSPF = $this->getModel();
$node = $mdlOSPF->prefixlists->prefixlist->Add();
$node->setNodes($this->request->getPost("prefixlist"));
$valMsgs = $mdlOSPF->performValidation();
foreach ($valMsgs as $field => $msg) {
$fieldnm = str_replace($node->__reference, "prefixlist", $msg->getField());
$result["validations"][$fieldnm] = $msg->getMessage();
}
if (count($result['validations']) == 0) {
// save config if validated correctly
$mdlOSPF->serializeToConfig();
Config::getInstance()->save();
unset($result['validations']);
$result["result"] = "saved";
}
}
return $result;
}
public function delNetworkAction($uuid)
{
$result = array("result" => "failed");
if ($this->request->isPost()) {
$mdlOSPF = $this->getModel();
if ($uuid != null) {
if ($mdlOSPF->networks->network->del($uuid)) {
$mdlOSPF->serializeToConfig();
Config::getInstance()->save();
$result['result'] = 'deleted';
} else {
$result['result'] = 'not found';
}
}
}
return $result;
}
public function delInterfaceAction($uuid)
{
$result = array("result" => "failed");
if ($this->request->isPost()) {
$mdlOSPF = $this->getModel();
if ($uuid != null) {
if ($mdlOSPF->interfaces->interface->del($uuid)) {
$mdlOSPF->serializeToConfig();
Config::getInstance()->save();
$result['result'] = 'deleted';
} else {
$result['result'] = 'not found';
}
}
}
return $result;
}
public function delPrefixlistAction($uuid)
{
$result = array("result" => "failed");
if ($this->request->isPost()) {
$mdlOSPF = $this->getModel();
if ($uuid != null) {
if ($mdlOSPF->prefixlists->prefixlist->del($uuid)) {
$mdlOSPF->serializeToConfig();
Config::getInstance()->save();
$result['result'] = 'deleted';
} else {
$result['result'] = 'not found';
}
}
}
return $result;
}
public function setNetworkAction($uuid)
{
if ($this->request->isPost() && $this->request->hasPost("network")) {
$mdlNetwork = $this->getModel();
if ($uuid != null) {
$node = $mdlNetwork->getNodeByReference('networks.network.' . $uuid);
if ($node != null) {
$result = array("result" => "failed", "validations" => array());
$networkInfo = $this->request->getPost("network");
$node->setNodes($networkInfo);
$valMsgs = $mdlNetwork->performValidation();
foreach ($valMsgs as $field => $msg) {
$fieldnm = str_replace($node->__reference, "network", $msg->getField());
$result["validations"][$fieldnm] = $msg->getMessage();
}
if (count($result['validations']) == 0) {
// save config if validated correctly
$mdlNetwork->serializeToConfig();
Config::getInstance()->save();
$result = array("result" => "saved");
}
return $result;
}
}
}
return array("result" => "failed");
}
public function setInterfaceAction($uuid)
{
if ($this->request->isPost() && $this->request->hasPost("interface")) {
$mdlNetwork = $this->getModel();
if ($uuid != null) {
$node = $mdlNetwork->getNodeByReference('interfaces.interface.' . $uuid);
if ($node != null) {
$result = array("result" => "failed", "validations" => array());
$interfaceInfo = $this->request->getPost("interface");
$node->setNodes($interfaceInfo);
$valMsgs = $mdlNetwork->performValidation();
foreach ($valMsgs as $field => $msg) {
$fieldnm = str_replace($node->__reference, "interface", $msg->getField());
$result["validations"][$fieldnm] = $msg->getMessage();
}
if (count($result['validations']) == 0) {
// save config if validated correctly
$mdlNetwork->serializeToConfig();
Config::getInstance()->save();
$result = array("result" => "saved");
}
return $result;
}
}
}
return array("result" => "failed");
}
public function setPrefixlistAction($uuid)
{
if ($this->request->isPost() && $this->request->hasPost("prefixlist")) {
$mdlNeighbor = $this->getModel();
if ($uuid != null) {
$node = $mdlNeighbor->getNodeByReference('prefixlists.prefixlist.' . $uuid);
if ($node != null) {
$result = array("result" => "failed", "validations" => array());
$prefixlistInfo = $this->request->getPost("prefixlist");
$node->setNodes($prefixlistInfo);
$valMsgs = $mdlNeighbor->performValidation();
foreach ($valMsgs as $field => $msg) {
$fieldnm = str_replace($node->__reference, "prefixlist", $msg->getField());
$result["validations"][$fieldnm] = $msg->getMessage();
}
if (count($result['validations']) == 0) {
// save config if validated correctly
$mdlNeighbor->serializeToConfig();
Config::getInstance()->save();
$result = array("result" => "saved");
}
return $result;
}
}
}
return array("result" => "failed");
}
public function toggle_handler($uuid, $elements, $element)
{
$result = array("result" => "failed");
if ($this->request->isPost()) {
$mdlNetwork = $this->getModel();
if ($uuid != null) {
$node = $mdlNetwork->getNodeByReference($elements . '.'. $element .'.' . $uuid);
if ($node != null) {
if ($node->enabled->__toString() == "1") {
$result['result'] = "Disabled";
$node->enabled = "0";
} else {
$result['result'] = "Enabled";
$node->enabled = "1";
}
// if item has toggled, serialize to config and save
$mdlNetwork->serializeToConfig();
Config::getInstance()->save();
}
}
}
return $result;
}
public function toggleNetworkAction($uuid)
{
return $this->toggle_handler($uuid, 'networks', 'network');
}
public function toggleInterfaceAction($uuid)
{
return $this->toggle_handler($uuid, 'interfaces', 'interface');
}
public function togglePrefixlistAction($uuid)
{
return $this->toggle_handler($uuid, 'prefixlists', 'prefixlist');
}
}
@@ -0,0 +1,75 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 Fabian Franz
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Quagga\Api;
use \OPNsense\Base\ApiControllerBase;
use \OPNsense\Quagga\RIP;
use \OPNsense\Core\Config;
class RipController extends ApiControllerBase
{
public function getAction()
{
// define list of configurable settings
$result = array();
if ($this->request->isGet()) {
$mdlRIP = new RIP();
$result['rip'] = $mdlRIP->getNodes();
}
return $result;
}
public function setAction()
{
$result = array("result"=>"failed");
if ($this->request->isPost()) {
// load model and update with provided data
$mdlRIP = new RIP();
$mdlRIP->setNodes($this->request->getPost("rip"));
// perform validation
$valMsgs = $mdlRIP->performValidation();
foreach ($valMsgs as $field => $msg) {
if (!array_key_exists("validations", $result)) {
$result["validations"] = array();
}
$result["validations"]["rip.".$msg->getField()] = $msg->getMessage();
}
// serialize model to config and save
if ($valMsgs->count() == 0) {
$mdlRIP->serializeToConfig();
Config::getInstance()->save();
$result["result"] = "saved";
}
}
return $result;
}
}
@@ -0,0 +1,150 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 Fabian Franz
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Quagga\Api;
use \OPNsense\Base\ApiControllerBase;
use \OPNsense\Core\Backend;
use \OPNsense\Quagga\General;
/**
* Class ServiceController
* @package OPNsense\Quagga
*/
class ServiceController extends ApiControllerBase
{
/**
* 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');
$backend->configdRun('filter reload');
return array('response' => $response);
} else {
return array('response' => array());
}
}
/**
* stop quagga service
* @return array
*/
public function stopAction()
{
if ($this->request->isPost()) {
$backend = new Backend();
$response = $backend->configdRun('quagga stop');
return array('response' => $response);
} else {
return array('response' => array());
}
}
/**
* restart quagga service
* @return array
*/
public function restartAction()
{
if ($this->request->isPost()) {
$backend = new Backend();
$response = $backend->configdRun('quagga restart');
$backend->configdRun('filter reload');
return array('response' => $response);
} else {
return array('response' => array());
}
}
/**
* retrieve status of quagga
* @return array
* @throws \Exception
*/
public function statusAction()
{
$backend = new Backend();
$mdlGeneral = new General();
$response = $backend->configdRun('quagga status');
if (strpos($response, 'not running') > 0) {
if ($mdlGeneral->enabled->__toString() == 1) {
$status = 'stopped';
} else {
$status = 'disabled';
}
} elseif (strpos($response, 'is running') > 0) {
$status = 'running';
} elseif ($mdlGeneral->enabled->__toString() == 0) {
$status = 'disabled';
} else {
$status = 'unknown';
}
return array('status' => $status);
}
/**
* reconfigure quagga, generate config and reload
*/
public function reconfigureAction()
{
if ($this->request->isPost()) {
// close session for long running action
$this->sessionClose();
$mdlGeneral = new General();
$backend = new Backend();
$runStatus = $this->statusAction();
// stop quagga if it is running or not
$this->stopAction();
// generate template
$backend->configdRun('template reload OPNsense/Quagga');
// (res)start daemon
if ($mdlGeneral->enabled->__toString() == 1) {
$this->startAction();
}
return array('status' => 'ok');
} else {
return array('status' => 'failed');
}
}
}
@@ -0,0 +1,39 @@
<?php
/*
Copyright (C) 2017 Fabian Franz
Copyright (C) 2017 Michael Muenz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Quagga;
class BgpController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->title = gettext("BGP Settings");
$this->view->bgpForm = $this->getForm("bgp");
$this->view->formDialogEditBGPNeighbor = $this->getForm("dialogEditBGPNeighbor");
$this->view->formDialogEditBGPASPaths = $this->getForm("dialogEditBGPASPath");
$this->view->formDialogEditBGPPrefixLists = $this->getForm("dialogEditBGPPrefixLists");
$this->view->formDialogEditBGPRouteMaps = $this->getForm("dialogEditBGPRouteMaps");
$this->view->pick('OPNsense/Quagga/bgp');
}
}
@@ -0,0 +1,55 @@
<?php
/*
Copyright (C) 2017 Fabian Franz
Copyright (C) 2017 Michael Muenz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Quagga;
class DiagnosticsController extends \OPNsense\Base\IndexController
{
public function bgpAction()
{
$this->view->title = gettext("Diagnostics: BGP");
$this->view->diagnosticsForm = $this->getForm("diagnostics");
$this->view->pick('OPNsense/Quagga/diagnosticsbgp');
}
public function ospfAction()
{
$this->view->title = gettext("Diagnostics: OSPF");
$this->view->pick('OPNsense/Quagga/diagnosticsospf');
}
public function ospfv3Action()
{
$this->view->title = gettext("Diagnostics: OSPFv3");
$this->view->pick('OPNsense/Quagga/diagnosticsospfv3');
}
public function generalAction()
{
$this->view->title = gettext("Diagnostics: General");
$this->view->pick('OPNsense/Quagga/diagnosticsgeneral');
}
public function logAction()
{
$this->view->title = gettext("Diagnostics: Log");
$this->view->pick('OPNsense/Quagga/log');
}
}
@@ -0,0 +1,38 @@
<?php
/*
Copyright (C) 2017 Fabian Franz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Quagga;
class GeneralController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->title = gettext("Routing-Settings");
$this->view->generalForm = $this->getForm("general");
$this->view->pick('OPNsense/Quagga/general');
}
}
@@ -0,0 +1,38 @@
<?php
/*
Copyright (C) 2017 Fabian Franz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Quagga;
class IsisController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->title = gettext("IS-IS-Settings");
$this->view->generalForm = $this->getForm("isis");
$this->view->pick('OPNsense/Quagga/isis');
}
}
@@ -0,0 +1,36 @@
<?php
/*
Copyright (C) 2017 Fabian Franz
Copyright (C) 2017 Michael Muenz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Quagga;
class Ospf6Controller extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->title = gettext("OSPFv3 Settings");
$this->view->ospf6Form = $this->getForm("ospf6");
$this->view->formDialogEditInterface = $this->getForm("dialogEditOSPF6Interface");
$this->view->pick('OPNsense/Quagga/ospf6');
}
}
@@ -0,0 +1,41 @@
<?php
/*
Copyright (C) 2017 Fabian Franz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Quagga;
class OspfController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->title = gettext("OSPF Settings");
$this->view->generalForm = $this->getForm("ospf");
$this->view->formDialogEditNetwork = $this->getForm("dialogEditOSPFNetwork");
$this->view->formDialogEditInterface = $this->getForm("dialogEditOSPFInterface");
$this->view->formDialogEditPrefixLists = $this->getForm("dialogEditOSPFPrefixLists");
$this->view->pick('OPNsense/Quagga/ospf');
}
}
@@ -0,0 +1,38 @@
<?php
/*
Copyright (C) 2017 Fabian Franz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Quagga;
class RipController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->title = gettext("RIP Settings");
$this->view->ripForm = $this->getForm("rip");
$this->view->pick('OPNsense/Quagga/rip');
}
}
@@ -0,0 +1,30 @@
<form>
<field>
<id>bgp.enabled</id>
<label>enable</label>
<type>checkbox</type>
<help>This will activate the bgp service.</help>
</field>
<field>
<id>bgp.asnumber</id>
<label>BGP AS Number</label>
<type>text</type>
<help>Your AS Number here</help>
</field>
<field>
<id>bgp.networks</id>
<label>Network</label>
<style>tokenize</style>
<type>select_multiple</type>
<allownew>true</allownew>
<help>Select the network to advertise, you have to set a Null route via System -> Routes</help>
</field>
<field>
<id>bgp.redistribute</id>
<label>Route Redistribution</label>
<type>select_multiple</type>
<style>tokenize</style>
<help><![CDATA[Select other routing sources, which should be redistributed to the other nodes.]]></help>
<hint>Type or select a route source.</hint>
</field>
</form>
@@ -0,0 +1,8 @@
<form>
<field>
<id>diagnostics.bgpneighbor</id>
<label>BGP Neighbor</label>
<type>text</type>
<hint>One of the neighbor IPs</hint>
</field>
</form>
@@ -0,0 +1,26 @@
<form>
<field>
<id>aspath.enabled</id>
<label>Enabled</label>
<type>checkbox</type>
<help>Enable / Disable</help>
</field>
<field>
<id>aspath.number</id>
<label>Number</label>
<type>text</type>
<help>The ACL rule number (10-99); keep in mind that there are no sequence numbers with AS-Path lists. When you want to add a new line between you have to completely remove the ACL!</help>
</field>
<field>
<id>aspath.action</id>
<label>Action</label>
<type>select_multiple</type>
<help>Set permit for match or deny to negate the rule.</help>
</field>
<field>
<id>aspath.as</id>
<label>AS</label>
<type>text</type>
<help>The AS pattern you want to match, regexp allowed (e.g. .$ or _1$). It's not validated so please be careful!</help>
</field>
</form>

Some files were not shown because too many files have changed in this diff Show More