public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-network v3 22/28] sdn: evpn: no exit node null routes for simple zone VRFs
Date: Thu, 19 Nov 2026 20:41:08 +0100	[thread overview]
Message-ID: <20261119194116.575520-23-g.goller@proxmox.com> (raw)
In-Reply-To: <20261119194116.575520-1-g.goller@proxmox.com>

Exit nodes add null routes for subnets of other zones, so that traffic
falling through from the EVPN zone VRF to the main table is not routed
into those zones.

Subnets of simple zones with a dedicated VRF are not in the main table,
so this is not needed. The null routes would also blackhole these
prefixes for EVPN guests even when they are reachable over the uplink,
e.g. when a dedicated VRF reuses an address range.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/Network/SDN/Controllers/EvpnPlugin.pm | 10 ++-
 .../expected_controller_config                | 78 +++++++++++++++++++
 .../expected_sdn_interfaces                   | 67 ++++++++++++++++
 .../exitnodenullroute_simple_vrf/interfaces   |  7 ++
 .../exitnodenullroute_simple_vrf/sdn_config   | 47 +++++++++++
 5 files changed, 208 insertions(+), 1 deletion(-)
 create mode 100644 src/test/zones/evpn/exitnodenullroute_simple_vrf/expected_controller_config
 create mode 100644 src/test/zones/evpn/exitnodenullroute_simple_vrf/expected_sdn_interfaces
 create mode 100644 src/test/zones/evpn/exitnodenullroute_simple_vrf/interfaces
 create mode 100644 src/test/zones/evpn/exitnodenullroute_simple_vrf/sdn_config

