mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-10 19:15:54 +02:00
Forward Firewall: Firewall sets Internetdevice correctly now (was always red0)
This commit is contained in:
committed by
Michael Tremer
parent
f2ab6fba4a
commit
ddcec9d339
@@ -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){
|
||||
|
||||
@@ -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'){
|
||||
|
||||
Reference in New Issue
Block a user