Firewall: DNAT - Show right DNAT interface in ruletable

Now:
When using a hostgroup as source there are all corresponding DNAT
interfaces shown in ruletable depending on the entries in the group.

When in DNAT area "-automatic" is selected, the DNAT interfaces are
shown as IP-Addresses, else they are shown as "ORANGE","GREEN","BLUE"...

BUGFIX: When there is a MAC address used in a sourcegroup, the rules could not be set. Now MAC addresses get allways the public interface as DNAT
This commit is contained in:
Alexander Marx
2014-03-21 08:28:24 +01:00
committed by Michael Tremer
parent 4e54e3c6f5
commit fd169d0adc
2 changed files with 41 additions and 14 deletions

View File

@@ -989,6 +989,12 @@ sub deleterule
&base;
}
}
sub del_double
{
my %all=();
@all{@_}=1;
return (keys %all);
}
sub disable_rule
{
my $key1=shift;
@@ -2551,9 +2557,22 @@ END
<td align='center' $tdcolor>
END
#Is this a DNAT rule?
my $natstring;
if ($$hash{$key}[31] eq 'dnat' && $$hash{$key}[28] eq 'ON'){
if ($$hash{$key}[29] eq 'Default IP'){$$hash{$key}[29]=$Lang::tr{'red1'};}
print "Firewall ($$hash{$key}[29])";
if ($$hash{$key}[29] eq 'AUTO'){
my @src_addresses=&fwlib::get_addresses(\%$hash,$key,'src');
my @nat_ifaces;
foreach my $val (@src_addresses){
my ($ip,$sub)=split("/",$val);
push (@nat_ifaces,&fwlib::get_nat_address($$hash{$key}[29],$ip));
}
@nat_ifaces=&del_double(@nat_ifaces);
$natstring = join(', ', @nat_ifaces);
}else{
$natstring = $$hash{$key}[29];
}
print "$Lang::tr{'firewall'} ($natstring)";
if($$hash{$key}[30] ne ''){
$$hash{$key}[30]=~ tr/|/,/;
print": $$hash{$key}[30]";