From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 62D091FF14C for ; Fri, 15 May 2026 13:07:06 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 584788D73; Fri, 15 May 2026 13:06:59 +0200 (CEST) From: Hannes Laimer To: pve-devel@lists.proxmox.com Subject: [PATCH pve-network v2 1/4] sdn: evpn: prepare IPv6 underlay support Date: Fri, 15 May 2026 13:06:45 +0200 Message-ID: <20260515110648.217493-2-h.laimer@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260515110648.217493-1-h.laimer@proxmox.com> References: <20260515110648.217493-1-h.laimer@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1778843206969 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.917 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_MAILER 2 Automated Mailer Tag Left in Email 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: WHIL2PRI4UXHP4I3GUZC3FW5OI5HVYEN X-Message-ID-Hash: WHIL2PRI4UXHP4I3GUZC3FW5OI5HVYEN X-MailFrom: h.laimer@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 IPv6-capable underlays to be selected and IPv6 peers to be configured. On a dual-stack underlay (every node carries both an IPv4 and IPv6 address) the EVPN session picks IPv6. Signed-off-by: Hannes Laimer --- src/PVE/Network/SDN/Controllers/EvpnPlugin.pm | 66 ++++++++++++++++--- src/PVE/Network/SDN/Zones/EvpnPlugin.pm | 16 +++-- 2 files changed, 67 insertions(+), 15 deletions(-) diff --git a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm index 8953418..0246788 100644 --- a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm +++ b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm @@ -137,22 +137,30 @@ sub generate_frr_config { return; } - if (!$current_node->{ip}) { + my $addr_key = fabric_addr_key($nodes); + if (!$addr_key) { log_warn( - "Node $local_node requires an IP in the fabric $fabric->{id} to configure the EVPN controller" + "Fabric $fabric->{id} has no consistent address family for all nodes (need all v6 or all v4)" + ); + return; + } + + if (!$current_node->{$addr_key}) { + log_warn( + "Node $local_node requires a $addr_key address in the fabric $fabric->{id} to configure the EVPN controller" ); return; } for my $node_id (sort keys %$nodes) { my $node = $nodes->{$node_id}; - push @peers, $node->{ip} if $node->{ip}; + push @peers, $node->{$addr_key}; } $loopback = "dummy_$fabric->{id}"; - $ifaceip = $current_node->{ip}; - $routerid = $current_node->{ip}; + $ifaceip = $current_node->{$addr_key}; + $routerid = $current_node->{$addr_key}; if ($fabric->{protocol} eq 'bgp' && $bgp_mode eq 'external') { if (!$current_node->{asn}) { @@ -357,21 +365,29 @@ sub generate_zone_frr_config { return; } - if (!$current_node->{ip}) { + my $addr_key = fabric_addr_key($nodes); + if (!$addr_key) { + log_warn( + "Fabric $fabric->{id} has no consistent address family for all nodes (need all v6 or all v4)" + ); + return; + } + + if (!$current_node->{$addr_key}) { log_warn( - "Node $local_node requires an IP in the fabric $fabric->{id} to configure the EVPN controller" + "Node $local_node requires a $addr_key address in the fabric $fabric->{id} to configure the EVPN controller" ); return; } for my $node (values %$nodes) { - push @peers, $node->{ip} if $node->{ip}; + push @peers, $node->{$addr_key}; } $loopback = "dummy_$fabric->{id}"; - $ifaceip = $current_node->{ip}; - $routerid = $current_node->{ip}; + $ifaceip = $current_node->{$addr_key}; + $routerid = $current_node->{$addr_key}; } elsif ($controller->{peers}) { @peers = PVE::Tools::split_list($controller->{'peers'}) if $controller->{'peers'}; @@ -673,6 +689,18 @@ sub on_update_hook { die "must have exactly one of peers / fabric defined" if ($controller->{peers} && $controller->{fabric}) || !($controller->{peers} || $controller->{fabric}); + if ($controller->{peers}) { + my @peers = PVE::Tools::split_list($controller->{peers}); + my $family; + + foreach my $peer (@peers) { + my $peer_family = Net::IP::ip_is_ipv6($peer) ? 6 : 4; + if (defined($family) && $family != $peer_family) { + die "peers must contain only IPv4 or only IPv6 addresses\n"; + } + $family = $peer_family; + } + } } } @@ -704,4 +732,22 @@ sub find_isis_controller { return $res; } +# Returns 'ip6' if every node carries an ip6, 'ip' if every node carries an ip +# (preferring v6 when both are present), or undef if the fabric has no +# consistent address family across nodes. +sub fabric_addr_key { + my ($nodes) = @_; + + my $all_v6 = 1; + my $all_v4 = 1; + for my $node (values %$nodes) { + $all_v6 = 0 if !$node->{ip6}; + $all_v4 = 0 if !$node->{ip}; + } + + return 'ip6' if $all_v6; + return 'ip' if $all_v4; + return undef; +} + 1; diff --git a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm index 5df7e5f..a78b646 100644 --- a/src/PVE/Network/SDN/Zones/EvpnPlugin.pm +++ b/src/PVE/Network/SDN/Zones/EvpnPlugin.pm @@ -188,17 +188,23 @@ sub generate_sdn_config { my $current_node = eval { $config->get_node($controller->{fabric}, $local_node) }; die "could not configure EVPN zone $plugin_config->{id}: $@" if $@; - die "Node $local_node requires an IP in the fabric $fabric->{id} to configure the EVPN zone" - if !$current_node->{ip}; + my $addr_key = PVE::Network::SDN::Controllers::EvpnPlugin::fabric_addr_key($nodes); + die + "Fabric $fabric->{id} has no consistent address family for all nodes (need all v6 or all v4)" + if !$addr_key; + + die + "Node $local_node requires a $addr_key address in the fabric $fabric->{id} to configure the EVPN zone" + if !$current_node->{$addr_key}; for my $node (values %$nodes) { - push @peers, $node->{ip} if $node->{ip}; + push @peers, $node->{$addr_key}; } $loopback = "dummy_$fabric->{id}"; - $ifaceip = $current_node->{ip}; - $routerid = $current_node->{ip}; + $ifaceip = $current_node->{$addr_key}; + $routerid = $current_node->{$addr_key}; } else { die "neither fabric nor peers configured for EVPN controller $controller->{id}"; } -- 2.47.3