From b6e79be7558fa53c2a3b7c47af40a9edd2ca3c49 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 13 Jul 2017 08:21:15 +0200 Subject: [PATCH] net/quagga: merge version 1.3.1 from master --- net/quagga/Makefile | 3 +- .../OPNsense/Quagga/Api/BgpController.php | 321 +++++++++++++++++- .../Quagga/Api/DiagnosticsController.php | 7 + .../OPNsense/Quagga/Api/GeneralController.php | 3 +- .../Quagga/Api/Ospf6settingsController.php | 1 + .../Quagga/Api/OspfsettingsController.php | 1 + .../OPNsense/Quagga/Api/RipController.php | 1 + .../OPNsense/Quagga/Api/ServiceController.php | 1 + .../OPNsense/Quagga/BgpController.php | 8 +- .../OPNsense/Quagga/GeneralController.php | 4 +- .../OPNsense/Quagga/IsisController.php | 26 ++ .../OPNsense/Quagga/RipController.php | 26 ++ .../Quagga/forms/dialogEditBGPASPath.xml | 26 ++ .../Quagga/forms/dialogEditBGPNeighbor.xml | 24 ++ .../Quagga/forms/dialogEditBGPPrefixLists.xml | 32 ++ .../Quagga/forms/dialogEditBGPRouteMaps.xml | 40 +++ .../mvc/app/models/OPNsense/Quagga/BGP.xml | 165 ++++++++- .../mvc/app/models/OPNsense/Quagga/OSPF6.php | 1 + .../mvc/app/views/OPNsense/Quagga/bgp.volt | 120 ++++++- .../OPNsense/Quagga/diagnosticsgeneral.volt | 8 +- .../OPNsense/Quagga/diagnosticsospf.volt | 24 +- .../OPNsense/Quagga/diagnosticsospfv3.volt | 28 +- .../mvc/app/views/OPNsense/Quagga/ospf6.volt | 2 +- .../src/opnsense/scripts/quagga/quagga.rb | 18 +- .../conf/actions.d/actions_quagga.conf | 6 + .../templates/OPNsense/Quagga/bgpd.conf | 73 ++++ 26 files changed, 907 insertions(+), 62 deletions(-) create mode 100644 net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPASPath.xml create mode 100644 net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPPrefixLists.xml create mode 100644 net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPRouteMaps.xml diff --git a/net/quagga/Makefile b/net/quagga/Makefile index 21c2b7a57..06f8711d8 100644 --- a/net/quagga/Makefile +++ b/net/quagga/Makefile @@ -1,6 +1,5 @@ PLUGIN_NAME= quagga -PLUGIN_VERSION= 1.2.0 -PLUGIN_REVISION= 1 +PLUGIN_VERSION= 1.3.1 PLUGIN_COMMENT= Quagga Routing Suite PLUGIN_DEPENDS= quagga ruby PLUGIN_MAINTAINER= franz.fabian.94@gmail.com diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/BgpController.php b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/BgpController.php index b7a391600..d6289196f 100644 --- a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/BgpController.php +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/BgpController.php @@ -1,12 +1,4 @@ neighbors->neighbor); return $grid->fetchBindRequest( $this->request, - array("enabled", "address", "remoteas", "updatesource", "nexthopself", "defaultoriginate" ) + array("enabled", "address", "remoteas", "updatesource", "nexthopself", "defaultoriginate", "linkedPrefixlistIn", "linkedPrefixlistOut", "linkedRoutemapIn", "linkedRoutemapOut" ) ); } @@ -120,6 +120,7 @@ class BgpController extends ApiMutableModelControllerBase // save config if validated correctly $mdlBGP->serializeToConfig(); Config::getInstance()->save(); + unset($result['validations']); $result["result"] = "saved"; } } @@ -172,6 +173,293 @@ class BgpController extends ApiMutableModelControllerBase return array("result" => "failed"); } + public function searchAspathAction() + { + $this->sessionClose(); + $mdlBGP = $this->getModel(); + $grid = new UIModelGrid($mdlBGP->aspaths->aspath); + return $grid->fetchBindRequest( + $this->request, + array("enabled", "number", "action", "as" ) + ); + } + + public function getAspathAction($uuid = null) + { + $mdlBGP = $this->getModel(); + if ($uuid != null) { + $node = $mdlBGP->getNodeByReference('aspaths.aspath.' . $uuid); + if ($node != null) { + // return node + return array("aspath" => $node->getNodes()); + } + } else { + $node = $mdlBGP->aspaths->aspath->add(); + return array("aspath" => $node->getNodes()); + } + return array(); + } + + public function addAspathAction() + { + $result = array("result" => "failed"); + if ($this->request->isPost() && $this->request->hasPost("aspath")) { + $result = array("result" => "failed", "validations" => array()); + $mdlBGP = $this->getModel(); + $node = $mdlBGP->aspaths->aspath->Add(); + $node->setNodes($this->request->getPost("aspath")); + $valMsgs = $mdlBGP->performValidation(); + foreach ($valMsgs as $field => $msg) { + $fieldnm = str_replace($node->__reference, "aspath", $msg->getField()); + $result["validations"][$fieldnm] = $msg->getMessage(); + } + if (count($result['validations']) == 0) { + // save config if validated correctly + $mdlBGP->serializeToConfig(); + Config::getInstance()->save(); + unset($result['validations']); + $result["result"] = "saved"; + } + } + return $result; + } + + public function delAspathAction($uuid) + { + $result = array("result" => "failed"); + if ($this->request->isPost()) { + $mdlBGP = $this->getModel(); + if ($uuid != null) { + if ($mdlBGP->aspaths->aspath->del($uuid)) { + $mdlBGP->serializeToConfig(); + Config::getInstance()->save(); + $result['result'] = 'deleted'; + } else { + $result['result'] = 'not found'; + } + } + } + return $result; + } + + public function setAspathAction($uuid) + { + if ($this->request->isPost() && $this->request->hasPost("aspath")) { + $mdlNeighbor = $this->getModel(); + if ($uuid != null) { + $node = $mdlNeighbor->getNodeByReference('aspaths.aspath.' . $uuid); + if ($node != null) { + $result = array("result" => "failed", "validations" => array()); + $aspathInfo = $this->request->getPost("aspath"); + $node->setNodes($aspathInfo); + $valMsgs = $mdlNeighbor->performValidation(); + foreach ($valMsgs as $field => $msg) { + $fieldnm = str_replace($node->__reference, "aspath", $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 searchPrefixlistAction() + { + $this->sessionClose(); + $mdlBGP = $this->getModel(); + $grid = new UIModelGrid($mdlBGP->prefixlists->prefixlist); + return $grid->fetchBindRequest( + $this->request, + array("enabled", "name", "seqnumber", "action", "network" ) + ); + } + public function getPrefixlistAction($uuid = null) + { + $mdlBGP = $this->getModel(); + if ($uuid != null) { + $node = $mdlBGP->getNodeByReference('prefixlists.prefixlist.' . $uuid); + if ($node != null) { + // return node + return array("prefixlist" => $node->getNodes()); + } + } else { + $node = $mdlBGP->prefixlists->prefixlist->add(); + return array("prefixlist" => $node->getNodes()); + } + return array(); + } + public function addPrefixlistAction() + { + $result = array("result" => "failed"); + if ($this->request->isPost() && $this->request->hasPost("prefixlist")) { + $result = array("result" => "failed", "validations" => array()); + $mdlBGP = $this->getModel(); + $node = $mdlBGP->prefixlists->prefixlist->Add(); + $node->setNodes($this->request->getPost("prefixlist")); + $valMsgs = $mdlBGP->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 + $mdlBGP->serializeToConfig(); + Config::getInstance()->save(); + unset($result['validations']); + $result["result"] = "saved"; + } + } + return $result; + } + public function delPrefixlistAction($uuid) + { + $result = array("result" => "failed"); + if ($this->request->isPost()) { + $mdlBGP = $this->getModel(); + if ($uuid != null) { + if ($mdlBGP->prefixlists->prefixlist->del($uuid)) { + $mdlBGP->serializeToConfig(); + Config::getInstance()->save(); + $result['result'] = 'deleted'; + } else { + $result['result'] = 'not found'; + } + } + } + return $result; + } + 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 searchRoutemapAction() + { + $this->sessionClose(); + $mdlBGP = $this->getModel(); + $grid = new UIModelGrid($mdlBGP->routemaps->routemap); + return $grid->fetchBindRequest( + $this->request, + array("enabled", "name", "action", "id", "match", "set" ) + ); + } + + public function getRoutemapAction($uuid = null) + { + $mdlBGP = $this->getModel(); + if ($uuid != null) { + $node = $mdlBGP->getNodeByReference('routemaps.routemap.' . $uuid); + if ($node != null) { + // return node + return array("routemap" => $node->getNodes()); + } + } else { + $node = $mdlBGP->routemaps->routemap->add(); + return array("routemap" => $node->getNodes()); + } + return array(); + } + + public function addRoutemapAction() + { + $result = array("result" => "failed"); + if ($this->request->isPost() && $this->request->hasPost("routemap")) { + $result = array("result" => "failed", "validations" => array()); + $mdlBGP = $this->getModel(); + $node = $mdlBGP->routemaps->routemap->Add(); + $node->setNodes($this->request->getPost("routemap")); + $valMsgs = $mdlBGP->performValidation(); + foreach ($valMsgs as $field => $msg) { + $fieldnm = str_replace($node->__reference, "routemap", $msg->getField()); + $result["validations"][$fieldnm] = $msg->getMessage(); + } + if (count($result['validations']) == 0) { + // save config if validated correctly + $mdlBGP->serializeToConfig(); + Config::getInstance()->save(); + unset($result['validations']); + $result["result"] = "saved"; + } + } + return $result; + } + + public function delRoutemapAction($uuid) + { + $result = array("result" => "failed"); + if ($this->request->isPost()) { + $mdlBGP = $this->getModel(); + if ($uuid != null) { + if ($mdlBGP->routemaps->routemap->del($uuid)) { + $mdlBGP->serializeToConfig(); + Config::getInstance()->save(); + $result['result'] = 'deleted'; + } else { + $result['result'] = 'not found'; + } + } + } + return $result; + } + + public function setRoutemapAction($uuid) + { + if ($this->request->isPost() && $this->request->hasPost("routemap")) { + $mdlNeighbor = $this->getModel(); + if ($uuid != null) { + $node = $mdlNeighbor->getNodeByReference('routemaps.routemap.' . $uuid); + if ($node != null) { + $result = array("result" => "failed", "validations" => array()); + $routemapInfo = $this->request->getPost("routemap"); + $node->setNodes($routemapInfo); + $valMsgs = $mdlNeighbor->performValidation(); + foreach ($valMsgs as $field => $msg) { + $fieldnm = str_replace($node->__reference, "routemap", $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"); @@ -200,4 +488,19 @@ class BgpController extends ApiMutableModelControllerBase { return $this->toggle_handler($uuid, 'neighbors', 'neighbor'); } + + public function toggleAspathAction($uuid) + { + return $this->toggle_handler($uuid, 'aspaths', 'aspath'); + } + + public function togglePrefixlistAction($uuid) + { + return $this->toggle_handler($uuid, 'prefixlists', 'prefixlist'); + } + + public function toggleRoutemapAction($uuid) + { + return $this->toggle_handler($uuid, 'routemaps', 'routemap'); + } } diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/DiagnosticsController.php b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/DiagnosticsController.php index 07a4a4121..ea39a67a5 100644 --- a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/DiagnosticsController.php +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/DiagnosticsController.php @@ -29,6 +29,7 @@ */ namespace OPNsense\Quagga\Api; + use \OPNsense\Base\ApiControllerBase; use \OPNsense\Core\Backend; use \OPNsense\Core\Config; @@ -59,6 +60,12 @@ class DiagnosticsController extends ApiControllerBase $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(); diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/GeneralController.php b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/GeneralController.php index 125d646f5..b643a499b 100644 --- a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/GeneralController.php +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/GeneralController.php @@ -27,8 +27,9 @@ * POSSIBILITY OF SUCH DAMAGE. * */ - + namespace OPNsense\Quagga\Api; + use \OPNsense\Base\ApiControllerBase; use \OPNsense\Quagga\General; use \OPNsense\Core\Config; diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/Ospf6settingsController.php b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/Ospf6settingsController.php index c2c3c8de0..08fe7e7d3 100644 --- a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/Ospf6settingsController.php +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/Ospf6settingsController.php @@ -31,6 +31,7 @@ */ namespace OPNsense\Quagga\Api; + use \OPNsense\Quagga\OSPF6; use \OPNsense\Core\Config; use \OPNsense\Base\ApiMutableModelControllerBase; diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/OspfsettingsController.php b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/OspfsettingsController.php index 407b0a4f4..ff00763b4 100644 --- a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/OspfsettingsController.php +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/OspfsettingsController.php @@ -30,6 +30,7 @@ */ namespace OPNsense\Quagga\Api; + use \OPNsense\Quagga\OSPF; use \OPNsense\Core\Config; use \OPNsense\Base\ApiMutableModelControllerBase; diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/RipController.php b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/RipController.php index a8d9c51be..39de9150d 100644 --- a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/RipController.php +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/RipController.php @@ -29,6 +29,7 @@ */ namespace OPNsense\Quagga\Api; + use \OPNsense\Base\ApiControllerBase; use \OPNsense\Quagga\RIP; use \OPNsense\Core\Config; 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 3be095f10..6a43e0bc6 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 @@ -29,6 +29,7 @@ */ namespace OPNsense\Quagga\Api; + use \OPNsense\Base\ApiControllerBase; use \OPNsense\Core\Backend; use \OPNsense\Quagga\General; diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/BgpController.php b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/BgpController.php index 52ece6c3e..116aba171 100644 --- a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/BgpController.php +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/BgpController.php @@ -1,6 +1,4 @@ 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'); } } diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/GeneralController.php b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/GeneralController.php index 43d087f3b..b030ea9d4 100644 --- a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/GeneralController.php +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/GeneralController.php @@ -1,6 +1,4 @@ + + aspath.enabled + + checkbox + Enable / Disable + + + aspath.number + + text + 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! + + + aspath.action + + select_multiple + Set permit for match or deny to negate the rule. + + + aspath.as + + text + The AS pattern you want to match, regexp allowed (e.g. .$ or _1$). It's not validated so please be careful! + + diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPNeighbor.xml b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPNeighbor.xml index 019d3a5b8..f34aee3f4 100644 --- a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPNeighbor.xml +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPNeighbor.xml @@ -32,4 +32,28 @@ checkbox + + neighbor.linkedPrefixlistIn + + dropdown + Prefix-List for inbound direction + + + neighbor.linkedPrefixlistOut + + dropdown + Prefix-List for outbound direction + + + neighbor.linkedRoutemapIn + + dropdown + Route-Map for inbound direction + + + neighbor.linkedRoutemapOut + + dropdown + Route-Map for outbound direction + diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPPrefixLists.xml b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPPrefixLists.xml new file mode 100644 index 000000000..8472d0976 --- /dev/null +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPPrefixLists.xml @@ -0,0 +1,32 @@ +
+ + prefixlist.enabled + + checkbox + Enable / Disable + + + prefixlist.name + + text + The name of your Prefix-List, please choose one near to the result you want to achieve. + + + prefixlist.seqnumber + + text + The ACL sequence number (10-99) + + + prefixlist.action + + select_multiple + Set permit for match or deny to negate the rule. + + + prefixlist.network + + text + The network pattern you want to match. You can also add "ge" or "le" additions after the network statement. It's not validated so please be careful! + +
diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPRouteMaps.xml b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPRouteMaps.xml new file mode 100644 index 000000000..22b8eac93 --- /dev/null +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPRouteMaps.xml @@ -0,0 +1,40 @@ +
+ + routemap.enabled + + checkbox + Enable / Disable + + + routemap.name + + text + Route-map name to match and set your patterns, it will be enabled via the neigbor configuration. + + + routemap.action + + select_multiple + Set permit for match or deny to negate the rule. + + + routemap.id + + text + Route-map ID between 10 and 99. Be aware that the sorting will be done under the hood, so when you add an entry between it get's to the right position + + + routemap.match + + select_multiple + + true + Select the AS-Path list + + + routemap.set + + text + Free text field for your set, please be careful! You can set e.g. "local-prefernce 300" or "community 1:1" (http://www.nongnu.org/quagga/docs/docs-multi/Route-Map-Set-Command.html#Route-Map-Set-Command) + +
diff --git a/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/BGP.xml b/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/BGP.xml index 1b29feaa5..349e223c5 100644 --- a/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/BGP.xml +++ b/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/BGP.xml @@ -6,9 +6,11 @@ 0 Y - + Y + 1 + 4294967295 @@ -25,7 +27,6 @@ Connected routes (directly attached subnet or host) Intermediate System to Intermediate System (IS-IS) Kernel routes (not installed via the zebra RIB) - Protocol Independent Multicast (PIM) Routing Information Protocol (RIP) Statically configured routes @@ -41,9 +42,11 @@ Y /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/ - + Y + 1 + 4294967295 @@ -53,15 +56,165 @@ /^(?!0).*$/ - + 0 N - + 0 N - + + + + + Related Prefix-List item not found + N + N + + + + + + Related Prefix-List item not found + N + N + + + + + + Related Route-Map item not found + N + N + + + + + + Related Route-Map item not found + N + N + + + + + + 1 + Y + + + + Y + 10 + 99 + + + + Y + + Permit + Deny + + + + + Y + + + + + + + 1 + Y + + + + Y + + + + Y + 10 + 99 + + + + Y + + Permit + Deny + + + + + Y + + + + + + + 1 + Y + + + + Y + + + + Y + + Permit + Deny + + + + + Y + 10 + 99 + + + + + + Related item not found + Y + N + + + + Y + + + diff --git a/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/OSPF6.php b/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/OSPF6.php index ed88b7875..1fedb4836 100644 --- a/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/OSPF6.php +++ b/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/OSPF6.php @@ -22,6 +22,7 @@ POSSIBILITY OF SUCH DAMAGE. */ namespace OPNsense\Quagga; + use OPNsense\Base\BaseModel; class OSPF6 extends BaseModel diff --git a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/bgp.volt b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/bgp.volt index 7b4e12829..fb3a3f866 100644 --- a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/bgp.volt +++ b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/bgp.volt @@ -31,6 +31,9 @@ POSSIBILITY OF SUCH DAMAGE.
@@ -43,8 +46,6 @@ POSSIBILITY OF SUCH DAMAGE.
- -
@@ -55,6 +56,10 @@ POSSIBILITY OF SUCH DAMAGE. + + + + @@ -72,6 +77,83 @@ POSSIBILITY OF SUCH DAMAGE.
{{ lang._('Update Source Address') }} {{ lang._('Next Hop Self') }} {{ lang._('Default Originate') }}{{ lang._('Prefix List inbound') }}{{ lang._('Prefix List outbound') }}{{ lang._('Route Map inbound') }}{{ lang._('Route Map outbound') }} {{ lang._('ID') }} {{ lang._('Commands') }}
+
+ + + + + + + + + + + + + + + + + + + +
{{ lang._('Enabled') }}{{ lang._('Number') }}{{ lang._('Action') }}{{ lang._('AS Number') }}{{ lang._('ID') }}{{ lang._('Commands') }}
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + +
{{ lang._('Enabled') }}{{ lang._('Name') }}{{ lang._('Secquence Number') }}{{ lang._('Action') }}{{ lang._('Network') }}{{ lang._('ID') }}{{ lang._('Commands') }}
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + +
{{ lang._('Enabled') }}{{ lang._('Name') }}{{ lang._('Action') }}{{ lang._('ID') }}{{ lang._('AS Path List') }}{{ lang._('Set') }}{{ lang._('ID') }}{{ lang._('Commands') }}
+ +
+
{{ partial("layout_partials/base_dialog",['fields':formDialogEditBGPNeighbor,'id':'DialogEditBGPNeighbor','label':lang._('Edit Neighbor')])}} +{{ partial("layout_partials/base_dialog",['fields':formDialogEditBGPASPaths,'id':'DialogEditBGPASPaths','label':lang._('Edit AS Paths')])}} +{{ partial("layout_partials/base_dialog",['fields':formDialogEditBGPPrefixLists,'id':'DialogEditBGPPrefixLists','label':lang._('Edit Prefix Lists')])}} +{{ partial("layout_partials/base_dialog",['fields':formDialogEditBGPRouteMaps,'id':'DialogEditBGPRouteMaps','label':lang._('Edit Route Maps')])}} diff --git a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsgeneral.volt b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsgeneral.volt index 89b4467cc..c03193925 100644 --- a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsgeneral.volt +++ b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsgeneral.volt @@ -109,7 +109,9 @@ $(document).ready(function() { $('#routing6').html(content) //$('#routing6 table').bootgrid({converters: dataconverters}) }); - + ajaxCall(url="/api/quagga/diagnostics/showrunningconfig", sendData={}, callback=function(data,status) { + $("#runningconfig").text(data['response']); + }); }); @@ -118,9 +120,13 @@ $(document).ready(function() {
+
+

+    
diff --git a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsospf.volt b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsospf.volt index a5cf49a88..2ac240dd4 100644 --- a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsospf.volt +++ b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsospf.volt @@ -32,51 +32,51 @@ POSSIBILITY OF SUCH DAMAGE. - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsospfv3.volt b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsospfv3.volt index 76153f252..f4d9d71fa 100644 --- a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsospfv3.volt +++ b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsospfv3.volt @@ -32,38 +32,38 @@ POSSIBILITY OF SUCH DAMAGE.
{{ lang._("RFC2328 Conform") }}{{ lang._('RFC2328 Conform') }} <%= checkmark(ospf_overview['rfc2328_conform']) %>
{{ lang._("ASBR") }}{{ lang._('ASBR') }} <%= checkmark(ospf_overview['asbr']) %>
{{ lang._("Router ID") }}{{ lang._('Router ID') }} <%= ospf_overview['router_id'] %>
{{ lang._("RFC1583 Compatibility") }}{{ lang._('RFC1583 Compatibility') }} <%= checkmark(ospf_overview['rfc1583_compatibility']) %>
{{ lang._("Opaque Capability") }}{{ lang._('Opaque Capability') }} <%= checkmark(ospf_overview['opaque_capability']) %>
{{ lang._("Initial SPF Scheduling Delay") }}{{ lang._('Initial SPF Scheduling Delay') }} <%= ospf_overview['initial_spf_scheduling_delay'] %>
{{ lang._("Minimum Hold Time") }}{{ lang._('Minimum Hold Time') }} <%= ospf_overview['hold_time']['min'] %> {{ lang._('Milliseconds') }}
{{ lang._("Maximum Hold Time") }}{{ lang._('Maximum Hold Time') }} <%= ospf_overview['hold_time']['max'] %> {{ lang._('Milliseconds') }}
{{ lang._("Current Hold Time Multipier") }}{{ lang._('Current Hold Time Multipier') }} <%= ospf_overview['current_hold_time_multipier'] %>
{{ lang._("SPF Timer") }}{{ lang._('SPF Timer') }} <%= ospf_overview['spf_timer'] %>
{{ lang._("Refresh Timer") }}{{ lang._('Refresh Timer') }} <%= ospf_overview['refresh_timer'] %>
{{ lang._("Areas Attached Count") }}{{ lang._('Areas Attached Count') }} <%= ospf_overview['areas_attached_count'] %>
- + - + - + - + - + - + - + - + @@ -77,11 +77,11 @@ POSSIBILITY OF SUCH DAMAGE.
{{ lang._("Router ID") }}{{ lang._('Router ID') }} <%= ospfv3_overview['router_id'] %>
{{ lang._("Routing Process") }}{{ lang._('Routing Process') }} <%= ospfv3_overview['routing_process'] %>
{{ lang._("Running Time") }}{{ lang._('Running Time') }} <%= ospfv3_overview['running_time'] %>
{{ lang._("Initial SPF scheduling delay") }}{{ lang._('Initial SPF scheduling delay') }} <%= ospfv3_overview['intital_spf_scheduling_delay'] %>
{{ lang._("Hold Time") }}{{ lang._('Hold Time') }} - {{ lang._("Minimum Hold Time") }} <%= ospfv3_overview['hold_time']['min'] %>
- {{ lang._("Maximum Hold Time:") }} <%= ospfv3_overview['hold_time']['max'] %> + {{ lang._('Minimum Hold Time') }} <%= ospfv3_overview['hold_time']['min'] %>
+ {{ lang._('Maximum Hold Time:') }} <%= ospfv3_overview['hold_time']['max'] %>
{{ lang._("SPF timer") }}{{ lang._('SPF timer') }} <%= ospfv3_overview['spf_timer'] %>
{{ lang._("Number Of Scoped AS") }}{{ lang._('Number Of Scoped AS') }} <%= ospfv3_overview['number_as_scoped'] %>
{{ lang._("Number Of Areas") }}{{ lang._('Number Of Areas') }} <%= ospfv3_overview['number_of_areas'] %>
- + - + @@ -184,7 +184,7 @@ POSSIBILITY OF SUCH DAMAGE. <% }) %> <% } %> <% if (ospfv3_database['as_scoped']) { %> -

{{ lang._('AS Scpoed') }}

+

{{ lang._('AS Scoped') }}

{{ lang._("Number Of LSAs") }}{{ lang._('Number Of LSAs') }} <%= area['number_lsas'] %>
{{ lang._("Interfaces") }}{{ lang._('Interfaces') }} <%= _.join(area['interfaces'], ", ") %>
@@ -235,7 +235,7 @@ POSSIBILITY OF SUCH DAMAGE. <% } else if (propertyname == 'area_cost') { %> <% _.each(int[propertyname], function (ac) { %> <%= ac['area'] %>: <%= ac['cost'] %>
- <% }) %> + <% }) %> <% } else { %> <%= translate(int[propertyname]) %> <% } %> diff --git a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/ospf6.volt b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/ospf6.volt index 91c25c7f5..892627c5f 100644 --- a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/ospf6.volt +++ b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/ospf6.volt @@ -52,7 +52,7 @@ POSSIBILITY OF SUCH DAMAGE. - + diff --git a/net/quagga/src/opnsense/scripts/quagga/quagga.rb b/net/quagga/src/opnsense/scripts/quagga/quagga.rb index d4a09a5c8..9a386e84d 100755 --- a/net/quagga/src/opnsense/scripts/quagga/quagga.rb +++ b/net/quagga/src/opnsense/scripts/quagga/quagga.rb @@ -124,7 +124,7 @@ class General end entries end - + def routes6 routes(true) end @@ -432,7 +432,7 @@ class OSPFv3 def initialize(sh) @vtysh = sh end - + def overview lines = @vtysh.execute("show ipv6 ospf6").lines overview = {} @@ -485,11 +485,11 @@ class OSPFv3 end overview end - + def linkstate lines = @vtysh.execute("show ipv6 ospf6 linkstate").lines linkstate = {} - + qta = nil current_area = [] while line = lines.shift&.strip @@ -507,11 +507,11 @@ class OSPFv3 end linkstate end - + def route route = [] lines = @vtysh.execute("show ipv6 ospf6 route").lines - + lines.each do |line| f1, f2, network, gateway, interface, time = line.strip.split(/\s+/) route << { f1: f1, @@ -523,7 +523,7 @@ class OSPFv3 end route end - + def neighbor qta = QuaggaTableReader.new(["Neighbor ID","Pri", "DeadTime", "State/IfState", "Duration I/F[State]"]) neighbor = [] @@ -571,7 +571,7 @@ class OSPFv3 end database end - + def interface lines = @vtysh.execute("show ipv6 ospf6 interface").lines int = {} @@ -631,7 +631,7 @@ class OSPFv3 end int end - + private def database_qta(lines) # DON'T REMOVE THE SPACES!!! diff --git a/net/quagga/src/opnsense/service/conf/actions.d/actions_quagga.conf b/net/quagga/src/opnsense/service/conf/actions.d/actions_quagga.conf index af1e2a60e..7dca79606 100644 --- a/net/quagga/src/opnsense/service/conf/actions.d/actions_quagga.conf +++ b/net/quagga/src/opnsense/service/conf/actions.d/actions_quagga.conf @@ -111,3 +111,9 @@ command:/usr/local/opnsense/scripts/quagga/quagga.rb --general-routes6 parameters: type:script_output message: Print IPv6 Routing Table + +[general-runningconfig] +command:/usr/local/bin/vtysh -c "show run" +parameters: +type:script_output +message: Show running configuration diff --git a/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/bgpd.conf b/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/bgpd.conf index a7fbc72c1..3783dfaba 100644 --- a/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/bgpd.conf +++ b/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/bgpd.conf @@ -14,6 +14,11 @@ router bgp {{ OPNsense.quagga.bgp.asnumber }} network {{ network }} {% endfor %} {% endif %} +{% if helpers.exists('OPNsense.quagga.bgp.redistribute') and OPNsense.quagga.bgp.redistribute != '' %} +{% for bgp_redistribute in OPNsense.quagga.bgp.redistribute.split(',') %} + redistribute {{ bgp_redistribute }} +{% endfor %} +{% endif %} {% if helpers.exists('OPNsense.quagga.bgp.neighbors.neighbor') %} {% for neighbor in helpers.toList('OPNsense.quagga.bgp.neighbors.neighbor') %} {% if neighbor.enabled == '1' %} @@ -27,9 +32,77 @@ router bgp {{ OPNsense.quagga.bgp.asnumber }} {% if 'defaultoriginate' in neighbor and neighbor.defaultoriginate == '1' %} neighbor {{ neighbor.address }} default-originate {% endif %} +{% if neighbor.linkedPrefixlistIn|default("") != "" %} +{% for prefixlist in neighbor.linkedPrefixlistIn.split(",") %} +{% set prefixlist2_data = helpers.getUUID(prefixlist) %} +{% if prefixlist2_data != {} and prefixlist2_data.enabled == '1' %} + neighbor {{ neighbor.address }} prefix-list {{ prefixlist2_data.name }} in +{% endif %} +{% endfor %} +{% endif %} +{% if neighbor.linkedPrefixlistOut|default("") != "" %} +{% for prefixlist in neighbor.linkedPrefixlistOut.split(",") %} +{% set prefixlist_data = helpers.getUUID(prefixlist) %} +{% if prefixlist_data != {} and prefixlist_data.enabled == '1' %} + neighbor {{ neighbor.address }} prefix-list {{ prefixlist_data.name }} out +{% endif %} +{% endfor %} +{% endif %} +{% if neighbor.linkedRoutemapIn|default("") != "" %} +{% for aspath in neighbor.linkedRoutemapIn.split(",") %} +{% set routemap2_data = helpers.getUUID(aspath) %} +{% if routemap2_data != {} and routemap2_data.enabled == '1' %} + neighbor {{ neighbor.address }} route-map {{ routemap2_data.name }} in +{% endif %} +{% endfor %} +{% endif %} +{% if neighbor.linkedRoutemapOut|default("") != "" %} +{% for aspath in neighbor.linkedRoutemapOut.split(",") %} +{% set routemap_data = helpers.getUUID(aspath) %} +{% if routemap_data != {} and routemap_data.enabled == '1' %} + neighbor {{ neighbor.address }} route-map {{ routemap_data.name }} out +{% endif %} +{% endfor %} +{% endif %} {% endif %} {% endfor %} {% endif %} +! +{% if helpers.exists('OPNsense.quagga.bgp.prefixlists.prefixlist') %} +{% for prefixlist in helpers.sortDictList(OPNsense.quagga.bgp.prefixlists.prefixlist, 'name', 'seqnumber' ) %} +{% if prefixlist.enabled == '1' %} +ip prefix-list {{ prefixlist.name }} seq {{ prefixlist.seqnumber }} {{ prefixlist.action }} {{ prefixlist.network }} +{% endif %} +{% endfor %} +{% endif %} +! +{% if helpers.exists('OPNsense.quagga.bgp.aspaths.aspath') %} +{% for aspath in helpers.sortDictList(OPNsense.quagga.bgp.aspaths.aspath, 'number' ) %} +{% if aspath.enabled == '1' %} +ip as-path access-list {{ aspath.number }} {{ aspath.action }} {{ aspath.as }} +{% endif %} +{% endfor %} +{% endif %} +! +{% if helpers.exists('OPNsense.quagga.bgp.routemaps.routemap') %} +{% for routemap in helpers.sortDictList(OPNsense.quagga.bgp.routemaps.routemap, 'name', 'id' ) %} +{% if routemap.enabled == '1' %} +route-map {{ routemap.name }} {{ routemap.action }} {{ routemap.id }} +{% if routemap.match|default("") != "" %} +{% for aspath in routemap.match.split(",") %} +{% set aspath_data = helpers.getUUID(aspath) %} +{% if 'match' in routemap and routemap.match != '' %} + match as-path {{ aspath_data.number }} +{% endif %} +{% endfor %} +{% endif %} +{% if routemap.set != '' %} + set {{ routemap.set }} +{% endif %} +{% endif %} +{% endfor %} +{% endif %} +! {% endif %} ! line vty
{{ lang._('Enabled') }} {{ lang._('Interface Name') }}{{ lang._('Area') }}{{ lang._('Area') }} {{ lang._('Network Type') }} {{ lang._('ID') }} {{ lang._('Commands') }}