Forward Firewall: fixed converterbug and added ruleposition to new rules in forwardfw.cgi

This commit is contained in:
Alexander Marx
2013-01-26 21:11:21 +01:00
committed by Michael Tremer
parent e3afaf8890
commit 70d38e5089
2 changed files with 31 additions and 12 deletions

View File

@@ -54,7 +54,6 @@ sub process_groups
$ip =~ s/\s//gi;
print LOG "Check IP $ip from Group $group ";
my $val=&check_ip($ip);
print "ALARM IP ist nun: $val"; ############################
if($val){
push(@hostarray,$val.",ip");
print LOG "-> OK\n";
@@ -102,16 +101,12 @@ sub check_ip
{
my $adr=shift;
my $a;
print "habe bekommen: $adr\n";#########################################
#ip with subnet in decimal
if($adr =~ m/^(\d\d?\d?).(\d\d?\d?).(\d\d?\d?).(\d\d?\d?)\/(\d{1,2})$/){
print "Bin drin, erkannt: cidr\n";################################
$adr=int($1).".".int($2).".".int($3).".".int($4);
my $b = &General::iporsubtodec($5);
$a=$adr."/".$b;
}elsif($adr =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/){
print "Hm erkannt ip ohne subnetz, ersetze es\n";#################
$adr=int($1).".".int($2).".".int($3).".".int($4);
if(&General::validip($adr)){
$a=$adr."/255.255.255.255";
@@ -209,7 +204,7 @@ sub new_hostgrp
&General::writehasharray($confighosts,\%hosts);
&General::writehasharray($configgroups,\%groups);
&General::writehasharray($confignets,\%nets);
}
sub check_host
{
@@ -291,7 +286,7 @@ sub process_rules
}else{
push(@prot,$configline[3]);
}
if($configline[4] ne ''){
$configline[4] =~ s/,/;/g;
$remark = $configline[4];
@@ -557,5 +552,5 @@ sub build_ovpn_grp
sub process_p2p
{
copy("/var/ipfire/outgoing/p2protocols","/var/ipfire/forward/p2protocols");
chmod oct(0777), '/var/ipfire/forward/p2protocols';
chmod oct('0777'), '/var/ipfire/forward/p2protocols';
}