]> git.proxmox.com Git - pve-firewall.git/commitdiff
cleanup: don't capture "/xx" of CIDR
authorStefan Hrdlicka <s.hrdlicka@proxmox.com>
Tue, 13 Dec 2022 15:14:19 +0000 (16:14 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 14 Dec 2022 13:40:41 +0000 (14:40 +0100)
Signed-off-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
src/PVE/Firewall.pm

index ae5f22110e0b031555e33a2bc2d53e50894a6503..4924d51bfb82cb4527434917fe9dc446fb46492e 100644 (file)
@@ -68,7 +68,7 @@ PVE::JSONSchema::register_format('IPorCIDR', \&pve_verify_ip_or_cidr);
 sub pve_verify_ip_or_cidr {
     my ($cidr, $noerr) = @_;
 
-    if ($cidr =~ m!^(?:$IPV6RE|$IPV4RE)(/(\d+))?$!) {
+    if ($cidr =~ m!^(?:$IPV6RE|$IPV4RE)(?:/\d+)?$!) {
         # Net::IP throws an error if the masked CIDR part isn't zero, e.g., `192.168.1.155/24`
         # fails but `192.168.1.0/24` succeeds. clean_cidr removes the non zero bits from the CIDR.
        my $clean_cidr = clean_cidr($cidr);