From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id D6C381FF0C0 for ; Wed, 18 Nov 2026 16:31:05 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 89D902180A; Wed, 18 Nov 2026 16:30:49 +0100 (CET) Message-ID: Date: Wed, 18 Nov 2026 16:29:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH proxmox-ve-rs v3 07/32] sdn: allow static routes in simple zone VRFs To: pve-devel@lists.proxmox.com References: <20261116161154.343743-1-g.goller@proxmox.com> <20261116161154.343743-8-g.goller@proxmox.com> Content-Language: en-US From: Stefan Hanreich In-Reply-To: <20261116161154.343743-8-g.goller@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.217 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: NKY27JRWNVB5ZQROIFUG66WSAD7OGOA3 X-Message-ID-Hash: NKY27JRWNVB5ZQROIFUG66WSAD7OGOA3 X-MailFrom: s.hanreich@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: On 11/16/26 5:16 PM, Gabriel Goller wrote: > Allow simple zones to reach upstream networks through zone-wide static > routes, without requiring node-local FRR overrides. Install routes in > vrf_ when dedicated-vrf is enabled, or in the default routing table > otherwise. Only generate routes on nodes that belong to the zone. > > Support IPv4 and IPv6 routes, with an optional outgoing interface, > administrative distance and next-hop VRF. The next-hop VRF only selects > where to resolve the gateway; the route still belongs to the zone. > > Reject prefixes with host bits set, since staticd normalizes them and > frr-reload would otherwise replace them on every reload. Keep the perl > vrf field as the outgoing interface for existing EVPN routes, separate > from the VRF in which the route is installed. Can't we just normalize them ourselves before writing them out and then accept anything with host bits set? [...] > +/// Routing-related properties of a single SDN zone. > +#[derive(Clone, Debug, Deserialize)] > +pub struct ZoneRoutes { > + #[serde(rename = "type")] > + pub ty: String, > + #[serde( > + default, > + rename = "dedicated-vrf", > + deserialize_with = "proxmox_serde::perl::deserialize_bool" > + )] > + pub dedicated_vrf: bool, > + pub nodes: Option>, > + #[serde(default)] > + pub route: Vec>, We need to write this property canonicalized in Perl, as otherwise this can cause deserialization issues with values the API accepts, as I've learned the hard way D: > +} > + > +#[cfg(feature = "frr")] > +impl ZoneRoutesConfig { > + /// Generate routes only on nodes participating in the zone. > + pub fn routes_for_node(&self, node: &str) -> Result, Error> { can we skip invalid routes instead of erroring out here? It'd abort the whole FRR config generation.. > + use proxmox_frr::ser::{InterfaceName as FrrInterfaceName, IpOrInterface, IpRoute}; > + > + let to_frr = |name: &InterfaceName| FrrInterfaceName::try_from(name.as_str()); > + > + let mut routes = Vec::new(); > + for (zone, config) in &self.ids { > + if config.route.is_empty() { > + continue; > + } > + if config.ty != "simple" { > + bail!("static routes are only supported in simple zones (zone '{zone}')"); > + } > + if config > + .nodes > + .as_ref() > + .is_some_and(|nodes| !nodes.contains_key(node)) > + { > + continue; > + } > + let destination_vrf = config > + .dedicated_vrf > + .then(|| FrrInterfaceName::try_from(format!("vrf_{zone}"))) > + .transpose()?; > + for route in &config.route { > + route.validate()?; > + let mut frr_route = IpRoute::new(route.prefix, route.via.map(IpOrInterface::Ip)); > + frr_route.iface = route.iface.as_ref().map(to_frr).transpose()?; > + frr_route.distance = route.distance; > + frr_route.nexthop_vrf = route.nexthop_vrf.as_ref().map(to_frr).transpose()?; > + frr_route.destination_vrf = destination_vrf.clone(); > + routes.push(frr_route); > + } > + } > + Ok(routes) > + } > +}