all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
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	[thread overview]
Message-ID: <20260515110648.217493-2-h.laimer@proxmox.com> (raw)
In-Reply-To: <20260515110648.217493-1-h.laimer@proxmox.com>

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 <h.laimer@proxmox.com>
---
 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





  reply	other threads:[~2026-05-15 11:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15 11:06 [PATCH network v2 0/4] sdn: evpn: IPv6 underlay support Hannes Laimer
2026-05-15 11:06 ` Hannes Laimer [this message]
2026-05-15 11:06 ` [PATCH pve-network v2 2/4] sdn: evpn: keep router-id valid on IPv6 underlay Hannes Laimer
2026-05-15 11:06 ` [PATCH pve-network v2 3/4] sdn: stabilize peer IP ordering when generating sdn config Hannes Laimer
2026-05-15 11:06 ` [PATCH pve-network v2 4/4] sdn: evpn: add tests covering ipv6 underlays Hannes Laimer

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=20260515110648.217493-2-h.laimer@proxmox.com \
    --to=h.laimer@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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal