]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - config/outgoingfw/outgoingfw.pl
Fixed outgoing fw log messages in mode 1 and found a bug logging only
[people/pmueller/ipfire-2.x.git] / config / outgoingfw / outgoingfw.pl
index e2f9093f0d7c091585024f15e61392de21eba85f..53462db483d99c747e1325e24d4472f02c7eadb2 100644 (file)
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2005-2010  IPFire Team                                        #
+# Copyright (C) 2007-2011  IPFire Team                                        #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -25,6 +25,7 @@ use strict;
 #use warnings;
 
 require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
 
 my %outfwsettings = ();
 my %checked = ();
@@ -153,12 +154,12 @@ foreach $configentry (sort @configs)
                } elsif ($configline[2] eq 'ip') {
                        @SOURCE = ("$configline[5]");
                        $DEV = "";
-               } elsif ($configline[2] eq 'all') {
-                       @SOURCE = ("0/0");
-                       $DEV = "";
                } elsif ($configline[2] eq 'mac') {
                        @SOURCE = ("$configline[6]");
                        $DEV = "";
+               } elsif ($configline[2] eq 'all') {
+                       @SOURCE = ("0/0");
+                       $DEV = "";
                } else {
                        if ( -e "/var/ipfire/outgoing/groups/ipgroups/$configline[2]" ) {
                                @SOURCE = `cat /var/ipfire/outgoing/groups/ipgroups/$configline[2]`;
@@ -187,9 +188,9 @@ foreach $configentry (sort @configs)
                        foreach $SOURCE (@SOURCE) {
                                $SOURCE =~ s/\s//gi;
 
-                               if ( $SOURCE eq "" ){next;}
+                               if ( $SOURCE eq "" || $configline[1] eq "" ){next;}
 
-                               if ( $configline[6] ne "" || $configline[2] eq 'mac' ){
+                               if ( ( $configline[6] ne "" || $configline[2] eq 'mac' ) && $configline[2] ne 'all'){
                                        $SOURCE =~ s/[^a-zA-Z0-9]/:/gi;
                                        $CMD = "/sbin/iptables -A OUTGOINGFWMAC -m mac --mac-source $SOURCE -d $DESTINATION -p $PROTO";
                                } else {
@@ -218,7 +219,13 @@ foreach $configentry (sort @configs)
 
                                $CMD = "$CMD -o $netsettings{'RED_DEV'}";
 
-                               if ($configline[9] eq "aktiv") {
+                               if ( $configline[9] eq $Lang::tr{'aktiv'} && $outfwsettings{'POLICY'} eq 'MODE1' ) {
+                                       if ($DEBUG) {
+                                               print "$CMD -m limit --limit 10/minute -j LOG --log-prefix 'LOG_OUTGOINGFW '\n";
+                                       } else {
+                                               system("$CMD -m limit --limit 10/minute -j LOG --log-prefix 'LOG_OUTGOINGFW '");
+                                       }
+                               } elsif ( $configline[9] eq $Lang::tr{'aktiv'} && $outfwsettings{'POLICY'} eq 'MODE2' ) {
                                        if ($DEBUG) {
                                                print "$CMD -m limit --limit 10/minute -j LOG --log-prefix 'DROP_OUTGOINGFW '\n";
                                        } else {