From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 330DF1FF0BC for ; Mon, 16 Nov 2026 17:12:42 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B6130216F7; Mon, 16 Nov 2026 17:12:06 +0100 (CET) From: Gabriel Goller To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox-ve-rs v3 08/32] sdn: support static routes in EVPN zone VRFs Date: Mon, 16 Nov 2026 17:11:28 +0100 Message-ID: <20261116161154.343743-9-g.goller@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261116161154.343743-1-g.goller@proxmox.com> References: <20261116161154.343743-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: 1794845520152 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.221 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: VZLX25WF56Z3ZG3LYGGA4I55CEP7QMUN X-Message-ID-Hash: VZLX25WF56Z3ZG3LYGGA4I55CEP7QMUN 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: Allow EVPN zones to reach networks behind appliances or external routers using the same zone-wide static routes as simple zones. EVPN routes always belong to vrf_, without requiring the dedicated-vrf option used by simple zones. Generate routes on all nodes that belong to the zone, not just exit nodes. This does not enable redistribution of static routes, so adding a route does not by itself advertise it to other nodes. Signed-off-by: Gabriel Goller --- proxmox-ve-config/src/sdn/static_route.rs | 11 +++-- proxmox-ve-config/tests/static_routes/main.rs | 40 ++++++++++++++++++- ...tatic_routes__evpn_zone_routes_to_frr.snap | 12 ++++++ 3 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap diff --git a/proxmox-ve-config/src/sdn/static_route.rs b/proxmox-ve-config/src/sdn/static_route.rs index eab6300374ff..0a5e0b3939f4 100644 --- a/proxmox-ve-config/src/sdn/static_route.rs +++ b/proxmox-ve-config/src/sdn/static_route.rs @@ -1,4 +1,4 @@ -//! Static routes stored as repeatable property strings in simple SDN zones. +//! Static routes stored as repeatable property strings in Simple and EVPN SDN zones. use std::collections::BTreeMap; use std::net::IpAddr; @@ -22,7 +22,7 @@ use crate::sdn::fabric::section_config::interface::InterfaceName; )] #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(rename_all = "kebab-case", deny_unknown_fields)] -/// A static route in a simple zone. The destination VRF is determined by the zone. +/// A static route in a Simple or EVPN zone. The destination VRF is determined by the zone. pub struct StaticRoute { /// Destination prefix, including 0.0.0.0/0 or ::/0 for a default route. pub prefix: Cidr, @@ -119,8 +119,8 @@ impl ZoneRoutesConfig { if config.route.is_empty() { continue; } - if config.ty != "simple" { - bail!("static routes are only supported in simple zones (zone '{zone}')"); + if !matches!(config.ty.as_str(), "simple" | "evpn") { + bail!("static routes are only supported in Simple and EVPN zones (zone '{zone}')"); } if config .nodes @@ -129,8 +129,7 @@ impl ZoneRoutesConfig { { continue; } - let destination_vrf = config - .dedicated_vrf + let destination_vrf = (config.ty == "evpn" || config.dedicated_vrf) .then(|| FrrInterfaceName::try_from(format!("vrf_{zone}"))) .transpose()?; for route in &config.route { diff --git a/proxmox-ve-config/tests/static_routes/main.rs b/proxmox-ve-config/tests/static_routes/main.rs index a0daf38449ff..f198a3bf3353 100644 --- a/proxmox-ve-config/tests/static_routes/main.rs +++ b/proxmox-ve-config/tests/static_routes/main.rs @@ -59,6 +59,44 @@ fn simple_zone_routes_to_frr() -> Result<(), Error> { Ok(()) } +#[test] +fn evpn_zone_routes_to_frr() -> Result<(), Error> { + let zones: ZoneRoutesConfig = serde_json::from_value(json!({"ids": { + "blue": { + "type": "evpn", + "nodes": {"pve1": 1, "pve2": 1}, + "exitnodes": {"pve1": 1}, + "route": [ + "prefix=0.0.0.0/0,via=10.10.0.2", + "prefix=172.20.0.0/16,via=192.0.2.1,distance=200,nexthop-vrf=default", + "prefix=::/0,via=fe80::1,iface=vnetblue", + "prefix=198.51.100.0/24,iface=uplink0" + ] + }, + "disabled": { + "type": "evpn", + "nodes": {}, + "route": ["prefix=192.0.2.0/24,iface=unused0"] + } + }}))?; + let config = FrrConfig { + ip_routes: zones.routes_for_node("pve1")?, + ..Default::default() + }; + // EVPN always uses the zone VRF, without requiring the Simple-only dedicated-vrf flag. + let output = dump(&config)?; + insta::assert_snapshot!(output); + + // Routes apply to every zone node, not just exit nodes. FRR resolves local interfaces. + let other = FrrConfig { + ip_routes: zones.routes_for_node("pve2")?, + ..Default::default() + }; + assert_eq!(dump(&other)?, output); + assert!(zones.routes_for_node("pve3")?.is_empty()); + Ok(()) +} + #[test] fn validate_route_properties() { for value in [ @@ -109,7 +147,7 @@ fn validate_route_properties() { #[test] fn reject_routes_in_other_zone_types() -> Result<(), Error> { - for ty in ["vlan", "qinq", "vxlan", "evpn", "faucet"] { + for ty in ["vlan", "qinq", "vxlan", "faucet"] { let zones: ZoneRoutesConfig = serde_json::from_value(json!({"ids": { "zone1": {"type": ty, "route": ["prefix=0.0.0.0/0,via=192.0.2.1"]} }}))?; diff --git a/proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap new file mode 100644 index 000000000000..0301559a6d77 --- /dev/null +++ b/proxmox-ve-config/tests/static_routes/snapshots/static_routes__evpn_zone_routes_to_frr.snap @@ -0,0 +1,12 @@ +--- +source: proxmox-ve-config/tests/static_routes/main.rs +expression: output +--- +! +ip route 0.0.0.0/0 10.10.0.2 vrf vrf_blue +! +ip route 172.20.0.0/16 192.0.2.1 200 nexthop-vrf default vrf vrf_blue +! +ipv6 route ::/0 fe80::1 vnetblue vrf vrf_blue +! +ip route 198.51.100.0/24 uplink0 vrf vrf_blue -- 2.47.3