public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH proxmox-perl-rs v5 1/9] pve-rs: sdn: add IPv6 RA builder binding
Date: Thu, 29 Oct 2026 16:41:40 +0100	[thread overview]
Message-ID: <20261029154148.2882594-2-h.laimer@proxmox.com> (raw)
In-Reply-To: <20261029154148.2882594-1-h.laimer@proxmox.com>

Perl builds the FRR config handed in for rendering, while the
conversion of the IPv6 Router Advertisement settings for it lives in
Rust. The binding takes a vnet and its subnets as the running config
holds them and returns the vnet's entry for the RA part of that FRR
config, with the prefix defaults applied.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 pve-rs/Makefile                    |  1 +
 pve-rs/src/bindings/sdn/ipv6_ra.rs | 40 ++++++++++++++++++++++++++++++
 pve-rs/src/bindings/sdn/mod.rs     |  1 +
 3 files changed, 42 insertions(+)
 create mode 100644 pve-rs/src/bindings/sdn/ipv6_ra.rs

diff --git a/pve-rs/Makefile b/pve-rs/Makefile
index bb1cd2d5f73a..0dfd672fa496 100644
--- a/pve-rs/Makefile
+++ b/pve-rs/Makefile
@@ -33,6 +33,7 @@ PERLMOD_PACKAGES := \
 	  PVE::RS::ResourceScheduling::Static \
 	  PVE::RS::ResourceScheduling::Dynamic \
 	  PVE::RS::SDN::Fabrics \
+	  PVE::RS::SDN::IPv6RA \
 	  PVE::RS::SDN::PrefixLists \
 	  PVE::RS::SDN::RouteMaps \
 	  PVE::RS::SDN::WireGuard::PrivateKeys \
diff --git a/pve-rs/src/bindings/sdn/ipv6_ra.rs b/pve-rs/src/bindings/sdn/ipv6_ra.rs
new file mode 100644
index 000000000000..7e7ed84c788b
--- /dev/null
+++ b/pve-rs/src/bindings/sdn/ipv6_ra.rs
@@ -0,0 +1,40 @@
+#[perlmod::package(name = "PVE::RS::SDN::IPv6RA", lib = "pve_rs")]
+pub mod pve_rs_sdn_ipv6_ra {
+    //! The `PVE::RS::SDN::IPv6RA` package.
+    //!
+    //! This builds the FRR IPv6 Router Advertisement configuration of a vnet from the
+    //! running config of the vnet and its subnets.
+
+    use std::collections::BTreeMap;
+
+    use anyhow::{Context, Error};
+
+    use proxmox_frr::ser::nd::NdInterface;
+    use proxmox_ve_config::sdn::{
+        SubnetName, VnetName,
+        config::{SubnetConfig, SubnetRunningConfig, VnetConfig, VnetRunningConfig},
+        nd::frr::build_nd_interface,
+    };
+
+    /// Method: Build the [`NdInterface`] of a vnet. Returns `None` when the vnet has RAs
+    /// off or no IPv6 subnet.
+    #[export]
+    pub fn build_interface(
+        vnet_name: VnetName,
+        vnet: VnetRunningConfig,
+        subnets: BTreeMap<String, SubnetRunningConfig>,
+    ) -> Result<Option<NdInterface>, Error> {
+        let mut vnet_config = VnetConfig::new(vnet_name, None);
+        vnet_config.set_ipv6_ra(vnet.ipv6_ra_config());
+
+        let mut subnet_configs: Vec<SubnetConfig> = Vec::with_capacity(subnets.len());
+        for (id, running) in subnets {
+            let name: SubnetName = id
+                .parse()
+                .with_context(|| format!("invalid subnet id: {id}"))?;
+            subnet_configs.push(SubnetConfig::try_from_running_config(name, running)?);
+        }
+
+        Ok(build_nd_interface(&vnet_config, subnet_configs.iter()))
+    }
+}
diff --git a/pve-rs/src/bindings/sdn/mod.rs b/pve-rs/src/bindings/sdn/mod.rs
index dcae046a7e46..fb50526785e5 100644
--- a/pve-rs/src/bindings/sdn/mod.rs
+++ b/pve-rs/src/bindings/sdn/mod.rs
@@ -1,4 +1,5 @@
 pub(crate) mod fabrics;
+pub(crate) mod ipv6_ra;
 pub(crate) mod prefix_lists;
 pub(crate) mod route_maps;
 pub(crate) mod wireguard;
-- 
2.47.3





  reply	other threads:[~2026-10-29 15:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 15:41 [PATCH docs/manager/network/proxmox{-perl-rs,-ve-rs} v5 0/9] add IPv6 RA / SLAAC support to EVPN zones Hannes Laimer
2026-10-29 15:41 ` Hannes Laimer [this message]
2026-10-29 15:41 ` [PATCH proxmox-ve-rs v5 2/9] frr: add IPv6 router advertisement support Hannes Laimer
2026-10-29 15:41 ` [PATCH proxmox-ve-rs v5 3/9] ve-config: sdn: add IPv6 router advertisement settings Hannes Laimer
2026-10-29 15:41 ` [PATCH pve-manager v5 4/9] ui: sdn: add IPv6 RA / SLAAC support Hannes Laimer
2026-10-29 15:41 ` [PATCH pve-network v5 5/9] sdn: evpn: derive IP version from CIDR for gateway-less subnets Hannes Laimer
2026-10-29 15:41 ` [PATCH pve-network v5 6/9] sdn: evpn: accept untracked IPv6 neighbor advertisements Hannes Laimer
2026-10-29 15:41 ` [PATCH pve-network v5 7/9] sdn: evpn: add IPv6 RA / SLAAC support Hannes Laimer
2026-10-29 15:41 ` [PATCH pve-network v5 8/9] api: vnets: include the zone type in the vnet list Hannes Laimer
2026-10-29 15:41 ` [PATCH pve-docs v5 9/9] sdn: add IPv6 RA / SLAAC section Hannes Laimer
2026-10-30 15:07 ` [PATCH docs/manager/network/proxmox{-perl-rs,-ve-rs} v5 0/9] add IPv6 RA / SLAAC support to EVPN zones Lukas Sichert
2026-10-30 16:30   ` Lukas Sichert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261029154148.2882594-2-h.laimer@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal