]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
Forward Firewall: minor improvements, if an outgoingrule has a given port and prot...
authorAlexander Marx <amarx@ipfire.org>
Mon, 21 Jan 2013 20:26:44 +0000 (21:26 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 9 Aug 2013 12:08:13 +0000 (14:08 +0200)
If an outgoingrule has only "all" as prot, but no port, there's only one new rule created

config/forwardfw/convert-outgoingfw
config/forwardfw/rules.pl

index 89cc356975776b4aaec13a93242ddd54929c61bc..ada4196e36534c4acb72bbff57b41d945337d236 100755 (executable)
@@ -37,7 +37,7 @@ my %fwdsettings=();
 &process_groups;
 &process_rules;
 &process_p2p;
-
+system("/usr/local/bin/forwardfwctrl");
 sub process_groups
 {
        if(! -d "/var/log/converters"){ mkdir("/var/log/converters");}
@@ -279,16 +279,19 @@ sub process_rules
                if($configline[0] eq $type){
                        #some variables we can use from old config
                        if($configline[1] eq 'on'){ $active='ON';}else{$active='';}
-                       if($configline[3] eq 'all'){ 
+                       if($configline[3] eq 'all' && $configline[8] ne ''){ 
+                               push(@prot,"TCP");
+                               push(@prot,"UDP");
+                       }elsif($configline[3] eq 'all' && $configline[8] eq ''){
                                push(@prot,"");
-                               $useport='ON';
-                               $grp3='TGT_PORT';
                        }else{
                                push(@prot,$configline[3]);
-                               $useport='ON';
-                               $grp3='TGT_PORT';
                        }
-                       if($configline[4] ne ''){ $remark=$configline[4];}else{$remark='';}
+                       
+                       if($configline[4] ne ''){ 
+                               $configline[4] =~ s/,/;/g;
+                               $remark = $configline[4];
+                       }else{$remark = '';}
                        if($configline[9] eq 'aktiv'){ $log='ON';}else{$log='';}
                        if($configline[10] eq 'on' && $configline[11] eq 'on' && $configline[12] eq 'on' && $configline[13] eq 'on' && $configline[14] eq 'on' && $configline[15] eq 'on' && $configline[16] eq 'on'){
                                if($configline[17] eq '00:00' && $configline[18] eq '00:00'){
@@ -472,7 +475,6 @@ sub process_rules
                        }
                }
                &General::writehasharray($fwdfwconfig,\%fwconfig);
-               system("/usr/local/bin/forwardfwctrl");
                @prot=();
        }
        close(LOG);
index 2cdb36674fe5a0211192e3f7153e509aac255004..672fa1774513932cf12ecf6e428738bc73470e84 100755 (executable)
@@ -248,12 +248,12 @@ sub p2pblock
                my @p2pline = split( /\;/, $p2pentry );
                if ( $fwdfwsettings{'POLICY'} eq 'MODE2' ) {
                        $DO = "DROP";
-                       if ("$p2pline[2]" eq "off") {
+                       if ("$p2pline[2]" eq "on") {
                                $P2PSTRING = "$P2PSTRING --$p2pline[1]";
                        }
                } else {
                        $DO = "RETURN";
-                       if ("$p2pline[2]" eq "on") {
+                       if ("$p2pline[2]" eq "off") {
                                $P2PSTRING = "$P2PSTRING --$p2pline[1]";
                        }
                }