function checkradio(a){
\$(a).attr('checked', true);
}
-function toggle_elements()
-{
- var elementNames = toggle_elements.arguments;
- for (var i=0; i<elementNames.length; i++)
+function toggle_elements( id ) {
+ if(document.getElementById(id).style.display== "none")
{
- var elementName = elementNames[i];
- if ( \$('input[name="USE_NAT"]').is(':checked') || \$('input[name="USE_SRC_PORT"]').is(':checked') || \$('input[name="USESRV"]').is(':checked'))
- {
- document.getElementById(elementName).style.display='block';
- }
- else{
- document.getElementById(elementName).style.display='none';
- }
+ document.getElementById(id).style.display='block';
}
+ else{
+ document.getElementById(id).style.display='none';
+ }
+ return true;
}
function hide_elements()
{
}
#increase counters
if (!$errormessage){
- &checkcounter($fwdfwsettings{'oldgrp1a'},$fwdfwsettings{'oldgrp1b'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}});
- &checkcounter($fwdfwsettings{'oldgrp2a'},$fwdfwsettings{'oldgrp2b'},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}});
+ &checkcounter($fwdfwsettings{'oldgrp1a'},$fwdfwsettings{'oldgrp1b'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}});
+ &checkcounter($fwdfwsettings{'oldgrp2a'},$fwdfwsettings{'oldgrp2b'},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}});
if($fwdfwsettings{'oldusesrv'} eq '' && $fwdfwsettings{'USESRV'} eq 'ON'){
&checkcounter(0,0,$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
}elsif ($fwdfwsettings{'USESRV'} eq '' && $fwdfwsettings{'oldusesrv'} eq 'ON') {
}
}
}
- #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]"){