]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
Forward Firewall: Firewall sets Internetdevice correctly now (was always red0)
authorAlexander Marx <amarx@ipfire.org>
Thu, 14 Mar 2013 15:24:52 +0000 (16:24 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 9 Aug 2013 12:11:56 +0000 (14:11 +0200)
config/forwardfw/firewall-lib.pl
config/forwardfw/rules.pl

index 9f806850efa1342f288e6d068e0a13ae9ba5a633..a1f96ba40ff1af290ce90a14bc7f52bc5f165ce6 100755 (executable)
@@ -207,6 +207,7 @@ sub get_grp_ip
 sub get_std_net_ip
 {
        my $val=shift;
+       my $con=shift;
        if ($val eq 'ALL'){
                return "0.0.0.0/0.0.0.0";
        }elsif($val eq 'GREEN'){
@@ -216,7 +217,7 @@ sub get_std_net_ip
        }elsif($val eq 'BLUE'){
                return "$netsettings{'BLUE_NETADDRESS'}/$netsettings{'BLUE_NETMASK'}";
        }elsif($val eq 'RED'){
-               return "0.0.0.0/0 -o red0";
+               return "0.0.0.0/0 -o $con";
        }elsif($val =~ /OpenVPN/i){
                return "$ovpnsettings{'DOVPN_SUBNET'}";
        }elsif($val =~ /IPsec/i){
index 9332c9bec3e5a03f1816d6aab4acfe6041af3ca6..2547e474f7bf3ee4eb20adb697a0e6d290764fcd 100755 (executable)
@@ -65,7 +65,7 @@ my $green;
 my $blue;
 my ($TYPE,$PROT,$SPROT,$DPROT,$SPORT,$DPORT,$TIME,$TIMEFROM,$TIMETILL,$SRC_TGT);
 my $CHAIN="FORWARDFW";
-
+my $conexists='off';
 
 &General::readhash("${General::swroot}/forward/settings", \%fwdfwsettings);
 &General::readhash("$netsettings", \%defaultNetworks);
@@ -76,6 +76,14 @@ my $CHAIN="FORWARDFW";
 &General::readhasharray($configgrp, \%customgrp);
 &General::get_aliases(\%aliases);
 
+#check if we have an internetconnection
+open (CONN,"/var/ipfire/red/iface");
+my $con = <CONN>;
+close(CONN);
+if (-f "/var/ipfire/red/active"){
+       $conexists='on';
+}
+
 ################################
 #    DEBUG/TEST                #
 ################################
@@ -153,6 +161,7 @@ sub buildrules
        my $hash=shift;
        my $STAG;
        foreach my $key (sort {$a <=> $b} keys %$hash){
+               next if ($$hash{$key}[6] eq 'RED' && $conexists eq 'off' );
                $STAG='';
                if($$hash{$key}[2] eq 'ON'){
                        #get source ip's
@@ -375,7 +384,7 @@ sub get_address
                        $$hash{$key}[0] = $base2;
                }
        }elsif($base eq 'std_net_src' || $base eq 'std_net_tgt' || $base eq 'Standard Network'){
-               $$hash{$key}[0]=&fwlib::get_std_net_ip($base2);
+               $$hash{$key}[0]=&fwlib::get_std_net_ip($base2,$con);
        }elsif($base eq 'cust_net_src' || $base eq 'cust_net_tgt' || $base eq 'Custom Network'){
                $$hash{$key}[0]=&fwlib::get_net_ip($base2);
        }elsif($base eq 'cust_host_src' || $base eq 'cust_host_tgt' || $base eq 'Custom Host'){