From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH proxmox-perl-rs v3 08/28] pve-rs: fabrics: assign network interfaces to configured VRFs
Date: Thu, 19 Nov 2026 20:40:54 +0100 [thread overview]
Message-ID: <20261119194116.575520-9-g.goller@proxmox.com> (raw)
In-Reply-To: <20261119194116.575520-1-g.goller@proxmox.com>
Add the VRF stanza to generated interface configuration when a fabric
has a VRF. Apply it to dummy addresses, protocol interfaces, and BGP
unnumbered interfaces so traffic enters the correct routing table.
Fabrics without a VRF keep their existing configuration.
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
pve-rs/src/bindings/sdn/fabrics.rs | 59 ++++++++++++++++++++++--------
1 file changed, 43 insertions(+), 16 deletions(-)
diff --git a/pve-rs/src/bindings/sdn/fabrics.rs b/pve-rs/src/bindings/sdn/fabrics.rs
index 1d3e8b5bbf34..b7c2d91e5471 100644
--- a/pve-rs/src/bindings/sdn/fabrics.rs
+++ b/pve-rs/src/bindings/sdn/fabrics.rs
@@ -586,7 +586,12 @@ pub mod pve_rs_sdn_fabrics {
}
/// Helper function to generate the default `/etc/network/interfaces` config for a given CIDR.
- fn render_interface(name: &str, cidr: Cidr, link_type: Option<&str>) -> Result<String, Error> {
+ fn render_interface(
+ name: &str,
+ cidr: Cidr,
+ link_type: Option<&str>,
+ vrf: Option<&str>,
+ ) -> Result<String, Error> {
let mut interface = String::new();
writeln!(interface, "auto {name}")?;
@@ -598,6 +603,9 @@ pub mod pve_rs_sdn_fabrics {
if let Some(link_type) = link_type {
writeln!(interface, "\tlink-type {link_type}")?;
}
+ if let Some(vrf) = vrf {
+ writeln!(interface, "\tvrf {vrf}")?;
+ }
writeln!(interface, "\tip-forward 1")?;
Ok(interface)
@@ -607,12 +615,14 @@ pub mod pve_rs_sdn_fabrics {
interfaces: &mut String,
fabric: &Fabric,
node: &ConfigNode,
+ vrf: Option<&str>,
) -> Result<(), Error> {
if let Some(ip) = node.ip() {
let interface = render_interface(
&format!("dummy_{}", fabric.id()),
Cidr::new_v4(ip, 32)?,
Some("dummy"),
+ vrf,
)?;
writeln!(interfaces)?;
write!(interfaces, "{interface}")?;
@@ -623,6 +633,7 @@ pub mod pve_rs_sdn_fabrics {
&format!("dummy_{}", fabric.id()),
Cidr::new_v6(ip6, 128)?,
Some("dummy"),
+ vrf,
)?;
writeln!(interfaces)?;
write!(interfaces, "{interface}")?;
@@ -640,28 +651,35 @@ pub mod pve_rs_sdn_fabrics {
let config = this.fabric_config.lock().unwrap();
let mut interfaces = String::new();
- let node_fabrics = config.values().filter_map(|entry| {
- entry
- .get_node(&node_id)
- .map(|node| (entry.fabric(), node))
- .ok()
- });
+ let node_fabrics = config
+ .values()
+ .filter_map(|entry| entry.get_node(&node_id).map(|node| (entry, node)).ok());
- for (fabric, node) in node_fabrics {
- render_dummy_interfaces(&mut interfaces, fabric, node)?;
+ for (entry, node) in node_fabrics {
+ let fabric = entry.fabric();
+ let vrf = entry.fabric_vrf_name();
+ render_dummy_interfaces(&mut interfaces, fabric, node, vrf.as_deref())?;
match node {
ConfigNode::Openfabric(node_section) => {
for interface in node_section.properties().interfaces() {
if let Some(ip) = interface.ip() {
- let interface =
- render_interface(interface.name(), Cidr::from(ip), None)?;
+ let interface = render_interface(
+ interface.name(),
+ Cidr::from(ip),
+ None,
+ vrf.as_deref(),
+ )?;
writeln!(interfaces)?;
write!(interfaces, "{interface}")?;
}
if let Some(ip) = interface.ip6() {
- let interface =
- render_interface(interface.name(), Cidr::from(ip), None)?;
+ let interface = render_interface(
+ interface.name(),
+ Cidr::from(ip),
+ None,
+ vrf.as_deref(),
+ )?;
writeln!(interfaces)?;
write!(interfaces, "{interface}")?;
}
@@ -678,7 +696,8 @@ pub mod pve_rs_sdn_fabrics {
} else {
anyhow::bail!("there has to be a ipv4 or ipv6 node address");
});
- let interface = render_interface(interface.name(), cidr, None)?;
+ let interface =
+ render_interface(interface.name(), cidr, None, vrf.as_deref())?;
writeln!(interfaces)?;
write!(interfaces, "{interface}")?;
}
@@ -688,8 +707,12 @@ pub mod pve_rs_sdn_fabrics {
for interface in node_section.properties().interfaces() {
writeln!(interfaces)?;
if let Some(ip) = interface.ip() {
- let interface =
- render_interface(interface.name(), Cidr::from(ip), None)?;
+ let interface = render_interface(
+ interface.name(),
+ Cidr::from(ip),
+ None,
+ vrf.as_deref(),
+ )?;
write!(interfaces, "{interface}")?;
} else {
let interface = render_interface(
@@ -698,6 +721,7 @@ pub mod pve_rs_sdn_fabrics {
anyhow::anyhow!("there has to be a ipv4 address")
})?)),
None,
+ vrf.as_deref(),
)?;
write!(interfaces, "{interface}")?;
}
@@ -765,6 +789,9 @@ pub mod pve_rs_sdn_fabrics {
writeln!(interfaces)?;
writeln!(interfaces, "auto {name}")?;
writeln!(interfaces, "iface {name} inet manual")?;
+ if let Some(vrf) = &vrf {
+ writeln!(interfaces, "\tvrf {vrf}")?;
+ }
writeln!(interfaces, "\tip-forward 1")?;
writeln!(interfaces, "\tip6-forward 1")?;
// BGP unnumbered uses RAs to discover peer link-local
--
2.47.3
next prev parent reply other threads:[~2026-11-19 19:41 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 19:40 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/28] SDN VRF support Gabriel Goller
2026-11-19 19:40 ` [PATCH pve-common v3 01/28] interfaces: preserve VRF membership across address family changes Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 02/28] frr: add VRF-aware OSPF rendering Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 03/28] sdn: add zone references to OSPF and BGP fabrics Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 04/28] sdn: generate fabric routing configuration in zone VRFs Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 05/28] sdn: fix VRF route-map scoping and zone ID validation Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 06/28] tests: fabrics: add tests for fabrics in VRFs Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 07/28] sdn: allow static routes in simple zone VRFs Gabriel Goller
2026-11-19 19:40 ` Gabriel Goller [this message]
2026-11-19 19:40 ` [PATCH proxmox-perl-rs v3 09/28] pve-rs: fabrics: make per-fabric status queries VRF-aware Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-perl-rs v3 10/28] pve-rs: fabrics: include VRF routes in aggregate status Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-perl-rs v3 11/28] pve-rs: fabrics: expose host interface membership Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-perl-rs v3 12/28] sdn: expose static routes for simple zone uplinks Gabriel Goller
2026-11-19 19:40 ` [PATCH pve-network v3 13/28] sdn: evpn: add unreachable IPv6 default route to zone VRFs Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 14/28] sdn: add optional VRFs for simple zones Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 15/28] sdn: allow fabrics to use simple zone VRFs Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 16/28] sdn: require underlay fabrics to use the default VRF Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 17/28] sdn: move full range CIDR formats into a separate module Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 18/28] sdn: simple: support static routes in zone routing tables Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 19/28] sdn: dhcp: only configure DHCP for zones on the local node Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 20/28] sdn: dhcp: run dnsmasq in the zone VRF Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 21/28] sdn: dhcp: fix DNS server option for IPv4 subnets without gateway Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 22/28] sdn: evpn: no exit node null routes for simple zone VRFs Gabriel Goller
2026-11-19 19:41 ` [PATCH proxmox-widget-toolkit v3 23/28] ui: network: allow selecting a VRF for host interfaces Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-manager v3 24/28] ui: sdn: add VRF zone selection for fabrics Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-manager v3 25/28] network: allow setting the VRF of host interfaces Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-manager v3 26/28] ui: sdn: allow static routes for Simple zone VRFs Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-manager v3 27/28] network: generate SDN DHCP config after ifreload Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-manager v3 28/28] ui: sdn: subnet: allow setting the DHCP DNS server Gabriel Goller
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=20261119194116.575520-9-g.goller@proxmox.com \
--to=g.goller@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.