Squashed commit of the following:

commit b256ed7fcfa5e36bfd29e08c479bd02b461b21f5
Author: Ad Schellevis <ad@opnsense.org>
Date:   Sun Apr 12 14:31:54 2026 +0200

    net/frr - Routing: STATIC, finish https://github.com/opnsense/plugins/pull/5390 and add diagnostics.

commit be8a53d3d2
Author: Sven Scholle <sven@shelldog.de>
Date:   Sat Apr 11 14:50:56 2026 +0200

    net/frr: add BFD dependency support for static routes

    We redistribute static routes from staticd into OSPF via WireGuard tunnels.
    We want the redistribution to depend on whether the tunnel is actually up.
    Since WireGuard interfaces remain up even when the tunnel is not functional, BFD appears to be the simplest solution for detecting tunnel failures.
This commit is contained in:
Ad Schellevis
2026-04-12 14:35:29 +02:00
parent 042783df72
commit 12f88282d9
7 changed files with 65 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
<?php
/**
* Copyright (C) 2023 Deciso B.V.
* Copyright (C) 2023-2026 Deciso B.V.
* Copyright (C) 2017 Frank Wall
* Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
*
@@ -329,4 +329,19 @@ class DiagnosticsController extends ApiControllerBase
{
return $this->bfdTreeFetch('counters');
}
public function bfdstaticrouteAction(): array
{
$records = [];
$payload = json_decode((new Backend())->configdpRun('quagga diagnostics bfd_staticroute json'), true) ?? [];
if (!empty($payload['path-list'])) {
foreach ($payload['path-list'] as $proto => $values) {
foreach ($values as $record) {
$record['proto'] = $proto;
$records[] = $record;
}
}
}
return $this->searchRecordsetBase($records);
}
}

View File

@@ -1,6 +1,7 @@
<?php
/*
Copyright (C) 2023-2026 Deciso B.V.
Copyright (C) 2017 Fabian Franz
Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
All rights reserved.
@@ -123,6 +124,12 @@ class DiagnosticsController extends \OPNsense\Base\IndexController
'tabhead' => gettext('Summary'),
'type' => 'bfdsummary'
],
[
'name' => 'staticroute',
'endpoint' => '/api/quagga/diagnostics/bfdstaticroute',
'tabhead' => gettext('Static Route'),
'type' => 'bfdstaticroute'
],
[
'name' => 'neighbors',
'endpoint' => '/api/quagga/diagnostics/bfdneighbors',

View File

@@ -27,4 +27,14 @@
<type>dropdown</type>
<help>Select an interface where this settings apply to.</help>
</field>
<field>
<id>route.bfd</id>
<label>BFD</label>
<type>checkbox</type>
<help>Mark the route as dependent on the BFD neighbor session with the next hop.</help>
<grid_view>
<type>boolean</type>
<formatter>boolean</formatter>
</grid_view>
</field>
</form>

View File

@@ -28,6 +28,10 @@
<type>/^(?!group).*$/</type>
</filters>
</interfacename>
<bfd type="BooleanField">
<Default>0</Default>
<Required>N</Required>
</bfd>
</route>
</routes>
</items>

View File

@@ -1,6 +1,6 @@
{#
OPNsense® is Copyright © 2014 2023 by Deciso B.V.
OPNsense® is Copyright © 2014 2026 by Deciso B.V.
Copyright (C) 2023 Marc Bartelt
Copyright (C) 2017 Fabian Franz
Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
@@ -101,6 +101,7 @@ POSSIBILITY OF SUCH DAMAGE.
{% case 'ospfv3databasetable' %}
{% case 'ospfneighbors' %}
{% case 'bfdsummary' %}
{% case 'bfdstaticroute' %}
if (all_grids["{{ tab['name'] }}"] === undefined) {
/**
* initialize bootgrid table for {{ tab['tabhead'] }}
@@ -406,6 +407,22 @@ POSSIBILITY OF SUCH DAMAGE.
</table>
</div>
{% break %}
{% case 'bfdstaticroute' %}
<div class="col-sm-12">
<table id="grid-{{ tab['name'] }}" class="table table-condensed table-hover table-striped table-responsive">
<thead>
<tr>
<th data-column-id="proto">{{ lang._('Protocol') }}</th>
<th data-column-id="vrf">{{ lang._('Vrf') }}</th>
<th data-column-id="peer">{{ lang._('Peer') }}</th>
<th data-column-id="installed" data-formatter="boolean" data-searchable="false" data-sortable="false">{{ lang._('Installed') }}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
{% break %}
{% case 'tree' %}
<section class="col-xs-12">
<div class="searchbox">

View File

@@ -156,6 +156,13 @@ errors:no
type:script_output
message:FRR diagnostics "show bfd peers counters %s"
[diagnostics.bfd_staticroute]
command:/usr/local/bin/vtysh
parameters: -c 'show bfd static route %s'
errors:no
type:script_output
message:FRR diagnostics "show bfd route %s"
[diagnostics.ospf_database]
command:/usr/local/bin/vtysh
parameters: -c 'show ip ospf database %s'

View File

@@ -13,6 +13,9 @@ ip
{%- endif %}
{%- if route.interfacename %}
{{ helpers.physical_interface(route.interfacename) }}
{%- endif %}
{%- if 'bfd' in route and route.bfd == '1' %}
bfd
{%- endif +%}
{% endif %}
{% endfor %}