#print rules to console
foreach my $DPROT (@DPROT){
$DPORT = &get_port($hash,$key,$DPROT);
- print "uzlputz DPROT= $DPROT $DPORT\n";
$PROT=$DPROT;
$PROT="-p $PROT" if ($PROT ne '' && $PROT ne ' ');
foreach my $a (sort keys %sourcehash){
}else{
return "--dport ".&fwlib::get_srv_port($$hash{$key}[15],1,$prot);
}
+ }elsif($prot eq 'ICMP' && $$hash{$key}[11] eq 'ON'){ #When PROT is ICMP and "use targetport is checked, this is an icmp-service
+ return "--icmp-type ".&fwlib::get_srv_port($$hash{$key}[15],3,$prot);
}
}elsif($$hash{$key}[14] eq 'cust_srvgrp'){
if ($prot ne 'ICMP'){
}
}
}
- #check source and destination protocol if source manual and dest single service
+ #When using source- or targetport, the protocol has to be TCP or UDP
+ if (($fwdfwsettings{'USESRV'} eq 'ON' || $fwdfwsettings{'USE_SRC_PORT'} eq 'ON') && ($fwdfwsettings{'SRC_PORT'} ne '' || $fwdfwsettings{'TGT_PORT'} ne '') && ($fwdfwsettings{'PROT'} ne 'TCP' && $fwdfwsettings{'PROT'} ne 'UDP')){
+ $errormessage.=$Lang::tr{'fwdfw err prot_port1'};
+ return;
+ }
+ #when icmp selected, no targetport allowed
+ if (($fwdfwsettings{'PROT'} ne '' && $fwdfwsettings{'PROT'} ne 'TCP' && $fwdfwsettings{'PROT'} ne 'UDP') && ($fwdfwsettings{'USESRV'} eq 'ON' || $fwdfwsettings{'USE_SRC_PORT'} eq 'ON')){
+ $errormessage.=$Lang::tr{'fwdfw err prot_port'};
+ return;
+ }
+ #change protocol if prot not equal dest single service
if ($fwdfwsettings{'grp3'} eq 'cust_srv'){
foreach my $key (sort keys %customservice){
if($customservice{$key}[0] eq $fwdfwsettings{$fwdfwsettings{'grp3'}}){
if ($fwdfwsettings{'PROT'} eq 'ICMP'){
$fwdfwsettings{'USE_SRC_PORT'}='';
$fwdfwsettings{'SRC_PORT'}='';
- $fwdfwsettings{'USESRV'}='';
+ #$fwdfwsettings{'USESRV'}='';
$fwdfwsettings{'TGT_PORT'}='';
&General::readhasharray("${General::swroot}/fwhosts/icmp-types", \%icmptypes);
foreach my $key (keys %icmptypes){
}
}
if($tcp && $udp && $icmp){
- push (@protocols,"All");
+ push (@protocols,"TCP,UDP, <br>ICMP");
return @protocols;
}
if($tcp){
<tr><td><select name='PROT' id='PROT' onchange="getdropdown()">
END
if ($fwdfwsettings{'PROT'} eq ''){
- print"<option selected>$Lang::tr{'all'}</option>";
+ print"<option value='' selected>$Lang::tr{'all'}</option>";
}else{
print"<option value=''>$Lang::tr{'all'}</option>";
}
push (@protocols,$Lang::tr{'all'});
}
my $protz=join(",",@protocols);
- if($protz eq 'ICMP'){
+ if($protz eq 'ICMP' && $$hash{$key}[9] ne 'All ICMP-Types'){
&General::readhasharray("${General::swroot}/fwhosts/icmp-types", \%icmptypes);
foreach my $keyicmp (sort { ncmp($icmptypes{$a}[0],$icmptypes{$b}[0]) }keys %icmptypes){
if($$hash{$key}[9] eq "$icmptypes{$keyicmp}[0]"){
'fwdfw err notgt' => 'Kein Ziel ausgewählt',
'fwdfw err notgtip' => 'Bitte Ziel-IP-Adresse angeben',
'fwdfw err prot' => 'Quell- und Zielprotokoll müssen identisch sein',
+'fwdfw err prot_port' => 'Bei dem gewählten Protokoll sind Quell- und Zielport nicht erlaubt',
+'fwdfw err prot_port1' => 'Bei Nutzung von Quell- oder Zielport muss als Protokoll TCP oder UDP gewählt werden.',
'fwdfw err remark' => 'Die Bemerkung enthält ungültige Zeichen',
'fwdfw err ruleexists' => 'Eine identische Regel existiert bereits',
'fwdfw err same' => 'Quelle und Ziel sind identisch',
'fwdfw err notgt' => 'No destination selected.',
'fwdfw err notgtip' => 'Please provide a destination IP address.',
'fwdfw err prot' => 'Source and destination protocol need to match.',
+'fwdfw err prot_port' => 'Source- or targetport are not allowed with selected protocol',
+'fwdfw err prot_port1' => 'When using Source- or targetport you have to select TCP or UDP for protocol',
'fwdfw err remark' => 'Invalid characters in remark.',
'fwdfw err ruleexists' => 'This rule already exists.',
'fwdfw err same' => 'Source and destination are identical.',