]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - config/forwardfw/rules.pl
Merge commit '3af3ecd319bdcf8db27e9ca14af72383b4754567' into fifteen
[people/teissler/ipfire-2.x.git] / config / forwardfw / rules.pl
index baeb7ada57f0892a08df0fc925a41d463fb71b10..fcaade2d6632f3416ff742b161642e8c72c73ba7 100755 (executable)
@@ -251,13 +251,12 @@ sub buildrules
                                #print rules to console
                                foreach my $DPROT (@DPROT){
                                        $DPORT = &get_port($hash,$key,$DPROT);
-                                       print "uzlputz DPROT= $DPROT $DPORT\n";
                                        $PROT=$DPROT;
                                        $PROT="-p $PROT" if ($PROT ne '' && $PROT ne ' ');
                                        foreach my $a (sort keys %sourcehash){
                                                foreach my $b (sort keys %targethash){
                                                        if ($sourcehash{$a}[0] ne $targethash{$b}[0] && $targethash{$b}[0] ne 'none' || $sourcehash{$a}[0] eq '0.0.0.0/0.0.0.0'){
-                                                               if($DPROT eq ' ' || $DPROT ne ''){
+                                                               if($DPROT ne ''){
                                                                        if(substr($sourcehash{$a}[0], 3, 3) ne 'mac' && $sourcehash{$a}[0] ne ''){ $STAG="-s";}
                                                                        if(substr($DPORT, 2, 4) eq 'icmp'){
                                                                                my @icmprule= split(",",substr($DPORT, 12,));
@@ -316,7 +315,7 @@ sub buildrules
                                        foreach my $a (sort keys %sourcehash){
                                                foreach my $b (sort keys %targethash){
                                                        if ($sourcehash{$a}[0] ne $targethash{$b}[0] && $targethash{$b}[0] ne 'none' || $sourcehash{$a}[0] eq '0.0.0.0/0.0.0.0'){
-                                                               if($DPROT ne '' || $DPROT eq ' '){
+                                                               if($DPROT ne ''){
                                                                        if(substr($sourcehash{$a}[0], 3, 3) ne 'mac' && $sourcehash{$a}[0] ne ''){ $STAG="-s";}
                                                                        #Process ICMP RULE
                                                                        if(substr($DPORT, 2, 4) eq 'icmp'){
@@ -593,6 +592,8 @@ sub get_port
                                }else{
                                        return "--dport ".&fwlib::get_srv_port($$hash{$key}[15],1,$prot);
                                }
+                       }elsif($prot eq 'ICMP' && $$hash{$key}[11] eq 'ON'){        #When PROT is ICMP and "use targetport is checked, this is an icmp-service
+                               return "--icmp-type ".&fwlib::get_srv_port($$hash{$key}[15],3,$prot);
                        }
                }elsif($$hash{$key}[14] eq 'cust_srvgrp'){
                        if      ($prot ne 'ICMP'){