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 BA7C11FF0C0 for ; Wed, 18 Nov 2026 19:11:03 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 84DF9216A8; Wed, 18 Nov 2026 19:11:02 +0100 (CET) Date: Wed, 18 Nov 2026 19:10:57 +0100 From: Gabriel Goller To: Stefan Hanreich Subject: Re: [PATCH proxmox-ve-rs v3 07/32] sdn: allow static routes in simple zone VRFs Message-ID: References: <20261116161154.343743-1-g.goller@proxmox.com> <20261116161154.343743-8-g.goller@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20260616 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795025459032 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.235 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: A5HLRJ7EFAL2LTWRCK7IX7YS4ZK6G5EF X-Message-ID-Hash: A5HLRJ7EFAL2LTWRCK7IX7YS4ZK6G5EF 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 CC: pve-devel@lists.proxmox.com 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 18.11.2026 16:29, Stefan Hanreich wrote: > > > 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? Hmm yeah so we do that with the fabric prefix (normalize in the api, then write the normalized prefix to config) but there the prefix doesn't have such a weight, it's basically just a way to restrict the node-ips. Here on the other hand, we actually route the prefix, so IMO a 10.10.10.125/24 is more a typo (also because the prefix actually has some weight here, not like with the fabrics). > [...] > > > +/// 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: Hmm ok I get it. We should this everywhere though, we don't this in dhcp-ranges afaik... > > +} > > + > > +#[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.. Makes sense. > > + 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) > > + } > > +}