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 v2 03/11] pve-rs: sdn: add IPv6 RA builder binding
Date: Thu, 30 Apr 2026 16:29:45 +0200	[thread overview]
Message-ID: <20260430142953.315412-4-h.laimer@proxmox.com> (raw)
In-Reply-To: <20260430142953.315412-1-h.laimer@proxmox.com>

Expose the typed FRR pipeline for IPv6 Router Advertisements to perl,
so the EVPN controller plugin can fold a vnet's RA settings and its
subnets' per-prefix overrides into the FRR config it assembles.

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

diff --git a/pve-rs/Makefile b/pve-rs/Makefile
index 25642cd..f18852d 100644
--- a/pve-rs/Makefile
+++ b/pve-rs/Makefile
@@ -32,6 +32,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 \
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 0000000..7338bf9
--- /dev/null
+++ b/pve-rs/src/bindings/sdn/ipv6_ra.rs
@@ -0,0 +1,50 @@
+#[perlmod::package(name = "PVE::RS::SDN::IPv6RA", lib = "pve_rs")]
+pub mod pve_rs_sdn_ipv6_ra {
+    //! The `PVE::RS::SDN::IPv6RA` package.
+    //!
+    //! Builds the per-vnet IPv6 Router Advertisement / Neighbor Discovery configuration
+    //! the FRR template renders. Per-RA settings (M / O flags, RDNSS list, optional
+    //! timing knobs) live on the vnet running config. Per-prefix settings
+    //! (autonomous, on-link, lifetimes) live on the subnet running config. The perl side
+    //! passes both as raw running-config hashes, this module converts them into the typed
+    //! pipeline and returns the rendered `NdInterface`.
+
+    use std::collections::BTreeMap;
+
+    use anyhow::{Context, Error};
+
+    use proxmox_frr::ser::nd::NdInterface;
+    use proxmox_ve_config::sdn::{
+        config::{SubnetConfig, SubnetRunningConfig, VnetConfig, VnetRunningConfig},
+        nd::frr::build_nd_interface,
+        SubnetName, VnetName,
+    };
+
+    /// Build the [`NdInterface`] for one vnet.
+    ///
+    /// Returns `None` when the vnet has no `ipv6-ra` master toggle set, or when there
+    /// are no IPv6 subnets to advertise.
+    ///
+    /// `subnets` is the running-config slice for the subnets belonging to this vnet, in
+    /// the same shape the perl side already has them. The map is iterated in key order
+    /// so the emitted prefix list is stable.
+    #[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 c6361c3..d77099e 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;
 
-- 
2.47.3





  parent reply	other threads:[~2026-04-30 14:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30 14:29 [PATCH docs/manager/network/proxmox{-ve-rs,-perl-rs} v2 00/11] sdn: evpn: add IPv6 RA / SLAAC support Hannes Laimer
2026-04-30 14:29 ` [PATCH proxmox-ve-rs v2 01/11] frr: add IPv6 router advertisement support Hannes Laimer
2026-04-30 14:29 ` [PATCH proxmox-ve-rs v2 02/11] ve-config: add per-vnet IPv6 RA configuration Hannes Laimer
2026-04-30 14:29 ` Hannes Laimer [this message]
2026-04-30 14:29 ` [PATCH pve-network v2 04/11] sdn: evpn: add IPv6 RA / SLAAC support Hannes Laimer
2026-04-30 14:29 ` [PATCH pve-network v2 05/11] sdn: evpn: derive IP version from CIDR for gateway-less subnets Hannes Laimer
2026-04-30 14:29 ` [PATCH pve-network v2 06/11] sdn: evpn: accept untracked IPv6 NA on EVPN vnet bridges Hannes Laimer
2026-04-30 14:29 ` [PATCH pve-network v2 07/11] api: vnet: include zone-type in vnet list Hannes Laimer
2026-04-30 14:29 ` [PATCH pve-manager v2 08/11] ui: sdn: disable SNAT for IPv6 subnets Hannes Laimer
2026-04-30 14:29 ` [PATCH pve-manager v2 09/11] ui: sdn: add IPv6 RA / SLAAC support Hannes Laimer
2026-04-30 14:29 ` [PATCH pve-docs v2 10/11] sdn: document IPv6 RA / SLAAC configuration Hannes Laimer
2026-04-30 14:29 ` [PATCH pve-docs v2 11/11] sdn: add example for IPv6 in an EVPN zone Hannes Laimer

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=20260430142953.315412-4-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