[PATCH proxmox-ve-rs v5 18/46] fabrics: ospf: openfabric: allow user-defined route filter

Stefan Hanreich
2026-05-05T15:38:40Z

This property allows overriding the auto-generated filter for fabrics,
which would only install routes from the configured IP prefix into the
kernel routing table. It allows specifying a custom prefix list, that
is used for filtering the routes installed by zebra into the kernel
routing table. It does not affect which routes get announced via OSPF
/ Openfabric.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
proxmox-ve-config/src/sdn/fabric/mod.rs | 19 ++++++++++++++++++-
.../section_config/protocol/openfabric.rs | 8 ++++++++
.../fabric/section_config/protocol/ospf.rs | 11 ++++++++++-
3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/proxmox-ve-config/src/sdn/fabric/mod.rs b/proxmox-ve-config/src/sdn/fabric/mod.rs
index 677a309..ab369ec 100644
--- a/proxmox-ve-config/src/sdn/fabric/mod.rs
+++ b/proxmox-ve-config/src/sdn/fabric/mod.rs
@@ -655,6 +655,7 @@ impl FabricConfig {
OpenfabricPropertiesUpdater {
hello_interval,
csnp_interval,
+ route_filter,
},
delete,
} = updater;
@@ -675,6 +676,10 @@ impl FabricConfig {
fabric_section.properties.csnp_interval = Some(csnp_interval);
}

+ if let Some(route_filter) = route_filter {
+ fabric_section.properties.route_filter = Some(route_filter);
+ }
+
for property in delete {
match property {
FabricDeletableProperties::IpPrefix => {
@@ -689,6 +694,9 @@ impl FabricConfig {
FabricDeletableProperties::Protocol(
OpenfabricDeletableProperties::HelloInterval,
) => fabric_section.properties.hello_interval = None,
+ FabricDeletableProperties::Protocol(
+ OpenfabricDeletableProperties::RouteFilter,
+ ) => fabric_section.properties.route_filter = None,
}
}

@@ -698,7 +706,7 @@ impl FabricConfig {
let FabricSectionUpdater::<OspfPropertiesUpdater, OspfDeletableProperties> {
ip_prefix,
ip6_prefix,
- properties: OspfPropertiesUpdater { area },
+ properties: OspfPropertiesUpdater { area, route_filter },
delete,
} = updater;

@@ -714,6 +722,10 @@ impl FabricConfig {
fabric_section.properties.area = area;
}

+ if let Some(route_filter) = route_filter {
+ fabric_section.properties.route_filter = Some(route_filter);
+ }
+
for property in delete {
match property {
FabricDeletableProperties::IpPrefix => {
@@ -722,6 +734,11 @@ impl FabricConfig {
FabricDeletableProperties::Ip6Prefix => {
fabric_section.ip6_prefix = None;
}
+ FabricDeletableProperties::Protocol(
+ OspfDeletableProperties::RouteFilter,
+ ) => {
+ fabric_section.properties.route_filter = None;
+ }
}
}

diff --git a/proxmox-ve-config/src/sdn/fabric/section_config/protocol/openfabric.rs b/proxmox-ve-config/src/sdn/fabric/section_config/protocol/openfabric.rs
index c68147d..7e55375 100644
--- a/proxmox-ve-config/src/sdn/fabric/section_config/protocol/openfabric.rs
+++ b/proxmox-ve-config/src/sdn/fabric/section_config/protocol/openfabric.rs
@@ -11,6 +11,7 @@ use crate::sdn::fabric::section_config::fabric::FabricSection;
use crate::sdn::fabric::section_config::interface::InterfaceName;
use crate::sdn::fabric::section_config::node::NodeSection;
use crate::sdn::fabric::FabricConfigError;
+use crate::sdn::prefix_list::PrefixListId;

/// Protocol-specific options for an OpenFabric Fabric.
#[api]
@@ -26,6 +27,12 @@ pub struct OpenfabricProperties {
/// Packets (CSNP) interval in seconds. The interval range is 1 to 600.
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) csnp_interval: Option<CsnpInterval>,
+
+ /// By default only routes from the configured IP prefix are imported into the local routing
+ /// table. This setting can be used to override the allowed IPs and import additional routes
+ /// besides the configured IP prefix.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub(crate) route_filter: Option<PrefixListId>,
}

impl Validatable for FabricSection<OpenfabricProperties> {
@@ -48,6 +55,7 @@ impl Validatable for FabricSection<OpenfabricProperties> {
pub enum OpenfabricDeletableProperties {
HelloInterval,
CsnpInterval,
+ RouteFilter,
}

/// Properties for an OpenFabric node
diff --git a/proxmox-ve-config/src/sdn/fabric/section_config/protocol/ospf.rs b/proxmox-ve-config/src/sdn/fabric/section_config/protocol/ospf.rs
index fcec5df..793e536 100644
--- a/proxmox-ve-config/src/sdn/fabric/section_config/protocol/ospf.rs
+++ b/proxmox-ve-config/src/sdn/fabric/section_config/protocol/ospf.rs
@@ -11,6 +11,7 @@ use crate::sdn::fabric::section_config::fabric::FabricSection;
use crate::sdn::fabric::section_config::interface::InterfaceName;
use crate::sdn::fabric::section_config::node::NodeSection;
use crate::sdn::fabric::FabricConfigError;
+use crate::sdn::prefix_list::PrefixListId;

#[api]
#[derive(Debug, Clone, Serialize, Deserialize, Updater, Hash)]
@@ -18,6 +19,12 @@ use crate::sdn::fabric::FabricConfigError;
pub struct OspfProperties {
/// OSPF area
pub(crate) area: Area,
+
+ /// By default only routes from the configured IP prefix are imported into the local routing
+ /// table. This setting can be used to override the allowed IPs and import additional routes
+ /// besides the configured IP prefix.
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub(crate) route_filter: Option<PrefixListId>,
}

impl OspfProperties {
@@ -51,7 +58,9 @@ impl Validatable for FabricSection<OspfProperties> {

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
-pub enum OspfDeletableProperties {}
+pub enum OspfDeletableProperties {
+ RouteFilter,
+}

#[api(
properties: {
--
2.47.3