diff --git a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
index 67afe936ecc9..4a8c46258f2f 100644
--- a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
+++ b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm
@@ -431,13 +431,21 @@ sub generate_zone_frr_config {
     # Add null routes for other zones to avoid routing between nodes through exit nodes
     if ($is_gateway) {
         my $subnets = PVE::Network::SDN::Vnets::get_subnets();
+        my $zones = PVE::Network::SDN::Zones::config(1);
         my $cidrs = {};
         foreach my $subnetid (sort keys %{$subnets}) {
             my $subnet = $subnets->{$subnetid};
             my $cidr = $subnet->{cidr};
             my $zone = $subnet->{zone};
+            next if $zone eq $id;
+
+            # Subnets of simple zones with a dedicated VRF are not routed in the default
+            # VRF, so traffic falling through from this VRF cannot reach them anyway.
+            my $zone_cfg = $zones->{ids}->{$zone};
+            next if $zone_cfg && $zone_cfg->{type} eq 'simple' && $zone_cfg->{'dedicated-vrf'};
+
             my ($ip, $mask) = split(/\//, $cidr);
-            $cidrs->{$ip} = $mask if $zone ne $id;
+            $cidrs->{$ip} = $mask;
         }
 
         my @sorted_ip =
diff --git a/src/test/zones/evpn/exitnodenullroute_simple_vrf/expected_controller_config b/src/test/zones/evpn/exitnodenullroute_simple_vrf/expected_controller_config
new file mode 100644
index 000000000000..978986ca749e
--- /dev/null
+++ b/src/test/zones/evpn/exitnodenullroute_simple_vrf/expected_controller_config
@@ -0,0 +1,78 @@
+frr version 10.6.1
+frr defaults datacenter
+hostname localhost
+log syslog informational
+service integrated-vtysh-config
+!
+vrf vrf_myzone
+ vni 1000
+ ip route 172.16.0.0/24 null0
+exit-vrf
+!
+router bgp 65000
+ bgp router-id 192.168.0.1
+ no bgp hard-administrative-reset
+ no bgp default ipv4-unicast
+ coalesce-time 1000
+ no bgp graceful-restart notification
+ neighbor VTEP peer-group
+ neighbor VTEP remote-as 65000
+ neighbor VTEP bfd
+ neighbor 192.168.0.2 peer-group VTEP
+ neighbor 192.168.0.3 peer-group VTEP
+ !
+ address-family ipv4 unicast
+  import vrf vrf_myzone
+ exit-address-family
+ !
+ address-family ipv6 unicast
+  import vrf vrf_myzone
+ exit-address-family
+ !
+ address-family l2vpn evpn
+  neighbor VTEP activate
+  neighbor VTEP route-map MAP_VTEP_IN in
+  neighbor VTEP route-map MAP_VTEP_OUT out
+  advertise-all-vni
+ exit-address-family
+exit
+!
+router bgp 65000 vrf vrf_myzone
+ bgp router-id 192.168.0.1
+ no bgp hard-administrative-reset
+ no bgp graceful-restart notification
+ !
+ address-family ipv4 unicast
+  redistribute connected
+ exit-address-family
+ !
+ address-family ipv6 unicast
+  redistribute connected
+ exit-address-family
+ !
+ address-family l2vpn evpn
+  default-originate ipv4
+  default-originate ipv6
+ exit-address-family
+exit
+!
+ip prefix-list only_default seq 1 permit 0.0.0.0/0
+!
+ipv6 prefix-list only_default_v6 seq 1 permit ::/0
+!
+route-map MAP_VTEP_IN deny 1
+ match ip address prefix-list only_default
+exit
+!
+route-map MAP_VTEP_IN deny 2
+ match ipv6 address prefix-list only_default_v6
+exit
+!
+route-map MAP_VTEP_IN permit 3
+exit
+!
+route-map MAP_VTEP_OUT permit 1
+exit
+!
+line vty
+!
diff --git a/src/test/zones/evpn/exitnodenullroute_simple_vrf/expected_sdn_interfaces b/src/test/zones/evpn/exitnodenullroute_simple_vrf/expected_sdn_interfaces
new file mode 100644
index 000000000000..0735b88a3aaa
--- /dev/null
+++ b/src/test/zones/evpn/exitnodenullroute_simple_vrf/expected_sdn_interfaces
@@ -0,0 +1,67 @@
+#version:1
+
+auto myvnet
+iface myvnet
+	address 10.0.0.1/24
+	bridge_ports vxlan_myvnet
+	bridge_stp off
+	bridge_fd 0
+	mtu 1450
+	ip-forward on
+	arp-accept on
+	vrf vrf_myzone
+
+auto simplevnet
+iface simplevnet
+	address 172.16.0.1/24
+	bridge_ports none
+	bridge_stp off
+	bridge_fd 0
+	ip-forward on
+
+auto vrf_myzone
+iface vrf_myzone
+	vrf-table auto
+	post-up ip route del vrf vrf_myzone unreachable default metric 4278198272
+	post-up ip -6 route del vrf vrf_myzone unreachable default metric 4278198272 || true
+
+auto vrf_vrfzone
+iface vrf_vrfzone
+	vrf-table auto
+	post-up ip route add vrf vrf_vrfzone unreachable default metric 4278198272
+	post-up ip -6 route add vrf vrf_vrfzone unreachable default metric 4278198272 || true
+
+auto vrfbr_myzone
+iface vrfbr_myzone
+	bridge-ports vrfvx_myzone
+	bridge_stp off
+	bridge_fd 0
+	mtu 1450
+	vrf vrf_myzone
+
+auto vrfvnet
+iface vrfvnet
+	address 172.16.1.1/24
+	address 2b0f:1480::1/64
+	bridge_ports none
+	bridge_stp off
+	bridge_fd 0
+	ip-forward on
+	ip6-forward on
+	vrf vrf_vrfzone
+
+auto vrfvx_myzone
+iface vrfvx_myzone
+	vxlan-id 1000
+	vxlan-local-tunnelip 192.168.0.1
+	bridge-learning off
+	bridge-arp-nd-suppress on
+	mtu 1450
+
+auto vxlan_myvnet
+iface vxlan_myvnet
+	vxlan-id 100
+	vxlan-local-tunnelip 192.168.0.1
+	bridge-learning off
+	bridge-arp-nd-suppress on
+	mtu 1450
diff --git a/src/test/zones/evpn/exitnodenullroute_simple_vrf/interfaces b/src/test/zones/evpn/exitnodenullroute_simple_vrf/interfaces
new file mode 100644
index 000000000000..66bb826a44b3
--- /dev/null
+++ b/src/test/zones/evpn/exitnodenullroute_simple_vrf/interfaces
@@ -0,0 +1,7 @@
+auto vmbr0
+iface vmbr0 inet static
+	address 192.168.0.1/24
+	gateway 192.168.0.254
+        bridge-ports eth0
+        bridge-stp off
+        bridge-fd 0
diff --git a/src/test/zones/evpn/exitnodenullroute_simple_vrf/sdn_config b/src/test/zones/evpn/exitnodenullroute_simple_vrf/sdn_config
new file mode 100644
index 000000000000..8a5ee50dc101
--- /dev/null
+++ b/src/test/zones/evpn/exitnodenullroute_simple_vrf/sdn_config
@@ -0,0 +1,47 @@
+{
+  version => 1,
+  vnets   => {
+               ids => {
+                        myvnet => { tag => "100", type => "vnet", zone => "myzone" },
+                        simplevnet => { type => "vnet", zone => "simple" },
+                        vrfvnet => { type => "vnet", zone => "vrfzone" },
+                      },
+             },
+
+  zones   => {
+		ids => {
+			myzone => { ipam => "pve", type => "evpn", controller => "evpnctl", 'vrf-vxlan' => 1000, exitnodes => { 'localhost' => 1 } },
+			simple => { ipam => "pve", type => "simple" },
+			vrfzone => { ipam => "pve", type => "simple", 'dedicated-vrf' => 1 },
+		}
+             },
+  controllers  => {
+               ids => { evpnctl => { type => "evpn", 'peers' => '192.168.0.1,192.168.0.2,192.168.0.3', asn => "65000" } },
+             },
+
+  subnets => {
+		ids => {
+			'myzone-10.0.0.0-24' => {
+			    'type' => 'subnet',
+			    'vnet' => 'myvnet',
+			    'gateway' => '10.0.0.1',
+			},
+			'simple-172.16.0.0-24' => {
+			    'type' => 'subnet',
+			    'vnet' => 'simplevnet',
+			    'gateway' => '172.16.0.1',
+			},
+			'vrfzone-172.16.1.0-24' => {
+			    'type' => 'subnet',
+			    'vnet' => 'vrfvnet',
+			    'gateway' => '172.16.1.1',
+			},
+			'vrfzone-2b0f:1480::-64' => {
+			    'type' => 'subnet',
+			    'vnet' => 'vrfvnet',
+			    'gateway' => '2b0f:1480::1',
+			},
+		}
+  }
+
+}
-- 
2.47.3





  parent reply	other threads:[~2026-11-19 19:44 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 19:40 [PATCH common/manager/network/proxmox{-ve-rs,-perl-rs,-widget-toolkit} v3 00/28] SDN VRF support Gabriel Goller
2026-11-19 19:40 ` [PATCH pve-common v3 01/28] interfaces: preserve VRF membership across address family changes Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 02/28] frr: add VRF-aware OSPF rendering Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 03/28] sdn: add zone references to OSPF and BGP fabrics Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 04/28] sdn: generate fabric routing configuration in zone VRFs Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 05/28] sdn: fix VRF route-map scoping and zone ID validation Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 06/28] tests: fabrics: add tests for fabrics in VRFs Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-ve-rs v3 07/28] sdn: allow static routes in simple zone VRFs Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-perl-rs v3 08/28] pve-rs: fabrics: assign network interfaces to configured VRFs Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-perl-rs v3 09/28] pve-rs: fabrics: make per-fabric status queries VRF-aware Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-perl-rs v3 10/28] pve-rs: fabrics: include VRF routes in aggregate status Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-perl-rs v3 11/28] pve-rs: fabrics: expose host interface membership Gabriel Goller
2026-11-19 19:40 ` [PATCH proxmox-perl-rs v3 12/28] sdn: expose static routes for simple zone uplinks Gabriel Goller
2026-11-19 19:40 ` [PATCH pve-network v3 13/28] sdn: evpn: add unreachable IPv6 default route to zone VRFs Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 14/28] sdn: add optional VRFs for simple zones Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 15/28] sdn: allow fabrics to use simple zone VRFs Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 16/28] sdn: require underlay fabrics to use the default VRF Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 17/28] sdn: move full range CIDR formats into a separate module Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 18/28] sdn: simple: support static routes in zone routing tables Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 19/28] sdn: dhcp: only configure DHCP for zones on the local node Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 20/28] sdn: dhcp: run dnsmasq in the zone VRF Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-network v3 21/28] sdn: dhcp: fix DNS server option for IPv4 subnets without gateway Gabriel Goller
2026-11-19 19:41 ` Gabriel Goller [this message]
2026-11-19 19:41 ` [PATCH proxmox-widget-toolkit v3 23/28] ui: network: allow selecting a VRF for host interfaces Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-manager v3 24/28] ui: sdn: add VRF zone selection for fabrics Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-manager v3 25/28] network: allow setting the VRF of host interfaces Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-manager v3 26/28] ui: sdn: allow static routes for Simple zone VRFs Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-manager v3 27/28] network: generate SDN DHCP config after ifreload Gabriel Goller
2026-11-19 19:41 ` [PATCH pve-manager v3 28/28] ui: sdn: subnet: allow setting the DHCP DNS server Gabriel Goller

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=20261119194116.575520-23-g.goller@proxmox.com \
    --to=g.goller@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal