From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-network v3 17/28] sdn: move full range CIDR formats into a separate module
Date: Thu, 19 Nov 2026 20:41:03 +0100 [thread overview]
Message-ID: <20261119194116.575520-18-g.goller@proxmox.com> (raw)
In-Reply-To: <20261119194116.575520-1-g.goller@proxmox.com>
Zone plugins need FullRangeCIDR for static route prefixes, but using
PrefixLists from Zones::Plugin creates a circular import through
PVE::Network::SDN and Zones, so the format registration fails.
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
src/PVE/Network/SDN/Fabrics.pm | 1 +
src/PVE/Network/SDN/Formats.pm | 51 ++++++++++++++++++++++++++++++
src/PVE/Network/SDN/Makefile | 1 +
src/PVE/Network/SDN/PrefixLists.pm | 40 +----------------------
4 files changed, 54 insertions(+), 39 deletions(-)
create mode 100644 src/PVE/Network/SDN/Formats.pm
diff --git a/src/PVE/Network/SDN/Fabrics.pm b/src/PVE/Network/SDN/Fabrics.pm
index d881937f42fd..8bb7fb65cfcf 100644
--- a/src/PVE/Network/SDN/Fabrics.pm
+++ b/src/PVE/Network/SDN/Fabrics.pm
@@ -11,6 +11,7 @@ use PVE::JSONSchema qw(get_standard_option);
use PVE::INotify;
use PVE::ParseUtils qw($IPV4RE);
+use PVE::Network::SDN::Formats;
use PVE::Network::SDN::PrefixLists;
use PVE::Network::SDN::RouteMaps;
use PVE::Network::SDN::Zones;
diff --git a/src/PVE/Network/SDN/Formats.pm b/src/PVE/Network/SDN/Formats.pm
new file mode 100644
index 000000000000..5f826f225d29
--- /dev/null
+++ b/src/PVE/Network/SDN/Formats.pm
@@ -0,0 +1,51 @@
+package PVE::Network::SDN::Formats;
+
+# JSON schema formats shared by SDN modules. This module must not use other SDN
+# modules, so that it can be loaded by all of them without circular imports.
+
+use strict;
+use warnings;
+
+use PVE::JSONSchema;
+use PVE::Tools;
+
+PVE::JSONSchema::register_format('FullRangeCIDRv6', \&pve_verify_fullrangecidrv6);
+
+sub pve_verify_fullrangecidrv6 {
+ my ($cidr, $noerr) = @_;
+
+ if ($cidr =~ m!^(?:$PVE::Tools::IPV6RE)(?:/(\d+))\z! && ($1 >= 0) && ($1 <= 128)) {
+ return $cidr;
+ }
+
+ return undef if $noerr;
+ die "value does not look like a valid IPv6 CIDR network\n";
+}
+
+PVE::JSONSchema::register_format('FullRangeCIDRv4', \&pve_verify_fullrangecidrv4);
+
+sub pve_verify_fullrangecidrv4 {
+ my ($cidr, $noerr) = @_;
+
+ if ($cidr =~ m!^(?:$PVE::Tools::IPV4RE)(?:/(\d+))\z! && ($1 >= 0) && ($1 <= 32)) {
+ return $cidr;
+ }
+
+ return undef if $noerr;
+ die "value does not look like a valid IPv4 CIDR network\n";
+}
+
+PVE::JSONSchema::register_format('FullRangeCIDR', \&pve_verify_fullrangecidr);
+
+sub pve_verify_fullrangecidr {
+ my ($cidr, $noerr) = @_;
+
+ if (!(pve_verify_fullrangecidrv4($cidr, 1) || pve_verify_fullrangecidrv6($cidr, 1))) {
+ return undef if $noerr;
+ die "value does not look like a valid CIDR network\n";
+ }
+
+ return $cidr;
+}
+
+1;
diff --git a/src/PVE/Network/SDN/Makefile b/src/PVE/Network/SDN/Makefile
index d0b4bce2d067..67237ca4b2ca 100644
--- a/src/PVE/Network/SDN/Makefile
+++ b/src/PVE/Network/SDN/Makefile
@@ -9,6 +9,7 @@ SOURCES=Vnets.pm\
Dhcp.pm\
Fabrics.pm\
Frr.pm\
+ Formats.pm\
PrefixLists.pm\
RouteMaps.pm\
WireGuard.pm
diff --git a/src/PVE/Network/SDN/PrefixLists.pm b/src/PVE/Network/SDN/PrefixLists.pm
index d41c4ffcbc47..f825d208def5 100644
--- a/src/PVE/Network/SDN/PrefixLists.pm
+++ b/src/PVE/Network/SDN/PrefixLists.pm
@@ -7,6 +7,7 @@ use PVE::Cluster qw(cfs_register_file cfs_read_file cfs_lock_file cfs_write_file
use PVE::JSONSchema qw(get_standard_option);
use PVE::Tools;
use PVE::INotify;
+use PVE::Network::SDN::Formats;
use PVE::Network::SDN;
use PVE::Network::SDN::RouteMaps;
use PVE::RS::SDN::PrefixLists;
@@ -40,45 +41,6 @@ PVE::JSONSchema::register_standard_option(
},
);
-PVE::JSONSchema::register_format('FullRangeCIDRv6', \&pve_verify_fullrangecidrv6);
-
-sub pve_verify_fullrangecidrv6 {
- my ($cidr, $noerr) = @_;
-
- if ($cidr =~ m!^(?:$PVE::Tools::IPV6RE)(?:/(\d+))\z! && ($1 >= 0) && ($1 <= 128)) {
- return $cidr;
- }
-
- return undef if $noerr;
- die "value does not look like a valid IPv6 CIDR network\n";
-}
-
-PVE::JSONSchema::register_format('FullRangeCIDRv4', \&pve_verify_fullrangecidrv4);
-
-sub pve_verify_fullrangecidrv4 {
- my ($cidr, $noerr) = @_;
-
- if ($cidr =~ m!^(?:$PVE::Tools::IPV4RE)(?:/(\d+))\z! && ($1 >= 0) && ($1 <= 32)) {
- return $cidr;
- }
-
- return undef if $noerr;
- die "value does not look like a valid IPv4 CIDR network\n";
-}
-
-PVE::JSONSchema::register_format('FullRangeCIDR', \&pve_verify_fullrangecidr);
-
-sub pve_verify_fullrangecidr {
- my ($cidr, $noerr) = @_;
-
- if (!(pve_verify_fullrangecidrv4($cidr, 1) || pve_verify_fullrangecidrv6($cidr, 1))) {
- return undef if $noerr;
- die "value does not look like a valid CIDR network\n";
- }
-
- return $cidr;
-}
-
cfs_register_file(
'sdn/prefix-lists.cfg', \&parse_prefix_lists_config, \&write_prefix_lists_config,
);
--
2.47.3
next prev parent reply other threads:[~2026-11-19 19:43 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 ` Gabriel Goller [this message]
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 ` [PATCH pve-network v3 22/28] sdn: evpn: no exit node null routes for simple zone VRFs Gabriel Goller
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-18-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