[pve-devel] [PATCH pve-network 2/2] fix #7077: Respect noerr flag in SDN ID validation

Arthur Bied-Charreton a.bied-charreton at proxmox.com
Wed Jan 21 11:32:33 CET 2026


The length checks in parse_sdn*_id functions would ignore the '$noerr'
parameter and always die on too-long IDs.

Also fixes grammar in error messages ("more length" -> "longer").

Signed-off-by: Arthur Bied-Charreton <a.bied-charreton at proxmox.com>
---
 src/PVE/Network/SDN/Controllers/Plugin.pm | 7 ++++++-
 src/PVE/Network/SDN/VnetPlugin.pm         | 7 ++++++-
 src/PVE/Network/SDN/Zones/Plugin.pm       | 7 ++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/PVE/Network/SDN/Controllers/Plugin.pm b/src/PVE/Network/SDN/Controllers/Plugin.pm
index f117f28..52e385c 100644
--- a/src/PVE/Network/SDN/Controllers/Plugin.pm
+++ b/src/PVE/Network/SDN/Controllers/Plugin.pm
@@ -39,7 +39,12 @@ sub parse_sdn_controller_id {
         return undef if $noerr;
         die "controller ID '$id' contains illegal characters\n";
     }
-    die "controller ID '$id' can't be more length than 64 characters\n" if length($id) > 64;
+
+    if (length($id) > 64) {
+        return undef if $noerr;
+        die "controller ID '$id' can't be longer than 64 characters\n";
+    }
+
     return $id;
 }
 
diff --git a/src/PVE/Network/SDN/VnetPlugin.pm b/src/PVE/Network/SDN/VnetPlugin.pm
index a191af1..6c5f997 100644
--- a/src/PVE/Network/SDN/VnetPlugin.pm
+++ b/src/PVE/Network/SDN/VnetPlugin.pm
@@ -39,7 +39,12 @@ sub parse_sdn_vnet_id {
         return undef if $noerr;
         die "vnet ID '$id' contains illegal characters\n";
     }
-    die "vnet ID '$id' can't be more length than 8 characters\n" if length($id) > 8;
+
+    if (length($id) > 8) {
+        return undef if $noerr;
+        die "vnet ID '$id' can't be longer than 8 characters\n";
+    }
+
     return $id;
 }
 
diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
index 14e2634..5592a09 100644
--- a/src/PVE/Network/SDN/Zones/Plugin.pm
+++ b/src/PVE/Network/SDN/Zones/Plugin.pm
@@ -41,7 +41,12 @@ sub parse_sdn_zone_id {
         return undef if $noerr;
         die "zone ID '$id' contains illegal characters\n";
     }
-    die "zone ID '$id' can't be more length than 8 characters\n" if length($id) > 8;
+
+    if (length($id) > 8) {
+        return undef if $noerr;
+        die "zone ID '$id' can't be longer than 8 characters\n";
+    }
+
     return $id;
 }
 
-- 
2.47.3




More information about the pve-devel mailing list