simplify check for iprange
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 3 Apr 2014 07:33:20 +0000 (09:33 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 3 Apr 2014 07:33:20 +0000 (09:33 +0200)
We already parsed the address, so we can do a simpler check.

src/PVE/Firewall.pm

index 83a9921..226d1fc 100644 (file)
@@ -952,7 +952,7 @@ sub ruleset_generate_cmdstr {
            die "no such ipset $2" if !$cluster_conf->{ipset}->{$2};
            push @cmd, "-m set --match-set PVEFW-$2 src";
 
            die "no such ipset $2" if !$cluster_conf->{ipset}->{$2};
            push @cmd, "-m set --match-set PVEFW-$2 src";
 
-        } elsif ($source =~ m/^(\d+)\.(\d+).(\d+).(\d+)\-(\d+)\.(\d+).(\d+).(\d+)$/){
+        } elsif ($source =~ m/\-/){
            push @cmd, "-m iprange --src-range $source";
 
        } else {
            push @cmd, "-m iprange --src-range $source";
 
        } else {