From 3af3ecd319bdcf8db27e9ca14af72383b4754567 Mon Sep 17 00:00:00 2001 From: Alexander Marx Date: Wed, 9 Oct 2013 10:31:35 +0200 Subject: [PATCH] Firewall: fix rules.pl when using custom hosts/networks and services no rule was applied because no protokoll could be found Also extended JS code to correctly show ICMP Types only, if NO Targetport is selcted --- config/forwardfw/rules.pl | 4 ++-- html/cgi-bin/forwardfw.cgi | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/config/forwardfw/rules.pl b/config/forwardfw/rules.pl index 3abe02bab..fcaade2d6 100755 --- a/config/forwardfw/rules.pl +++ b/config/forwardfw/rules.pl @@ -252,7 +252,7 @@ sub buildrules foreach my $DPROT (@DPROT){ $DPORT = &get_port($hash,$key,$DPROT); $PROT=$DPROT; - $PROT="-p $PROT" if ($PROT ne ''); + $PROT="-p $PROT" if ($PROT ne '' && $PROT ne ' '); foreach my $a (sort keys %sourcehash){ foreach my $b (sort keys %targethash){ if ($sourcehash{$a}[0] ne $targethash{$b}[0] && $targethash{$b}[0] ne 'none' || $sourcehash{$a}[0] eq '0.0.0.0/0.0.0.0'){ @@ -311,7 +311,7 @@ sub buildrules foreach my $DPROT (@DPROT){ $DPORT = &get_port($hash,$key,$DPROT); $PROT=$DPROT; - $PROT="-p $PROT" if ($PROT ne ''); + $PROT="-p $PROT" if ($PROT ne '' && $PROT ne ' '); foreach my $a (sort keys %sourcehash){ foreach my $b (sort keys %targethash){ if ($sourcehash{$a}[0] ne $targethash{$b}[0] && $targethash{$b}[0] ne 'none' || $sourcehash{$a}[0] eq '0.0.0.0/0.0.0.0'){ diff --git a/html/cgi-bin/forwardfw.cgi b/html/cgi-bin/forwardfw.cgi index 4c70a2503..f8f14add2 100755 --- a/html/cgi-bin/forwardfw.cgi +++ b/html/cgi-bin/forwardfw.cgi @@ -123,6 +123,14 @@ function toggle_elements( id ) { else{ document.getElementById(id).style.display='none'; } + if(document.getElementById('targetport').style.display== "none" && document.getElementById('PROT').value === 'ICMP' ) + { + document.getElementById('PROTOKOLL').style.display='block'; + } + if(document.getElementById('targetport').style.display== "block" && document.getElementById('PROT').value === 'ICMP' ) + { + document.getElementById('PROTOKOLL').style.display='none'; + } return true; } function hide_elements() @@ -1755,6 +1763,9 @@ END if ($fwdfwsettings{'USESRV'} ne 'ON'){ print""; } + if ($fwdfwsettings{'USESRV'} eq 'ON' && $fwdfwsettings{'PROT'} eq 'ICMP'){ + print""; + } &Header::closebox; #---Activate/logging/remark------------------------------------- &Header::openbox('100%', 'left', $Lang::tr{'fwdfw additional'}); -- 2.39.5