[PATCH pve-network v5 34/46] fabrics: ospf: openfabric: add route_filter property

Stefan Hanreich
2026-05-05T15:39:29Z

Previously fabrics auto-generated and applied route map that filtered
the routes that get installed into the kernel routing table to only
include routes that are contained in the IP prefix of the fabric. This
can now be overridden by the route_filter parameter. Users can specify
a custom prefix list, that is used for filtering installed routes.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
src/PVE/Network/SDN/Fabrics.pm | 15 +++++++++++++--
src/PVE/Network/SDN/PrefixLists.pm | 11 +++++++++++
2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Network/SDN/Fabrics.pm b/src/PVE/Network/SDN/Fabrics.pm
index 1ecedbd..bc295f0 100644
--- a/src/PVE/Network/SDN/Fabrics.pm
+++ b/src/PVE/Network/SDN/Fabrics.pm
@@ -6,8 +6,10 @@ use warnings;
use PVE::Cluster qw(cfs_register_file cfs_read_file cfs_lock_file cfs_write_file);
use PVE::JSONSchema qw(get_standard_option);
use PVE::INotify;
+
use PVE::RS::SDN;
use PVE::RS::SDN::Fabrics;
+use PVE::RS::SDN::PrefixLists;

PVE::JSONSchema::register_format(
'pve-sdn-fabric-id',
@@ -264,6 +266,15 @@ sub fabric_properties {
'OSPF area. Either a IPv4 address or a 32-bit number. Gets validated in rust.',
optional => 1,
},
+ route_filter => {
+ type => 'string',
+ format => 'pve-sdn-prefix-list-id',
+ 'type-property' => 'protocol',
+ 'instance-types' => ['ospf', 'openfabric'],
+ description =>
+ 'A prefix list that should be used for filtering routes that are to be installed into the kernel routing table',
+ optional => 1,
+ },
};

if ($update) {
@@ -277,7 +288,7 @@ sub fabric_properties {
'instance-types' => ['openfabric'],
items => {
type => 'string',
- enum => ['hello_interval', 'csnp_interval'],
+ enum => ['hello_interval', 'csnp_interval', 'route_filter'],
},
optional => 1,
},
@@ -286,7 +297,7 @@ sub fabric_properties {
'instance-types' => ['ospf'],
items => {
type => 'string',
- enum => ['area'],
+ enum => ['area', 'redistribute', 'route_filter'],
},
optional => 1,
},
diff --git a/src/PVE/Network/SDN/PrefixLists.pm b/src/PVE/Network/SDN/PrefixLists.pm
index 4cd7fdb..efe1463 100644
--- a/src/PVE/Network/SDN/PrefixLists.pm
+++ b/src/PVE/Network/SDN/PrefixLists.pm
@@ -9,6 +9,7 @@ use PVE::INotify;
use PVE::Network::SDN;
use PVE::Network::SDN::RouteMaps;
use PVE::RS::SDN::PrefixLists;
+use PVE::RS::SDN::Fabrics;

PVE::JSONSchema::register_format(
'pve-sdn-prefix-list-id',
@@ -77,6 +78,16 @@ sub write_config {
sub check_references {
my ($prefix_list_id) = @_;

+ my $fabrics = PVE::Network::SDN::Fabrics::config()->list_fabrics();
+ for my $fabric_id (keys $fabrics->%*) {
+ my $fabric = $fabrics->{$fabric_id};
+
+ if ($fabric->{route_filter}) {
+ die "prefix list $prefix_list_id is still referenced by fabric $fabric_id"
+ if $fabric->{route_filter} eq $prefix_list_id;
+ }
+ }
+
my $route_map_entries = PVE::Network::SDN::RouteMaps::config()->list();
for my $route_map_entry (values $route_map_entries->%*) {
for my $match_action_property_string ($route_map_entry->{match}->@*) {
--
2.47.3