[PATCH proxmox-ve-rs 1/9] frr: ospf: add redistribute setting

Stefan Hanreich
2026-05-04T16:32:25Z

Implements redistributing routes from other protocols into the OSPF
fabric. This can be useful when utilizing multiple routing protocol on
the same node, but also if routes in addition to the loopback
interface of the fabric should be distributed via OSPF.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
proxmox-frr/src/ser/ospf.rs | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/proxmox-frr/src/ser/ospf.rs b/proxmox-frr/src/ser/ospf.rs
index 8ab9136..c18725e 100644
--- a/proxmox-frr/src/ser/ospf.rs
+++ b/proxmox-frr/src/ser/ospf.rs
@@ -44,6 +44,35 @@ impl Area {
}
}

+#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
+#[serde(rename_all = "lowercase")]
+/// OSPF redistribution source protocols
+pub enum OspfRedistributionSource {
+ /// redistribute BGP routes
+ Bgp,
+ /// redistribute connected routes
+ Connected,
+ /// redistribute IS-IS routes
+ Isis,
+ /// redistribute kernel routes
+ Kernel,
+ /// redistribute Openfabric routes
+ Openfabric,
+ /// redistribute OSPF routes
+ Ospf,
+ /// redistribute static routes
+ Static,
+}
+
+#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
+pub struct OspfRedistribution {
+ pub source: OspfRedistributionSource,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub metric: Option<u32>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub route_map: Option<String>,
+}
+
/// The OSPF router properties.
///
/// Currently the only property of a OSPF router is the router_id. The router_id is used to
@@ -53,11 +82,16 @@ impl Area {
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
pub struct OspfRouter {
pub router_id: Ipv4Addr,
+ #[serde(default)]
+ pub redistribute: Vec<OspfRedistribution>,
}

impl OspfRouter {
pub fn new(router_id: Ipv4Addr) -> Self {
- Self { router_id }
+ Self {
+ router_id,
+ redistribute: Vec::new(),
+ }
}

pub fn router_id(&self) -> &Ipv4Addr {
--
2.47.3