]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
Firewall: Fix 10510 - Show all protocols from servicegroups (GRE,IPIP,IPV6,...)
authorAlexander Marx <alexander.marx@ipfire.org>
Wed, 9 Apr 2014 14:23:55 +0000 (16:23 +0200)
committerAlexander Marx <alexander.marx@ipfire.org>
Thu, 10 Apr 2014 06:19:56 +0000 (08:19 +0200)
html/cgi-bin/firewall.cgi

index e9957943afd6fe751222faab995b715208cbd4d6..28ae464c602e572c960717b4ea8089d06820435d 100644 (file)
@@ -1264,42 +1264,30 @@ sub get_serviceports
        my $udp;
        my $icmp;
        @protocols=();
+       my @specprot=("IPIP","IPV6","IGMP","GRE","AH","ESP");
        if($type eq 'service'){
                foreach my $key (sort { ncmp($customservice{$a}[0],$customservice{$b}[0]) } keys %customservice){
                        if ($customservice{$key}[0] eq $name){
-                               push (@protocols,$customservice{$key}[2]);
+                               push (@protocols," ".$customservice{$key}[2]);
                        }
                }
        }elsif($type eq 'group'){
                foreach my $key (sort { ncmp($customservicegrp{$a}[0],$customservicegrp{$b}[0]) } keys %customservicegrp){
                        if ($customservicegrp{$key}[0] eq $name){
-                               foreach my $key1 (sort { ncmp($customservice{$a}[0],$customservice{$b}[0]) } keys %customservice){
-                                       if ($customservice{$key1}[0] eq $customservicegrp{$key}[2]){
-                                               if($customservice{$key1}[2] eq 'TCP'){
-                                                       $tcp='TCP';
-                                               }elsif($customservice{$key1}[2] eq 'ICMP'){
-                                                       $icmp='ICMP';
-                                               }elsif($customservice{$key1}[2] eq 'UDP'){
-                                                       $udp='UDP';
+                               if ($customservicegrp{$key}[2] ~~ @specprot){
+                                       push (@protocols," ".$customservicegrp{$key}[2]);
+                               }else{
+                                       foreach my $key1 (sort { ncmp($customservice{$a}[0],$customservice{$b}[0]) } keys %customservice){
+                                               if ($customservice{$key1}[0] eq $customservicegrp{$key}[2]){
+                                                       if (!grep(/$customservice{$key1}[2]/, @protocols)){
+                                                               push (@protocols," ".$customservice{$key1}[2]);
+                                                       }
                                                }
                                        }
                                }
                        }
                }
        }
-       if($tcp && $udp && $icmp){
-               push (@protocols,"TCP,UDP, <br>ICMP");
-               return @protocols;
-       }
-       if($tcp){
-               push (@protocols,"TCP");
-       }
-       if($udp){
-               push (@protocols,"UDP");
-       }
-       if($icmp){
-               push (@protocols,"ICMP");
-       }
        return @protocols;
 }
 sub getcolor