From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 0DFE31FF138 for ; Wed, 18 Feb 2026 16:11:37 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5F377301; Wed, 18 Feb 2026 16:12:34 +0100 (CET) From: Gabriel Goller To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox-ve-rs 2/2] fabrics: ospf: expose network-type interface property Date: Wed, 18 Feb 2026 16:11:43 +0100 Message-ID: <20260218151153.381963-3-g.goller@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260218151153.381963-1-g.goller@proxmox.com> References: <20260218151153.381963-1-g.goller@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1771427510101 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.003 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: VGAMFRFP4UNLLR4EGSY32QUQTV75M2W7 X-Message-ID-Hash: VGAMFRFP4UNLLR4EGSY32QUQTV75M2W7 X-MailFrom: g.goller@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Expose the network-type interface property to the api. Previously it was internal-only and could be changed from point-to-point to broadcast by setting or not setting an ip on the interface. Now we expose all the possible options in the ui. This is also a Option, so that we can 1) stay backwards compatible and 2) can let FRR figure out the correct mode (e.g. when adding an ip with an explicit `peer`). Also move the NetworkType enum to proxmox-sdn-types because we need it in both proxmox-frr and proxmox-ve-config and we don't want to add the `frr` feature to the whole section-config module. Signed-off-by: Gabriel Goller --- proxmox-frr/src/ser/ospf.rs | 27 +--------------- proxmox-sdn-types/src/lib.rs | 1 + proxmox-sdn-types/src/ospf.rs | 32 +++++++++++++++++++ proxmox-ve-config/src/sdn/fabric/frr.rs | 13 +++++--- .../fabric/section_config/protocol/ospf.rs | 6 ++++ 5 files changed, 49 insertions(+), 30 deletions(-) create mode 100644 proxmox-sdn-types/src/ospf.rs diff --git a/proxmox-frr/src/ser/ospf.rs b/proxmox-frr/src/ser/ospf.rs index 8b26f42e2e46..e83e8ab5a53c 100644 --- a/proxmox-frr/src/ser/ospf.rs +++ b/proxmox-frr/src/ser/ospf.rs @@ -2,6 +2,7 @@ use std::fmt::Debug; use std::net::Ipv4Addr; use bon::Builder; +use proxmox_sdn_types::ospf::NetworkType; use serde::{Deserialize, Serialize}; use thiserror::Error; @@ -81,32 +82,6 @@ pub enum OspfInterfaceError { FrrWordParse(#[from] FrrWordError), } -/// The NetworkType of the interface. -/// -/// The most important options here are Broadcast (which is the default) and PointToPoint. -/// When PointToPoint is set, then the interface has to have a /32 address and will be treated as -/// unnumbered. -/// -/// This roughly serializes to: -/// ```text -/// ip ospf network point-to-point -/// ! or -/// ip ospf network broadcast -/// ``` -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)] -#[serde(rename_all = "kebab-case")] -pub enum NetworkType { - Broadcast, - NonBroadcast, - /// If the interface is unnumbered (i.e. the router-id /32 ip-address is set on the interface). - /// - /// If OSPF is used in an unnumbered way, you don't need to configure peer-to-peer (e.g. /31) - /// addresses at every interface, but you just need to set the router-id at the interface - /// (/32). You also need to configure the `ip ospf network point-to-point` FRR option. - PointToPoint, - PointToMultipoint, -} - /// The OSPF interface properties. /// /// The interface gets tied to its fabric by the area property and the FRR `ip ospf area ` diff --git a/proxmox-sdn-types/src/lib.rs b/proxmox-sdn-types/src/lib.rs index 1656f1d44b95..29455a23e5c9 100644 --- a/proxmox-sdn-types/src/lib.rs +++ b/proxmox-sdn-types/src/lib.rs @@ -1,3 +1,4 @@ pub mod area; pub mod net; pub mod openfabric; +pub mod ospf; diff --git a/proxmox-sdn-types/src/ospf.rs b/proxmox-sdn-types/src/ospf.rs new file mode 100644 index 000000000000..43497def7ff2 --- /dev/null +++ b/proxmox-sdn-types/src/ospf.rs @@ -0,0 +1,32 @@ +use proxmox_schema::api; +use serde::{Deserialize, Serialize}; + +/// The NetworkType of the interface. +/// +/// The most important options here are Broadcast (which is the default) and PointToPoint. +/// When PointToPoint is set, then the interface has to have a /32 address and will be treated as +/// unnumbered. +/// +/// This roughly serializes to: +/// ```text +/// ip ospf network point-to-point +/// ! or +/// ip ospf network broadcast +/// ``` +#[api] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)] +#[serde(rename_all = "kebab-case")] +pub enum NetworkType { + /// Broadcast + Broadcast, + /// Non-Broadcast + NonBroadcast, + /// If the interface is unnumbered (i.e. the router-id /32 ip-address is set on the interface). + /// + /// If OSPF is used in an unnumbered way, you don't need to configure peer-to-peer (e.g. /31) + /// addresses at every interface, but you just need to set the router-id at the interface + /// (/32). You also need to configure the `ip ospf network point-to-point` FRR option. + PointToPoint, + /// Point-to-Multipoint + PointToMultipoint, +} diff --git a/proxmox-ve-config/src/sdn/fabric/frr.rs b/proxmox-ve-config/src/sdn/fabric/frr.rs index ac5e88e905a3..291371052fbe 100644 --- a/proxmox-ve-config/src/sdn/fabric/frr.rs +++ b/proxmox-ve-config/src/sdn/fabric/frr.rs @@ -309,10 +309,15 @@ fn build_ospf_interface( area, // Interfaces are always non-passive passive: None, - network_type: if interface.ip.is_some() { - None - } else { - Some(ser::ospf::NetworkType::PointToPoint) + network_type: match interface.network_type { + None => { + if interface.ip.is_some() { + None + } else { + Some(proxmox_sdn_types::ospf::NetworkType::PointToPoint) + } + } + Some(network_type) => Some(network_type), }, }; 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 df0be9591a76..d195546447b2 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 @@ -124,6 +124,12 @@ pub struct OspfInterfaceProperties { /// If IP is unset, then this is an unnumbered interface #[serde(skip_serializing_if = "Option::is_none")] pub(crate) ip: Option, + + /// Network Type of the interface. Contains all the NetworkTypes from FRR, but also includes a + /// `None` variant which enables us to decide the network-type automatically depending on if a + /// ip is given or not. (This also enables this change to be backwards-compatible). + #[serde(default, skip_serializing_if = "Option::is_none")] + pub(crate) network_type: Option, } impl OspfInterfaceProperties { -- 2.47.3