]> git.proxmox.com Git - pve-firewall.git/commitdiff
allow icmp port names
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 7 Apr 2014 06:32:29 +0000 (08:32 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 7 Apr 2014 06:32:29 +0000 (08:32 +0200)
src/PVE/Firewall.pm

index 1b83334c170ea293402a3364e866f31d04b3ff4e..9054648a40ff03c4c1f0c28a1be96960a8332b83 100644 (file)
@@ -694,6 +694,8 @@ sub parse_port_name_number_or_range {
 
     my $services = PVE::Firewall::get_etc_services();
     my $count = 0;
+    my $icmp_port = 0;
+
     foreach my $item (split(/,/, $str)) {
        $count++;
        if ($item =~ m/^(\d+):(\d+)$/) {
@@ -704,10 +706,16 @@ sub parse_port_name_number_or_range {
            my $port = $1;
            die "invalid port '$port'\n" if $port > 65535;
        } else {
-           die "invalid port '$item'\n" if !$services->{byname}->{$item}; 
+           if ($icmp_type_names->{$item}) {
+               $icmp_port = 1;
+           } else {
+               die "invalid port '$item'\n" if !$services->{byname}->{$item}; 
+           }
        }
     }
 
+    die "ICPM ports not allowed in port range\n" if $icmp_port && $count > 1;
+
     return $count;
 }