diff --git a/net/frr/pkg-descr b/net/frr/pkg-descr index 76a1e094e..4ded6be64 100644 --- a/net/frr/pkg-descr +++ b/net/frr/pkg-descr @@ -14,6 +14,7 @@ Plugin Changelog 1.18 * Add description fields to BGP tabs +* Add BGP community-lists 1.17 diff --git a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/BgpController.php b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/BgpController.php index 27a9278dc..3edbe1627 100644 --- a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/BgpController.php +++ b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/BgpController.php @@ -3,7 +3,7 @@ /** * Copyright (C) 2015 - 2017 Deciso B.V. * Copyright (C) 2017 Fabian Franz - * Copyright (C) 2017 Michael Muenz + * Copyright (C) 2017 - 2020 Michael Muenz * * All rights reserved. * @@ -136,6 +136,34 @@ class BgpController extends ApiMutableModelControllerBase return $this->setBase('prefixlist', 'prefixlists.prefixlist', $uuid); } + public function searchCommunitylistAction() + { + return $this->searchBase( + 'communitylists.communitylist', + array("enabled", "description", "number", "seqnumber", "action", "community" ) + ); + } + public function getCommunitylistAction($uuid = null) + { + $this->sessionClose(); + return $this->getBase('communitylist', 'communitylists.communitylist', $uuid); + } + + public function addCommunitylistAction() + { + return $this->addBase('communitylist', 'communitylists.communitylist'); + } + + public function delCommunitylistAction($uuid) + { + return $this->delBase('communitylists.communitylist', $uuid); + } + + public function setCommunitylistAction($uuid) + { + return $this->setBase('communitylist', 'communitylists.communitylist', $uuid); + } + public function searchRoutemapAction() { return $this->searchBase( diff --git a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/BgpController.php b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/BgpController.php index 9b5ed5334..aaf311063 100644 --- a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/BgpController.php +++ b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/BgpController.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Fabian Franz - Copyright (C) 2017 Michael Muenz + Copyright (C) 2017 - 2020 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: @@ -33,6 +33,7 @@ class BgpController extends \OPNsense\Base\IndexController $this->view->formDialogEditBGPNeighbor = $this->getForm("dialogEditBGPNeighbor"); $this->view->formDialogEditBGPASPaths = $this->getForm("dialogEditBGPASPath"); $this->view->formDialogEditBGPPrefixLists = $this->getForm("dialogEditBGPPrefixLists"); + $this->view->formDialogEditBGPCommunityLists = $this->getForm("dialogEditBGPCommunityLists"); $this->view->formDialogEditBGPRouteMaps = $this->getForm("dialogEditBGPRouteMaps"); $this->view->pick('OPNsense/Quagga/bgp'); } diff --git a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPCommunityLists.xml b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPCommunityLists.xml new file mode 100644 index 000000000..a2755510a --- /dev/null +++ b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPCommunityLists.xml @@ -0,0 +1,38 @@ +
+ + communitylist.enabled + + checkbox + Enable / Disable + + + communitylist.description + + text + Add an optional description for this Community-List. + + + communitylist.number + + text + Set the number of your Community-List. 1-99 are stardard lists while 100-500 are expanded lists. + + + communitylist.seqnumber + + text + The ACL sequence number (10-99) + + + communitylist.action + + select_multiple + Set permit for match or deny to negate the rule. + + + communitylist.community + + text + The community you want to match. You can also regex and it is not validated so please be careful. + +
diff --git a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPRouteMaps.xml b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPRouteMaps.xml index 31fe3b5c6..892264121 100644 --- a/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPRouteMaps.xml +++ b/net/frr/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/dialogEditBGPRouteMaps.xml @@ -44,6 +44,14 @@ true Select the Prefix List. + + + routemap.match3 + + select_multiple + + true + Select the Community List. routemap.set diff --git a/net/frr/src/opnsense/mvc/app/models/OPNsense/Quagga/BGP.xml b/net/frr/src/opnsense/mvc/app/models/OPNsense/Quagga/BGP.xml index 4d11fa76d..0abecfd3b 100644 --- a/net/frr/src/opnsense/mvc/app/models/OPNsense/Quagga/BGP.xml +++ b/net/frr/src/opnsense/mvc/app/models/OPNsense/Quagga/BGP.xml @@ -202,6 +202,43 @@ + + + + 1 + Y + + + + N + + + + Y + 1 + 500 + Set a number between 1 and 500. + + + + Y + 10 + 99 + + + + Y + + Permit + Deny + + + + + Y + + + @@ -256,6 +293,18 @@ N N + + + + + Related item not found + N + N + N diff --git a/net/frr/src/opnsense/mvc/app/views/OPNsense/Quagga/bgp.volt b/net/frr/src/opnsense/mvc/app/views/OPNsense/Quagga/bgp.volt index 635b21985..461ea62a7 100644 --- a/net/frr/src/opnsense/mvc/app/views/OPNsense/Quagga/bgp.volt +++ b/net/frr/src/opnsense/mvc/app/views/OPNsense/Quagga/bgp.volt @@ -2,7 +2,7 @@ OPNsense® is Copyright © 2014 – 2017 by Deciso B.V. Copyright (C) 2017 Fabian Franz -Copyright (C) 2017 Michael Muenz +Copyright (C) 2017 - 2020 Michael Muenz All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
  • {{ lang._('Neighbors') }}
  • {{ lang._('AS Path Lists') }}
  • {{ lang._('Prefix Lists') }}
  • +
  • {{ lang._('Community Lists') }}
  • {{ lang._('Route Maps') }}
  • @@ -130,6 +131,34 @@ POSSIBILITY OF SUCH DAMAGE.
    +
    + + + + + + + + + + + + + + + + + + + + + +
    {{ lang._('Enabled') }}{{ lang._('Number') }}{{ lang._('Description') }}{{ lang._('Secquence Number') }}{{ lang._('Action') }}{{ lang._('Community') }}{{ lang._('ID') }}{{ lang._('Commands') }}
    + + + +
    +
    @@ -141,6 +170,7 @@ POSSIBILITY OF SUCH DAMAGE. + @@ -225,6 +255,16 @@ $(document).ready(function() { 'options':{selection:false, multiSelect:false} } ); + $("#grid-communitylists").UIBootgrid( + { 'search':'/api/quagga/bgp/searchCommunitylist', + 'get':'/api/quagga/bgp/getCommunitylist/', + 'set':'/api/quagga/bgp/setCommunitylist/', + 'add':'/api/quagga/bgp/addCommunitylist/', + 'del':'/api/quagga/bgp/delCommunitylist/', + 'toggle':'/api/quagga/bgp/toggleCommunitylist/', + 'options':{selection:false, multiSelect:false} + } + ); $("#grid-routemaps").UIBootgrid( { 'search':'/api/quagga/bgp/searchRoutemap', 'get':'/api/quagga/bgp/getRoutemap/', @@ -241,4 +281,5 @@ $(document).ready(function() { {{ 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':formDialogEditBGPCommunityLists,'id':'DialogEditBGPCommunityLists','label':lang._('Edit Community Lists')])}} {{ partial("layout_partials/base_dialog",['fields':formDialogEditBGPRouteMaps,'id':'DialogEditBGPRouteMaps','label':lang._('Edit Route Maps')])}} diff --git a/net/frr/src/opnsense/service/templates/OPNsense/Quagga/bgpd.conf b/net/frr/src/opnsense/service/templates/OPNsense/Quagga/bgpd.conf index 9c75e0d82..abdf1f8d9 100644 --- a/net/frr/src/opnsense/service/templates/OPNsense/Quagga/bgpd.conf +++ b/net/frr/src/opnsense/service/templates/OPNsense/Quagga/bgpd.conf @@ -180,6 +180,14 @@ bgp as-path access-list {{ aspath.number }} {{ aspath.action }} {{ aspath.as }} {% endfor %} {% endif %} ! +{% if helpers.exists('OPNsense.quagga.bgp.communitylists.communitylist') %} +{% for communitylist in helpers.sortDictList(OPNsense.quagga.bgp.communitylists.communitylist, 'number' ) %} +{% if communitylist.enabled == '1' %} +bgp community-list {{ communitylist.number }} seq {{ communitylist.seqnumber }} {{ communitylist.action }} {{ communitylist.community }} +{% 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' %} @@ -205,6 +213,14 @@ route-map {{ routemap.name }} {{ routemap.action }} {{ routemap.id }} {% endif %} {% endfor %} {% endif %} +{% if routemap.match3|default("") != "" %} +{% for communitylist in routemap.match3.split(",") %} +{% set communitylist_data = helpers.getUUID(communitylist) %} +{% if 'match3' in routemap and routemap.match3 != '' %} + match community {{ communitylist_data.number }} +{% endif %} +{% endfor %} +{% endif %} {% if routemap.set|default("") != '' and routemap.match2|default("") != '' %} set {{ routemap.set }} {% endif %}
    {{ lang._('ID') }} {{ lang._('AS Path List') }} {{ lang._('Prefix List') }}{{ lang._('Community List') }} {{ lang._('Set') }} {{ lang._('ID') }} {{ lang._('Commands') }}