net/frr: add BFD strict mode for BGP neighbors (#5315)

* net/frr: add BFD strict mode for BGP neighbors

* net/frr: refactor BFD event handler and config generation
This commit is contained in:
r3m8 2026-06-08 15:29:09 +02:00 committed by GitHub
parent 461e171604
commit e77541ecc3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 2 deletions

View file

@ -172,6 +172,18 @@
<visible>false</visible>
</grid_view>
</field>
<field>
<id>neighbor.bfd_strict</id>
<label>BFD Strict Mode</label>
<type>checkbox</type>
<help>Strict mode requires the BFD session to be established before allowing BGP to connect. If BFD goes down, BGP immediately closes the session. This prevents BGP sessions from remaining up when the underlying link is down. Requires BFD to be enabled.</help>
<style>bfd_strict_mode</style>
<grid_view>
<type>boolean</type>
<formatter>boolean</formatter>
<visible>false</visible>
</grid_view>
</field>
<field>
<id>neighbor.keepalive</id>
<label>Keepalive</label>

View file

@ -1,7 +1,7 @@
<model>
<mount>//OPNsense/quagga/bgp</mount>
<description>BGP Routing configuration</description>
<version>1.1.1</version>
<version>1.1.2</version>
<items>
<enabled type="BooleanField">
<Default>0</Default>
@ -108,6 +108,7 @@
<rrclient type="BooleanField"/>
<soft_reconfiguration_inbound type="BooleanField"/>
<bfd type="BooleanField"/>
<bfd_strict type="BooleanField"/>
<keepalive type="IntegerField">
<MinimumValue>1</MinimumValue>
<MaximumValue>1000</MaximumValue>

View file

@ -30,6 +30,14 @@ POSSIBILITY OF SUCH DAMAGE.
<script>
$(document).ready(function() {
$(document).on('change', '#neighbor\\.bfd', function(){
if ($(this).is(':checked')) {
$(".bfd_strict_mode").closest('tr').show();
} else {
$(".bfd_strict_mode").closest('tr').hide();
}
});
mapDataToFormUI({'frm_bgp_settings':"/api/quagga/bgp/get"}).done(function(data){
formatTokenizersUI();
$('.selectpicker').selectpicker('refresh');

View file

@ -127,7 +127,7 @@ router bgp {{ OPNsense.quagga.bgp.asnumber }}
neighbor {{ neighbor.address }} description {{ neighbor.description }}
{% endif %}
{% if neighbor.bfd|default('') == '1' %}
neighbor {{ neighbor.address }} bfd
neighbor {{ neighbor.address }} bfd {% if neighbor.bfd_strict|default('') == '1' %}strict{% endif %}
{% endif %}
{% if 'password' in neighbor and neighbor.password != '' %}
neighbor {{ neighbor.address }} password {{ neighbor.password }}