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 new file mode 100644 index 000000000..c53b5199c --- /dev/null +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/RipController.php @@ -0,0 +1,75 @@ +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; + } +} diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/RipController.php b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/RipController.php index ce476267f..ab552bc03 100644 --- a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/RipController.php +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/RipController.php @@ -5,8 +5,8 @@ class RipController extends \OPNsense\Base\IndexController { public function indexAction() { - $this->view->title = gettext("RIP-Settings"); - $this->view->generalForm = $this->getForm("rip"); + $this->view->title = gettext("RIP Settings"); + $this->view->ripForm = $this->getForm("rip"); $this->view->pick('OPNsense/Quagga/rip'); } } diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/rip.xml b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/rip.xml index 729a5fe53..cc86d9a8e 100644 --- a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/rip.xml +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/rip.xml @@ -1,8 +1,38 @@
- routing.rip.general.Enabled + rip.enabled checkbox This will activate the rip service. + + rip.version + + text + Choose your RIP version (1 or 2). 1 is classful, 2 supports CIDR. + + + rip.passiveinterfaces + + select_multiple + + + Type or select interface. + + + rip.redistribute + + select_multiple + + + Type or select a route source. + + + rip.networks + + + select_multiple + true + Select your Netzworks. +
diff --git a/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/Menu/Menu.xml b/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/Menu/Menu.xml index 113917841..542de374c 100644 --- a/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/Menu/Menu.xml +++ b/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/Menu/Menu.xml @@ -1,7 +1,7 @@ - + diff --git a/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/RIP.php b/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/RIP.php new file mode 100644 index 000000000..674f56d09 --- /dev/null +++ b/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/RIP.php @@ -0,0 +1,34 @@ + + //OPNsense/quagga/rip + RIP Routing configuration + + + 0 + Y + + + 1 + 2 + 2 + Y + + + + Y + /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2},)*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2})$/ + + + + N + Y + + + /^(?!0).*$/ + + + + N + Y + + + Babel routing protocol (Babel) + Border Gateway Protocol (BGP) + 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) + Open Shortest Path First (OSPF) + Statically configured routes + + + + diff --git a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/rip.volt b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/rip.volt index 4ca174841..eadc82920 100644 --- a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/rip.volt +++ b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/rip.volt @@ -1 +1,58 @@ -{{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_ospf_settings'])}} +{# + +OPNsense® is Copyright © 2014 – 2017 by Deciso B.V. +This file is Copyright © 2017 by 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. + +#}{{ partial("layout_partials/base_form",['fields':ripForm,'id':'frm_rip_settings'])}} + +
+ +
+ + diff --git a/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/+TARGETS b/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/+TARGETS index 17356eed7..b85dce436 100644 --- a/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/+TARGETS +++ b/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/+TARGETS @@ -1,3 +1,4 @@ ospfd.conf:/usr/local/etc/quagga/ospfd.conf +ripd.conf:/usr/local/etc/quagga/ripd.conf quagga:/etc/rc.conf.d/quagga zebra.conf:/usr/local/etc/quagga/zebra.conf diff --git a/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/quagga b/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/quagga index 82b50dfb0..b8dca88f2 100644 --- a/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/quagga +++ b/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/quagga @@ -7,7 +7,7 @@ quagga_opnsense_bootup_run="/usr/local/opnsense/scripts/quagga/setup.sh" quagga_daemons="zebra{% if helpers.exists('OPNsense.quagga.ospf.enabled') and OPNsense.quagga.ospf.enabled == '1' %} ospfd{% endif %}{% -if helpers.exists('OPNsense.quagga.rip.enabled') and OPNsense.quagga.ripd.enabled == '1' %} ripd{% endif %}{% +if helpers.exists('OPNsense.quagga.rip.enabled') and OPNsense.quagga.rip.enabled == '1' %} ripd{% endif %}{% if helpers.exists('OPNsense.quagga.bgp.enabled') and OPNsense.quagga.bgp.enabled == '1' %} bgpd{% endif %}{% if helpers.exists('OPNsense.quagga.ospf6.enabled') and OPNsense.quagga.ospf6.enabled == '1' %} ospf6d{% endif %}{% if helpers.exists('OPNsense.quagga.ripng.enabled') and OPNsense.quagga.ripng.enabled == '1' %} ripngd{% endif %}{% diff --git a/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/ripd.conf b/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/ripd.conf new file mode 100644 index 000000000..38f4df1db --- /dev/null +++ b/net/quagga/src/opnsense/service/templates/OPNsense/Quagga/ripd.conf @@ -0,0 +1,26 @@ +! +! Zebra configuration saved from vty +! 2017/03/26 22:40:16 +! +! +router zebra + no redistribute rip +! +router rip + version {{ OPNsense.quagga.rip.version }} +{% if helpers.exists('OPNsense.quagga.rip.redistribute') and OPNsense.quagga.rip.redistribute != '' %} +{% for line in OPNsense.quagga.rip.redistribute.split(',') %} + redistribute {{ line }} +{% endfor %}{% endif %} +{% if helpers.exists('OPNsense.quagga.rip.networks') %} +{% for network in OPNsense.quagga.rip.networks.split(',') %} + network {{ network }} +{% endfor %} +{% endif %} +{% if helpers.exists('OPNsense.quagga.rip.passiveinterfaces') and OPNsense.quagga.rip.passiveinterfaces != '' %} +{% for line in OPNsense.quagga.rip.passiveinterfaces.split(',') %} + passive-interface {{ line }} +{% endfor %}{% endif %} +! +line vty +!