From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id C43371FF146 for ; Tue, 12 May 2026 16:13:20 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 840D416500; Tue, 12 May 2026 16:13:18 +0200 (CEST) From: Hannes Laimer To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox-perl-rs v4 2/7] sdn: fabrics: add BGP config generation Date: Tue, 12 May 2026 16:13:00 +0200 Message-ID: <20260512141305.199664-3-h.laimer@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260512141305.199664-1-h.laimer@proxmox.com> References: <20260512141305.199664-1-h.laimer@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1778595079000 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.081 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 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: GCW4UW3URGJIMMJNIAVHY2Z5U57WLBBQ X-Message-ID-Hash: GCW4UW3URGJIMMJNIAVHY2Z5U57WLBBQ X-MailFrom: h.laimer@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: From: Stefan Hanreich Add BGP support to the fabric config generation pipeline. This includes interface name mapping and network interface output for BGP unnumbered links. Co-authored-by: Hannes Laimer Signed-off-by: Hannes Laimer Signed-off-by: Stefan Hanreich --- pve-rs/src/bindings/sdn/fabrics.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pve-rs/src/bindings/sdn/fabrics.rs b/pve-rs/src/bindings/sdn/fabrics.rs index 1ebfde1..f914094 100644 --- a/pve-rs/src/bindings/sdn/fabrics.rs +++ b/pve-rs/src/bindings/sdn/fabrics.rs @@ -32,6 +32,7 @@ pub mod pve_rs_sdn_fabrics { use proxmox_ve_config::sdn::fabric::section_config::interface::InterfaceName; use proxmox_ve_config::sdn::fabric::section_config::node::{Node as ConfigNode, NodeId}; use proxmox_ve_config::sdn::fabric::section_config::Section; + use proxmox_ve_config::sdn::fabric::section_config::protocol::bgp::BgpNode; use proxmox_ve_config::sdn::fabric::{FabricConfig, FabricEntry}; use proxmox_ve_config::sdn::wireguard::WireGuardConfigBuilder; @@ -406,6 +407,15 @@ pub mod pve_rs_sdn_fabrics { } } ConfigNode::WireGuard(_) => {} + ConfigNode::Bgp(node_section) => { + if let BgpNode::Internal(properties) = node_section.properties_mut() { + for interface in properties.interfaces_mut() { + if let Some(mapped_name) = map_name(&mapping, interface.name())? { + interface.set_name(mapped_name); + } + } + } + } } } @@ -499,6 +509,8 @@ pub mod pve_rs_sdn_fabrics { daemons.insert("fabricd"); } FabricEntry::WireGuard(_) => {} // not a frr fabric + // bgpd is enabled by default in /etc/frr/daemons + FabricEntry::Bgp(_) => {} }; } @@ -719,6 +731,22 @@ pub mod pve_rs_sdn_fabrics { } } } + ConfigNode::Bgp(node_section) => { + if let BgpNode::Internal(properties) = node_section.properties() { + for interface in properties.interfaces() { + let name = interface.name(); + writeln!(interfaces)?; + writeln!(interfaces, "auto {name}")?; + writeln!(interfaces, "iface {name} inet manual")?; + writeln!(interfaces, "\tip-forward 1")?; + writeln!(interfaces, "\tip6-forward 1")?; + // BGP unnumbered uses RAs to discover peer link-local + // addresses. frr listens for them itself, but the kernel + // would otherwise install RA-derived routes we don't want. + writeln!(interfaces, "\taccept-ra 0")?; + } + } + } } } -- 2.47.3