]>
git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - html/cgi-bin/forwardfw.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
22 # Hi folks! I hope this code is useful for all. I needed something to handle #
23 # my VPN Connections in a comfortable way. As a prerequisite i needed #
24 # something that makes sure the vpn roadwarrior are able to have a fixed #
25 # ip-address. So i developed the ccd extension for the vpn server. #
27 # Now that the ccd extension is ready i am able to develop the main request. #
28 # Any feedback is appreciated. #
31 ###############################################################################
34 no warnings
'uninitialized';
35 # enable only the following on debugging purpose
37 #use CGI::Carp 'fatalsToBrowser';
39 require '/var/ipfire/general-functions.pl';
40 require "${General::swroot}/lang.pl";
41 require "${General::swroot}/header.pl";
42 require "${General::swroot}/forward/bin/firewall-lib.pl";
44 unless (-d
"${General::swroot}/forward") { system("mkdir ${General::swroot}/forward"); }
45 unless (-e
"${General::swroot}/forward/settings") { system("touch ${General::swroot}/forward/settings"); }
46 unless (-e
"${General::swroot}/forward/config") { system("touch ${General::swroot}/forward/config"); }
47 unless (-e
"${General::swroot}/forward/input") { system("touch ${General::swroot}/forward/input"); }
48 unless (-e
"${General::swroot}/forward/outgoing") { system("touch ${General::swroot}/forward/outgoing"); }
52 my %defaultNetworks=();
56 my %customnetworks=();
58 my %customservicegrp=();
64 my %configoutgoingfw=();
75 my $confignet = "${General::swroot}/fwhosts/customnetworks";
76 my $confighost = "${General::swroot}/fwhosts/customhosts";
77 my $configgrp = "${General::swroot}/fwhosts/customgroups";
78 my $configsrv = "${General::swroot}/fwhosts/customservices";
79 my $configsrvgrp = "${General::swroot}/fwhosts/customservicegrp";
80 my $configccdnet = "${General::swroot}/ovpn/ccd.conf";
81 my $configccdhost = "${General::swroot}/ovpn/ovpnconfig";
82 my $configipsec = "${General::swroot}/vpn/config";
83 my $configipsecrw = "${General::swroot}/vpn/settings";
84 my $configfwdfw = "${General::swroot}/forward/config";
85 my $configinput = "${General::swroot}/forward/input";
86 my $configoutgoing = "${General::swroot}/forward/outgoing";
87 my $configovpn = "${General::swroot}/ovpn/settings";
90 my $ipgrp="${General::swroot}/outgoing/groups";
93 &General
::readhash
("${General::swroot}/forward/settings", \
%fwdfwsettings);
94 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
95 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
97 &Header
::showhttpheaders
();
98 &Header
::getcgihash
(\
%fwdfwsettings);
99 &Header
::openpage
($Lang::tr
{'fwdfw menu'}, 1, '');
100 &Header
::openbigbox
('100%', 'center',$errormessage);
103 if ($fwdfwsettings{'ACTION'} eq $Lang::tr
{'save'})
105 my $MODE = $fwdfwsettings{'POLICY'};
106 my $MODE1 = $fwdfwsettings{'POLICY1'};
108 $fwdfwsettings{'POLICY'} = "$MODE";
109 $fwdfwsettings{'POLICY1'} = "$MODE1";
110 &General
::writehash
("${General::swroot}/forward/settings", \
%fwdfwsettings);
113 if ($fwdfwsettings{'ACTION'} eq 'saverule')
115 &General
::readhasharray
("$configfwdfw", \
%configfwdfw);
116 &General
::readhasharray
("$configinput", \
%configinputfw);
117 &General
::readhasharray
("$configoutgoing", \
%configoutgoingfw);
118 $errormessage=&checksource
;
119 if(!$errormessage){&checktarget
;}
120 if(!$errormessage){&checkrule
;}
121 #check if we try to break rules
122 if( $fwdfwsettings{$fwdfwsettings{'grp1'}} eq 'IPFire' && $fwdfwsettings{'grp2'} eq 'ipfire'){
123 $errormessage.=$Lang::tr
{'fwdfw err same'};
126 if($fwdfwsettings{'grp2'} eq 'ipfire'){
127 $fwdfwsettings{'config'}=$configinput;
128 $fwdfwsettings{'chain'} = 'INPUTFW';
129 my $maxkey=&General
::findhasharraykey
(\
%configinputfw);
130 #check if we have an identical rule already
131 if($fwdfwsettings{'oldrulenumber'} eq $fwdfwsettings{'rulepos'}){
132 foreach my $key (sort keys %configinputfw){
133 if ("$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'}"
134 eq "$configinputfw{$key}[0],$configinputfw{$key}[2],$configinputfw{$key}[3],$configinputfw{$key}[4],$configinputfw{$key}[5],$configinputfw{$key}[6],$configinputfw{$key}[7],$configinputfw{$key}[8],$configinputfw{$key}[9],$configinputfw{$key}[10],$configinputfw{$key}[11],$configinputfw{$key}[12],$configinputfw{$key}[13],$configinputfw{$key}[14],$configinputfw{$key}[15],$configinputfw{$key}[17],$configinputfw{$key}[18],$configinputfw{$key}[19],$configinputfw{$key}[20],$configinputfw{$key}[21],$configinputfw{$key}[22],$configinputfw{$key}[23],$configinputfw{$key}[24],$configinputfw{$key}[25],$configinputfw{$key}[26],$configinputfw{$key}[27]"){
135 $errormessage.=$Lang::tr
{'fwdfw err ruleexists'};
136 if ($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && &validremark
($fwdfwsettings{'ruleremark'})){
138 }elsif($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && !&validremark
($fwdfwsettings{'ruleremark'})){
139 $errormessage=$Lang::tr
{'fwdfw err remark'}."<br>";
141 if ($fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'}){
142 $fwdfwsettings{'nosave'} = 'on';
147 #check Rulepos on new Rule
148 if($fwdfwsettings{'rulepos'} > 0 && !$fwdfwsettings{'oldrulenumber'}){
149 $fwdfwsettings{'oldrulenumber'}=$maxkey;
150 foreach my $key (sort keys %configinputfw){
151 if ("$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'}"
152 eq "$configinputfw{$key}[0],$configinputfw{$key}[2],$configinputfw{$key}[3],$configinputfw{$key}[4],$configinputfw{$key}[5],$configinputfw{$key}[6],$configinputfw{$key}[7],$configinputfw{$key}[8],$configinputfw{$key}[9],$configinputfw{$key}[10],$configinputfw{$key}[11],$configinputfw{$key}[12],$configinputfw{$key}[13],$configinputfw{$key}[14],$configinputfw{$key}[15],$configinputfw{$key}[17],$configinputfw{$key}[18],$configinputfw{$key}[19],$configinputfw{$key}[20],$configinputfw{$key}[21],$configinputfw{$key}[22],$configinputfw{$key}[23],$configinputfw{$key}[24],$configinputfw{$key}[25],$configinputfw{$key}[26],$configinputfw{$key}[27]"){
153 $errormessage.=$Lang::tr
{'fwdfw err ruleexists'};
157 #check if we just close a rule
158 if( $fwdfwsettings{'oldgrp1a'} eq $fwdfwsettings{'grp1'} && $fwdfwsettings{'oldgrp1b'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'oldgrp2a'} eq $fwdfwsettings{'grp2'} && $fwdfwsettings{'oldgrp2b'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} && $fwdfwsettings{'oldgrp3a'} eq $fwdfwsettings{'grp3'} && $fwdfwsettings{'oldgrp3b'} eq $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} ) {
159 if($fwdfwsettings{'nosave'} eq 'on' && $fwdfwsettings{'updatefwrule'} eq 'on'){
161 $fwdfwsettings{'nosave2'} = 'on';
164 &checkcounter
($fwdfwsettings{'oldgrp1a'},$fwdfwsettings{'oldgrp1b'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}});
165 if ($fwdfwsettings{'nobase'} ne 'on'){
166 &checkcounter
($fwdfwsettings{'oldgrp2a'},$fwdfwsettings{'oldgrp2b'},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}});
168 if($fwdfwsettings{'oldusesrv'} eq '' && $fwdfwsettings{'USESRV'} eq 'ON'){
169 &checkcounter
(0,0,$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
170 }elsif ($fwdfwsettings{'USESRV'} eq '' && $fwdfwsettings{'oldusesrv'} eq 'ON') {
171 &checkcounter
($fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'},0,0);
172 }elsif ($fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldgrp3b'} ne $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'updatefwrule'} eq 'on'){
173 &checkcounter
($fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
175 if($fwdfwsettings{'nosave2'} ne 'on'){
176 &saverule
(\
%configinputfw,$configinput);
178 #print "Source: $fwdfwsettings{'grp1'} -> $fwdfwsettings{$fwdfwsettings{'grp1'}}<br>";
179 #print "Sourceport: $fwdfwsettings{'USE_SRC_PORT'}, $fwdfwsettings{'PROT'}, $fwdfwsettings{'ICMP_TYPES'}, $fwdfwsettings{'SRC_PORT'}<br>";
180 #print "Target: $fwdfwsettings{'grp2'} -> $fwdfwsettings{$fwdfwsettings{'grp2'}}<br>";
181 #print "Dienst: $fwdfwsettings{'USESRV'}, $fwdfwsettings{'grp3'} -> $fwdfwsettings{$fwdfwsettings{'grp3'}}<br>";
182 #print "BEMERKUNG: $fwdfwsettings{'ruleremark'}<br>";
183 #print " Regel AKTIV: $fwdfwsettings{'ACTIVE'}<br>";
184 #print " Regel LOG: $fwdfwsettings{'LOG'}<br>";
185 #print " ZEITRAHMEN: $fwdfwsettings{'TIME'}<br>";
186 #print " MO: $fwdfwsettings{'TIME_MON'}<br>";
187 #print " DI: $fwdfwsettings{'TIME_TUE'}<br>";
188 #print " MI: $fwdfwsettings{'TIME_WED'}<br>";
189 #print " DO: $fwdfwsettings{'TIME_THU'}<br>";
190 #print " FR: $fwdfwsettings{'TIME_FRI'}<br>";
191 #print " SA: $fwdfwsettings{'TIME_SAT'}<br>";
192 #print " SO: $fwdfwsettings{'TIME_SUN'}<br>";
193 #print " VON: $fwdfwsettings{'TIME_FROM'} bis $fwdfwsettings{'TIME_TO'}<br>";
195 #print"ALT: $fwdfwsettings{'oldgrp1a'} $fwdfwsettings{'oldgrp1b'} NEU: $fwdfwsettings{'grp1'} $fwdfwsettings{$fwdfwsettings{'grp1'}}<br>";
196 #print"ALT: $fwdfwsettings{'oldgrp2a'} $fwdfwsettings{'oldgrp2b'} NEU: $fwdfwsettings{'grp2'} $fwdfwsettings{$fwdfwsettings{'grp2'}}<br>";
197 #print"ALT: $fwdfwsettings{'oldgrp3a'} $fwdfwsettings{'oldgrp3b'} NEU: $fwdfwsettings{'grp3'} $fwdfwsettings{$fwdfwsettings{'grp3'}}<br>";
198 #print"DIENSTE Checkalt:$fwdfwsettings{'oldusesrv'} DIENSTE Checkneu:$fwdfwsettings{'USESRV'} DIENST ALT:$fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'} DIENST NEU:$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}}<br>";
199 }elsif($fwdfwsettings{$fwdfwsettings{'grp1'}} eq 'IPFire' ){
201 $fwdfwsettings{'config'}=$configoutgoing;
202 $fwdfwsettings{'chain'} = 'OUTGOINGFW';
203 my $maxkey=&General
::findhasharraykey
(\
%configoutgoingfw);
204 if($fwdfwsettings{'oldrulenumber'} eq $fwdfwsettings{'rulepos'}){
205 foreach my $key (sort keys %configoutgoingfw){
206 if ("$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'}"
207 eq "$configoutgoingfw{$key}[0],$configoutgoingfw{$key}[2],$configoutgoingfw{$key}[3],$configoutgoingfw{$key}[4],$configoutgoingfw{$key}[5],$configoutgoingfw{$key}[6],$configoutgoingfw{$key}[7],$configoutgoingfw{$key}[8],$configoutgoingfw{$key}[9],$configoutgoingfw{$key}[10],$configoutgoingfw{$key}[11],$configoutgoingfw{$key}[12],$configoutgoingfw{$key}[13],$configoutgoingfw{$key}[14],$configoutgoingfw{$key}[15],$configoutgoingfw{$key}[17],$configoutgoingfw{$key}[18],$configoutgoingfw{$key}[19],$configoutgoingfw{$key}[20],$configoutgoingfw{$key}[21],$configoutgoingfw{$key}[22],$configoutgoingfw{$key}[23],$configoutgoingfw{$key}[24],$configoutgoingfw{$key}[25],$configoutgoingfw{$key}[26],$configoutgoingfw{$key}[27]"){
208 $errormessage.=$Lang::tr
{'fwdfw err ruleexists'};
209 if ($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && &validremark
($fwdfwsettings{'ruleremark'})){
211 }elsif($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && !&validremark
($fwdfwsettings{'ruleremark'})){
212 $errormessage=$Lang::tr
{'fwdfw err remark'}."<br>";
214 if ($fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'}){
215 $fwdfwsettings{'nosave'} = 'on';
220 #check Rulepos on new Rule
221 if($fwdfwsettings{'rulepos'} > 0 && !$fwdfwsettings{'oldrulenumber'}){
222 print"CHECK OUTGOING DOPPELTE REGEL<br>";
223 $fwdfwsettings{'oldrulenumber'}=$maxkey;
224 foreach my $key (sort keys %configoutgoingfw){
225 if ("$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'}"
226 eq "$configoutgoingfw{$key}[0],$configoutgoingfw{$key}[2],$configoutgoingfw{$key}[3],$configoutgoingfw{$key}[4],$configoutgoingfw{$key}[5],$configoutgoingfw{$key}[6],$configoutgoingfw{$key}[7],$configoutgoingfw{$key}[8],$configoutgoingfw{$key}[9],$configoutgoingfw{$key}[10],$configoutgoingfw{$key}[11],$configoutgoingfw{$key}[12],$configoutgoingfw{$key}[13],$configoutgoingfw{$key}[14],$configoutgoingfw{$key}[15],$configoutgoingfw{$key}[17],$configoutgoingfw{$key}[18],$configoutgoingfw{$key}[19],$configoutgoingfw{$key}[20],$configoutgoingfw{$key}[21],$configoutgoingfw{$key}[22],$configoutgoingfw{$key}[23],$configoutgoingfw{$key}[24],$configoutgoingfw{$key}[25],$configoutgoingfw{$key}[26],$configoutgoingfw{$key}[27]"){
227 $errormessage.=$Lang::tr
{'fwdfw err ruleexists'};
231 #check if we just close a rule
232 if( $fwdfwsettings{'oldgrp1a'} eq $fwdfwsettings{'grp1'} && $fwdfwsettings{'oldgrp1b'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'oldgrp2a'} eq $fwdfwsettings{'grp2'} && $fwdfwsettings{'oldgrp2b'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} && $fwdfwsettings{'oldgrp3a'} eq $fwdfwsettings{'grp3'} && $fwdfwsettings{'oldgrp3b'} eq $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'} ) {
233 if($fwdfwsettings{'nosave'} eq 'on' && $fwdfwsettings{'updatefwrule'} eq 'on'){
234 $fwdfwsettings{'nosave2'} = 'on';
239 &checkcounter
($fwdfwsettings{'oldgrp1a'},$fwdfwsettings{'oldgrp1b'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}});
240 &checkcounter
($fwdfwsettings{'oldgrp2a'},$fwdfwsettings{'oldgrp2b'},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}});
241 if($fwdfwsettings{'oldusesrv'} eq '' && $fwdfwsettings{'USESRV'} eq 'ON'){
242 &checkcounter
(0,0,$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
243 }elsif ($fwdfwsettings{'USESRV'} eq '' && $fwdfwsettings{'oldusesrv'} eq 'ON') {
244 &checkcounter
($fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'},0,0);
245 }elsif ($fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldgrp3b'} ne $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'updatefwrule'} eq 'on'){
246 &checkcounter
($fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
248 if ($fwdfwsettings{'nobase'} eq 'on'){
249 &checkcounter
(0,0,$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
251 if ($fwdfwsettings{'nosave2'} ne 'on'){
252 &saverule
(\
%configoutgoingfw,$configoutgoing);
256 $fwdfwsettings{'config'}=$configfwdfw;
257 $fwdfwsettings{'chain'} = 'FORWARDFW';
258 my $maxkey=&General
::findhasharraykey
(\
%configfwdfw);
259 if($fwdfwsettings{'oldrulenumber'} eq $fwdfwsettings{'rulepos'}){
260 #check if we have an identical rule already
261 foreach my $key (sort keys %configfwdfw){
262 if ("$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'}"
263 eq "$configfwdfw{$key}[0],$configfwdfw{$key}[2],$configfwdfw{$key}[3],$configfwdfw{$key}[4],$configfwdfw{$key}[5],$configfwdfw{$key}[6],$configfwdfw{$key}[7],$configfwdfw{$key}[8],$configfwdfw{$key}[9],$configfwdfw{$key}[10],$configfwdfw{$key}[11],$configfwdfw{$key}[12],$configfwdfw{$key}[13],$configfwdfw{$key}[14],$configfwdfw{$key}[15],$configfwdfw{$key}[17],$configfwdfw{$key}[18],$configfwdfw{$key}[19],$configfwdfw{$key}[20],$configfwdfw{$key}[21],$configfwdfw{$key}[22],$configfwdfw{$key}[23],$configfwdfw{$key}[24],$configfwdfw{$key}[25],$configfwdfw{$key}[26],$configfwdfw{$key}[27]"){
264 $errormessage.=$Lang::tr
{'fwdfw err ruleexists'};
265 if ($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && &validremark
($fwdfwsettings{'ruleremark'})){
267 }elsif($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && !&validremark
($fwdfwsettings{'ruleremark'})){
268 $errormessage=$Lang::tr
{'fwdfw err remark'}."<br>";
270 if ($fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'}){
271 $fwdfwsettings{'nosave'} = 'on';
276 #check Rulepos on new Rule
277 if($fwdfwsettings{'rulepos'} > 0 && !$fwdfwsettings{'oldrulenumber'}){
278 $fwdfwsettings{'oldrulenumber'}=$maxkey;
279 foreach my $key (sort keys %configfwdfw){
280 if ("$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'}"
281 eq "$configfwdfw{$key}[0],$configfwdfw{$key}[2],$configfwdfw{$key}[3],$configfwdfw{$key}[4],$configfwdfw{$key}[5],$configfwdfw{$key}[6],$configfwdfw{$key}[7],$configfwdfw{$key}[8],$configfwdfw{$key}[9],$configfwdfw{$key}[10],$configfwdfw{$key}[11],$configfwdfw{$key}[12],$configfwdfw{$key}[13],$configfwdfw{$key}[14],$configfwdfw{$key}[15],$configfwdfw{$key}[17],$configfwdfw{$key}[18],$configfwdfw{$key}[19],$configfwdfw{$key}[20],$configfwdfw{$key}[21],$configfwdfw{$key}[22],$configfwdfw{$key}[23],$configfwdfw{$key}[24],$configfwdfw{$key}[25],$configfwdfw{$key}[26],$configfwdfw{$key}[27]"){
282 $errormessage.=$Lang::tr
{'fwdfw err ruleexists'};
286 #check if we just close a rule
287 if( $fwdfwsettings{'oldgrp1a'} eq $fwdfwsettings{'grp1'} && $fwdfwsettings{'oldgrp1b'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'oldgrp2a'} eq $fwdfwsettings{'grp2'} && $fwdfwsettings{'oldgrp2b'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} && $fwdfwsettings{'oldgrp3a'} eq $fwdfwsettings{'grp3'} && $fwdfwsettings{'oldgrp3b'} eq $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'} ) {
288 if($fwdfwsettings{'nosave'} eq 'on' && $fwdfwsettings{'updatefwrule'} eq 'on'){
289 $fwdfwsettings{'nosave2'} = 'on';
294 &checkcounter
($fwdfwsettings{'oldgrp1a'},$fwdfwsettings{'oldgrp1b'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}});
295 &checkcounter
($fwdfwsettings{'oldgrp2a'},$fwdfwsettings{'oldgrp2b'},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}});
296 if($fwdfwsettings{'oldusesrv'} eq '' && $fwdfwsettings{'USESRV'} eq 'ON'){
297 &checkcounter
(0,0,$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
298 }elsif ($fwdfwsettings{'USESRV'} eq '' && $fwdfwsettings{'oldusesrv'} eq 'ON') {
299 &checkcounter
($fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'},0,0);
300 }elsif ($fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldgrp3b'} ne $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'updatefwrule'} eq 'on'){
301 &checkcounter
($fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
303 if ($fwdfwsettings{'nobase'} eq 'on'){
304 &checkcounter
(0,0,$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
306 if ($fwdfwsettings{'nosave2'} ne 'on'){
307 &saverule
(\
%configfwdfw,$configfwdfw);
309 #print "Source: $fwdfwsettings{'grp1'} -> $fwdfwsettings{$fwdfwsettings{'grp1'}}<br>";
310 #print "Sourceport: $fwdfwsettings{'USE_SRC_PORT'}, $fwdfwsettings{'PROT'}, $fwdfwsettings{'ICMP_TYPES'}, $fwdfwsettings{'SRC_PORT'}<br>";
311 #print "Target: $fwdfwsettings{'grp2'} -> $fwdfwsettings{$fwdfwsettings{'grp2'}}<br>";
312 #print "Dienst: $fwdfwsettings{'USESRV'}, $fwdfwsettings{'grp3'} -> $fwdfwsettings{$fwdfwsettings{'grp3'}}<br>";
313 #print "BEMERKUNG: $fwdfwsettings{'ruleremark'}<br>";
314 #print " Regel AKTIV: $fwdfwsettings{'ACTIVE'}<br>";
315 #print " Regel LOG: $fwdfwsettings{'LOG'}<br>";
316 #print " ZEITRAHMEN: $fwdfwsettings{'TIME'}<br>";
317 #print " MO: $fwdfwsettings{'TIME_MON'}<br>";
318 #print " DI: $fwdfwsettings{'TIME_TUE'}<br>";
319 #print " MI: $fwdfwsettings{'TIME_WED'}<br>";
320 #print " DO: $fwdfwsettings{'TIME_THU'}<br>";
321 #print " FR: $fwdfwsettings{'TIME_FRI'}<br>";
322 #print " SA: $fwdfwsettings{'TIME_SAT'}<br>";
323 #print " SO: $fwdfwsettings{'TIME_SUN'}<br>";
324 #print " VON: $fwdfwsettings{'TIME_FROM'} bis $fwdfwsettings{'TIME_TO'}<br>";
326 #print"ALT: $fwdfwsettings{'oldgrp1a'} $fwdfwsettings{'oldgrp1b'} NEU: $fwdfwsettings{'grp1'} $fwdfwsettings{$fwdfwsettings{'grp1'}}<br>";
327 #print"ALT: $fwdfwsettings{'oldgrp2a'} $fwdfwsettings{'oldgrp2b'} NEU: $fwdfwsettings{'grp2'} $fwdfwsettings{$fwdfwsettings{'grp2'}}<br>";
328 #print"ALT: $fwdfwsettings{'oldgrp3a'} $fwdfwsettings{'oldgrp3b'} NEU: $fwdfwsettings{'grp3'} $fwdfwsettings{$fwdfwsettings{'grp3'}}<br>";
329 #print"DIENSTE Checkalt:$fwdfwsettings{'oldusesrv'} DIENSTE Checkneu:$fwdfwsettings{'USESRV'} DIENST ALT:$fwdfwsettings{'oldgrp3a'},$fwdfwsettings{'oldgrp3b'} DIENST NEU:$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}}<br>";
334 if($fwdfwsettings{'nosave2'} ne 'on'){
340 if ($fwdfwsettings{'ACTION'} eq $Lang::tr
{'reset'})
342 &General
::readhasharray
("$configfwdfw", \
%configfwdfw);
343 foreach my $key (sort keys %configfwdfw){
344 &checkcounter
($configfwdfw{$key}[3],$configfwdfw{$key}[4],,);
345 &checkcounter
($configfwdfw{$key}[5],$configfwdfw{$key}[6],,);
346 &checkcounter
($configfwdfw{$key}[14],$configfwdfw{$key}[15],,);
348 &General
::readhasharray
("$configinput", \
%configinputfw);
349 foreach my $key (sort keys %configinputfw){
350 &checkcounter
($configinputfw{$key}[3],$configinputfw{$key}[4],,);
351 &checkcounter
($configinputfw{$key}[5],$configinputfw{$key}[6],,);
352 &checkcounter
($configinputfw{$key}[14],$configinputfw{$key}[15],,);
355 system("rm ${General::swroot}/forward/config");
356 system("rm ${General::swroot}/forward/input");
357 &General
::writehash
("${General::swroot}/forward/settings", \
%fwdfwsettings);
358 unless (-e
"${General::swroot}/forward/config") { system("touch ${General::swroot}/forward/config"); }
359 unless (-e
"${General::swroot}/forward/input") { system("touch ${General::swroot}/forward/input"); }
360 my $MODE1=$fwdfwsettings{'POLICY1'};
362 $fwdfwsettings{'POLICY'}='MODE2';
363 $fwdfwsettings{'POLICY1'}=$MODE1;
364 &General
::writehash
("${General::swroot}/forward/settings", \
%fwdfwsettings);
368 if ($fwdfwsettings{'ACTION'} eq 'resetoutgoing')
370 &General
::readhasharray
("$configoutgoing", \
%configoutgoingfw);
371 foreach my $key (sort keys %configoutgoingfw){
372 &checkcounter
($configoutgoingfw{$key}[3],$configoutgoingfw{$key}[4],,);
373 &checkcounter
($configoutgoingfw{$key}[5],$configoutgoingfw{$key}[6],,);
374 &checkcounter
($configoutgoingfw{$key}[14],$configoutgoingfw{$key}[15],,);
376 system("rm ${General::swroot}/forward/outgoing");
377 &General
::writehash
("${General::swroot}/forward/settings", \
%fwdfwsettings);
378 unless (-e
"${General::swroot}/forward/outgoing") { system("touch ${General::swroot}/forward/outgoing"); }
379 my $MODE=$fwdfwsettings{'POLICY'};
381 $fwdfwsettings{'POLICY'}=$MODE;
382 $fwdfwsettings{'POLICY1'}='MODE2';
383 &General
::writehash
("${General::swroot}/forward/settings", \
%fwdfwsettings);
387 if ($fwdfwsettings{'ACTION'} eq $Lang::tr
{'fwdfw newrule'})
391 if ($fwdfwsettings{'ACTION'} eq $Lang::tr
{'fwdfw toggle'})
394 &General
::readhasharray
($fwdfwsettings{'config'}, \
%togglehash);
395 foreach my $key (sort keys %togglehash){
396 if ($key eq $fwdfwsettings{'key'}){
397 if ($togglehash{$key}[2] eq 'ON'){$togglehash{$key}[2]='';}else{$togglehash{$key}[2]='ON';}
400 &General
::writehasharray
($fwdfwsettings{'config'}, \
%togglehash);
404 if ($fwdfwsettings{'ACTION'} eq $Lang::tr
{'fwdfw togglelog'})
407 &General
::readhasharray
($fwdfwsettings{'config'}, \
%togglehash);
408 foreach my $key (sort keys %togglehash){
409 if ($key eq $fwdfwsettings{'key'}){
410 if ($togglehash{$key}[17] eq 'ON'){$togglehash{$key}[17]='';}else{$togglehash{$key}[17]='ON';}
413 &General
::writehasharray
($fwdfwsettings{'config'}, \
%togglehash);
417 if ($fwdfwsettings{'ACTION'} eq $Lang::tr
{'fwdfw reread'})
422 if ($fwdfwsettings{'ACTION'} eq 'editrule')
424 $fwdfwsettings{'updatefwrule'}='on';
427 if ($fwdfwsettings{'ACTION'} eq 'deleterule')
431 if ($fwdfwsettings{'ACTION'} eq 'moveup')
436 if ($fwdfwsettings{'ACTION'} eq 'movedown')
441 if ($fwdfwsettings{'ACTION'} eq 'copyrule')
443 $fwdfwsettings{'copyfwrule'}='on';
444 #$fwdfwsettings{'updatefwrule'}='on';
447 if ($fwdfwsettings{'ACTION'} eq '')
455 $fwdfwsettings{'updatefwrule'}='';
456 $fwdfwsettings{'config'}=$oldchain;
457 $fwdfwsettings{'nobase'}='on';
459 &checkcounter
(0,0,$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}});
460 &checkcounter
(0,0,$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}});
466 &General
::readhasharray
($fwdfwsettings{'config'}, \
%uphash);
467 foreach my $key (sort keys %uphash){
468 if ($key eq $fwdfwsettings{'key'}) {
470 if (exists $uphash{$last}){
472 foreach my $y (0 .. $#{$uphash{$last}}) {
473 $tmp{0}[$y] = $uphash{$last}[$y];
475 #copy active rule to last
476 foreach my $i (0 .. $#{$uphash{$last}}) {
477 $uphash{$last}[$i] = $uphash{$key}[$i];
479 #copy saved rule to actual position
480 foreach my $x (0 .. $#{$tmp{0}}) {
481 $uphash{$key}[$x] = $tmp{0}[$x];
486 &General
::writehasharray
($fwdfwsettings{'config'}, \
%uphash);
493 &General
::readhasharray
($fwdfwsettings{'config'}, \
%downhash);
494 foreach my $key (sort keys %downhash){
495 if ($key eq $fwdfwsettings{'key'}) {
497 if (exists $downhash{$next}){
499 foreach my $y (0 .. $#{$downhash{$next}}) {
500 $tmp{0}[$y] = $downhash{$next}[$y];
502 #copy active rule to next
503 foreach my $i (0 .. $#{$downhash{$next}}) {
504 $downhash{$next}[$i] = $downhash{$key}[$i];
506 #copy saved rule to actual position
507 foreach my $x (0 .. $#{$tmp{0}}) {
508 $downhash{$key}[$x] = $tmp{0}[$x];
513 &General
::writehasharray
($fwdfwsettings{'config'}, \
%downhash);
518 my ($base1,$val1,$base2,$val2) = @_;
520 if($base1 eq 'cust_net_src' || $base1 eq 'cust_net_tgt'){
521 &dec_counter
($confignet,\
%customnetwork,$val1);
522 }elsif($base1 eq 'cust_host_src' || $base1 eq 'cust_host_tgt'){
523 &dec_counter
($confighost,\
%customhost,$val1);
524 }elsif($base1 eq 'cust_grp_src' || $base1 eq 'cust_grp_tgt'){
525 &dec_counter
($configgrp,\
%customgrp,$val1);
526 }elsif($base1 eq 'cust_srv'){
527 &dec_counter
($configsrv,\
%customservice,$val1);
528 }elsif($base1 eq 'cust_srvgrp'){
529 &dec_counter
($configsrvgrp,\
%customservicegrp,$val1);
532 if($base2 eq 'cust_net_src' || $base2 eq 'cust_net_tgt'){
533 &inc_counter
($confignet,\
%customnetwork,$val2);
534 }elsif($base2 eq 'cust_host_src' || $base2 eq 'cust_host_tgt'){
535 &inc_counter
($confighost,\
%customhost,$val2);
536 }elsif($base2 eq 'cust_grp_src' || $base2 eq 'cust_grp_tgt'){
537 &inc_counter
($configgrp,\
%customgrp,$val2);
538 }elsif($base2 eq 'cust_srv'){
539 &inc_counter
($configsrv,\
%customservice,$val2);
540 }elsif($base2 eq 'cust_srvgrp'){
541 &inc_counter
($configsrvgrp,\
%customservicegrp,$val2);
551 &General
::readhasharray
($config, \
%hash);
552 foreach my $key (sort { uc($hash{$a}[0]) cmp uc($hash{$b}[0]) } keys %hash){
553 if($hash{$key}[0] eq $val){
554 $pos=$#{$hash{$key}};
555 $hash{$key}[$pos] = $hash{$key}[$pos]+1;
558 &General
::writehasharray
($config, \
%hash);
566 #$errormessage.="ALT:config: $config , verringert wird $val <br>";
567 &General
::readhasharray
($config, \
%hash);
568 foreach my $key (sort { uc($hash{$a}[0]) cmp uc($hash{$b}[0]) } keys %hash){
569 if($hash{$key}[0] eq $val){
570 $pos=$#{$hash{$key}};
571 $hash{$key}[$pos] = $hash{$key}[$pos]-1;
574 &General
::writehasharray
($config, \
%hash);
578 if ($fwdfwsettings{'POLICY'} eq 'MODE1'){ $selected{'POLICY'}{'MODE1'} = 'selected'; } else { $selected{'POLICY'}{'MODE1'} = ''; }
579 if ($fwdfwsettings{'POLICY'} eq 'MODE2'){ $selected{'POLICY'}{'MODE2'} = 'selected'; } else { $selected{'POLICY'}{'MODE2'} = ''; }
580 if ($fwdfwsettings{'POLICY1'} eq 'MODE1'){ $selected{'POLICY1'}{'MODE1'} = 'selected'; } else { $selected{'POLICY1'}{'MODE1'} = ''; }
581 if ($fwdfwsettings{'POLICY1'} eq 'MODE2'){ $selected{'POLICY1'}{'MODE2'} = 'selected'; } else { $selected{'POLICY1'}{'MODE2'} = ''; }
584 print "<br><hr><br><br>";
585 &Header
::openbox
('100%', 'center', $Lang::tr
{'fwdfw pol title'});
587 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
588 <table width='100%' border='0'>
589 <tr><td colspan='3' style='font-weight:bold;color:red;'>FORWARD </td></tr>
590 <tr><td colspan='3'>$Lang::tr{'fwdfw pol text'}</td></tr>
591 <tr><td colspan='3'><hr /></td></tr>
592 <tr><td width='15%' align='left'> <select name='POLICY' style="width: 100px">
593 <option value='MODE1' $selected{'POLICY'}{'MODE1'}>$Lang::tr{'fwdfw pol block'}</option>
594 <option value='MODE2' $selected{'POLICY'}{'MODE2'}>$Lang::tr{'fwdfw pol allow'}</option></select>
595 <td width='45%' align='left'><input type='submit' name='ACTION' value=$Lang::tr{'save'} />
596 <td width='45%' align='left'>
598 print "$Lang::tr{'outgoing firewall reset'}: <input type='submit' name='ACTION' value='$Lang::tr{'reset'}' />";
599 print "</table></form>";
602 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
603 <table width='100%' border='0'>
604 <tr><td colspan='3' style='font-weight:bold;color:red;'>OUTGOING </td></tr>
605 <tr><td colspan='3'>$Lang::tr{'fwdfw pol text1'}</td></tr>
606 <tr><td colspan='3'><hr /></td></tr>
607 <tr><td width='15%' align='left'> <select name='POLICY1' style="width: 100px">
608 <option value='MODE1' $selected{'POLICY1'}{'MODE1'}>$Lang::tr{'fwdfw pol block'}</option>
609 <option value='MODE2' $selected{'POLICY1'}{'MODE2'}>$Lang::tr{'fwdfw pol allow'}</option></select>
610 <td width='45%' align='left'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></form>
611 <td width='45%' align='left'>
613 print "$Lang::tr{'outgoing firewall reset'}: <form method='post' action='$ENV{'SCRIPT_NAME'}' style='display:inline'><input type='submit' value='$Lang::tr{'reset'}' /><input type='hidden' name='ACTION' value='resetoutgoing' />";
614 print "</table></form>";
620 if (-f
"${General::swroot}/forward/reread"){
621 print "<table border='0'><form method='post'><td><input type='submit' name='ACTION' value='$Lang::tr{'fwdfw reread'}' style='font-face: Comic Sans MS; color: red; font-weight: bold;'>$Lang::tr{'fwhost reread'}</td></tr></table></form><hr><br>";
623 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwdfw addrule'});
624 print "<form method='post'>";
625 print "<table border='0'>";
626 print "<tr><td><input type='submit' name='ACTION' value='$Lang::tr{'fwdfw newrule'}'></td>";
627 print"</tr></table></form><hr>";
634 &General
::readhasharray
($fwdfwsettings{'config'}, \
%delhash);
635 foreach my $key (sort {$a <=> $b} keys %delhash){
636 if ($key == $fwdfwsettings{'key'}){
637 #check hosts/net and groups
638 &checkcounter
($delhash{$key}[3],$delhash{$key}[4],,);
639 &checkcounter
($delhash{$key}[5],$delhash{$key}[6],,);
640 #check services and groups
641 if ($delhash{$key}[11] eq 'ON'){
642 &checkcounter
($delhash{$key}[14],$delhash{$key}[15],,);
645 if ($key >= $fwdfwsettings{'key'}) {
647 if (exists $delhash{$next}) {
648 foreach my $i (0 .. $#{$delhash{$next}}) {
649 $delhash{$key}[$i] = $delhash{$next}[$i];
654 # Remove the very last entry.
655 my $last_key = (sort {$a <=> $b} keys %delhash)[-1];
656 delete $delhash{$last_key};
658 &General
::writehasharray
($fwdfwsettings{'config'}, \
%delhash);
661 if($fwdfwsettings{'nobase'} ne 'on'){
668 &General
::readhasharray
("$configfwdfw", \
%configfwdfw);
669 foreach my $key (sort keys %configfwdfw){
671 if ($configfwdfw{$key}[2] eq 'ON'){$configfwdfw{$key}[2]='';}
674 &General
::writehasharray
("$configfwdfw", \
%configfwdfw);
681 #check ip-address if manual
682 if ($fwdfwsettings{'src_addr'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'src_addr'} ne ''){
683 #check if ip with subnet
684 if ($fwdfwsettings{'src_addr'} =~ /^(.*?)\/(.*?
)$/) {
685 ($ip,$subnet)=split (/\//,$fwdfwsettings{'src_addr'});
686 $subnet = &General
::iporsubtocidr
($subnet);
687 $fwdfwsettings{'isip'}='on';
690 if($fwdfwsettings{'src_addr'}=~/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/){
691 $ip=$fwdfwsettings{'src_addr'};
693 $fwdfwsettings{'isip'}='on';
696 if ($fwdfwsettings{'isip'} ne 'on'){
697 if (&General
::validmac
($fwdfwsettings{'src_addr'})){$fwdfwsettings{'ismac'}='on';}
699 if ($fwdfwsettings{'isip'} eq 'on'){
700 #check and form valid IP
701 $ip=&General
::ip2dec
($ip);
702 $ip=&General
::dec2ip
($ip);
703 #check if net or broadcast
704 my @tmp= split (/\./,$ip);
705 if (($tmp[3] eq "0") || ($tmp[3] eq "255"))
707 $errormessage=$Lang::tr
{'fwhost err hostip'}."<br>";
709 $fwdfwsettings{'src_addr'}="$ip/$subnet";
711 if(!&General
::validipandmask
($fwdfwsettings{'src_addr'})){
712 $errormessage.=$Lang::tr
{'fwdfw err src_addr'}."<br>";
715 if ($fwdfwsettings{'isip'} ne 'on' && $fwdfwsettings{'ismac'} ne 'on'){
716 $errormessage.=$Lang::tr
{'fwdfw err src_addr'}."<br>";
718 }elsif($fwdfwsettings{'src_addr'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'src_addr'} eq ''){
719 $errormessage.=$Lang::tr
{'fwdfw err nosrcip'};
720 return $errormessage;
724 if ($fwdfwsettings{$fwdfwsettings{'grp1'}} eq ''){ $errormessage.=$Lang::tr
{'fwdfw err nosrc'}."<br>";}
726 if ($fwdfwsettings{'USE_SRC_PORT'} eq 'ON' && $fwdfwsettings{'PROT'} eq 'ICMP'){
727 $fwdfwsettings{'SRC_PORT'}='';
728 &General
::readhasharray
("${General::swroot}/fwhosts/icmp-types", \
%icmptypes);
729 foreach my $key (keys %icmptypes){
730 if($fwdfwsettings{'ICMP_TYPES'} eq "$icmptypes{$key}[0] ($icmptypes{$key}[1])"){
731 $fwdfwsettings{'ICMP_TYPES'}="$icmptypes{$key}[0]";
734 }elsif($fwdfwsettings{'USE_SRC_PORT'} eq 'ON' && $fwdfwsettings{'PROT'} eq 'GRE'){
735 $fwdfwsettings{'SRC_PORT'}='';
736 $fwdfwsettings{'ICMP_TYPES'}='';
737 }elsif($fwdfwsettings{'USE_SRC_PORT'} eq 'ON' && $fwdfwsettings{'PROT'} eq 'ESP'){
738 $fwdfwsettings{'SRC_PORT'}='';
739 $fwdfwsettings{'ICMP_TYPES'}='';
740 }elsif($fwdfwsettings{'USE_SRC_PORT'} eq 'ON' && $fwdfwsettings{'PROT'} eq 'AH'){
741 $fwdfwsettings{'SRC_PORT'}='';
742 $fwdfwsettings{'ICMP_TYPES'}='';
743 }elsif($fwdfwsettings{'USE_SRC_PORT'} eq 'ON' && $fwdfwsettings{'PROT'} ne 'ICMP'){
744 $fwdfwsettings{'ICMP_TYPES'}='';
746 $fwdfwsettings{'ICMP_TYPES'}='';
747 $fwdfwsettings{'SRC_PORT'}='';
748 $fwdfwsettings{'PROT'}='';
751 if($fwdfwsettings{'USE_SRC_PORT'} eq 'ON' && ($fwdfwsettings{'PROT'} eq 'TCP' || $fwdfwsettings{'PROT'} eq 'UDP') && $fwdfwsettings{'SRC_PORT'} ne ''){
752 my @parts=split(",",$fwdfwsettings{'SRC_PORT'});
756 if ($_ =~ /^(\d+)\:(\d+)$/) {
758 #change dashes with :
761 push(@values,"1:65535");
764 if ($_ =~ /^(\D)\:(\d+)$/) {
765 push(@values,"1:$2");
768 if ($_ =~ /^(\d+)\:(\D)$/) {
769 push(@values,"$1:65535");
772 $errormessage .= &General
::validportrange
($_, 'destination');
777 if (&General
::validport
($_)){
784 $fwdfwsettings{'SRC_PORT'}=join("|",@values);
785 return $errormessage;
792 if ($fwdfwsettings{'tgt_addr'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} && $fwdfwsettings{'tgt_addr'} ne ''){
793 #check if ip with subnet
794 if ($fwdfwsettings{'tgt_addr'} =~ /^(.*?)\/(.*?
)$/) {
795 ($ip,$subnet)=split (/\//,$fwdfwsettings{'tgt_addr'});
796 $subnet = &General
::iporsubtocidr
($subnet);
799 if($fwdfwsettings{'tgt_addr'}=~/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/){
800 $ip=$fwdfwsettings{'tgt_addr'};
803 #check and form valid IP
804 $ip=&General
::ip2dec
($ip);
805 $ip=&General
::dec2ip
($ip);
807 ##check if net or broadcast
808 #my @tmp= split (/\./,$ip);
809 #if ($tmp[3] eq "0" || ($tmp[3] eq "255"))
811 #$errormessage=$Lang::tr{'fwhost err hostip'}."<br>";
813 $fwdfwsettings{'tgt_addr'}="$ip/$subnet";
815 if(!&General
::validipandmask
($fwdfwsettings{'tgt_addr'})){
816 $errormessage.=$Lang::tr
{'fwdfw err tgt_addr'}."<br>";
819 }elsif($fwdfwsettings{'tgt_addr'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} && $fwdfwsettings{'tgt_addr'} eq ''){
820 $errormessage.=$Lang::tr
{'fwdfw err notgtip'};
821 return $errormessage;
825 if ($fwdfwsettings{$fwdfwsettings{'grp2'}} eq ''){ $errormessage.=$Lang::tr
{'fwdfw err notgt'}."<br>";}
828 if ($fwdfwsettings{'USESRV'} eq 'ON'){
829 if ($fwdfwsettings{'grp3'} eq 'cust_srv'){
830 $fwdfwsettings{'TGT_PROT'}='';
831 $fwdfwsettings{'ICMP_TGT'}='';
833 if ($fwdfwsettings{'grp3'} eq 'cust_srvgrp'){
834 $fwdfwsettings{'TGT_PROT'}='';
835 $fwdfwsettings{'ICMP_TGT'}='';
836 #check target service
837 if($fwdfwsettings{$fwdfwsettings{'grp3'}} eq ''){
838 $errormessage.=$Lang::tr
{'fwdfw err tgt_grp'};
841 if ($fwdfwsettings{'grp3'} eq 'TGT_PORT'){
842 if ($fwdfwsettings{'TGT_PROT'} eq 'TCP' || $fwdfwsettings{'TGT_PROT'} eq 'UDP'){
843 if ($fwdfwsettings{'TGT_PORT'} ne ''){
844 my @parts=split(",",$fwdfwsettings{'TGT_PORT'});
848 if ($_ =~ /^(\d+)\:(\d+)$/) {
850 #change dashes with :
853 push(@values,"1:65535");
856 if ($_ =~ /^(\D)\:(\d+)$/) {
857 push(@values,"1:$2");
860 if ($_ =~ /^(\d+)\:(\D)$/) {
861 push(@values,"$1:65535");
864 $errormessage .= &General
::validportrange
($_, 'destination');
869 if (&General
::validport
($_)){
876 $fwdfwsettings{'TGT_PORT'}=join("|",@values);
878 }elsif ($fwdfwsettings{'TGT_PROT'} eq 'GRE'){
879 $fwdfwsettings{$fwdfwsettings{'grp3'}} = '';
880 $fwdfwsettings{'TGT_PORT'} = '';
881 $fwdfwsettings{'ICMP_TGT'} = '';
882 }elsif($fwdfwsettings{'TGT_PROT'} eq 'ESP'){
883 $fwdfwsettings{$fwdfwsettings{'grp3'}} = '';
884 $fwdfwsettings{'TGT_PORT'} = '';
885 $fwdfwsettings{'ICMP_TGT'}='';
886 }elsif($fwdfwsettings{'TGT_PROT'} eq 'AH'){
887 $fwdfwsettings{$fwdfwsettings{'grp3'}} = '';
888 $fwdfwsettings{'TGT_PORT'} = '';
889 $fwdfwsettings{'ICMP_TGT'}='';
890 }elsif ($fwdfwsettings{'TGT_PROT'} eq 'ICMP'){
891 $fwdfwsettings{$fwdfwsettings{'grp3'}} = '';
892 $fwdfwsettings{'TGT_PORT'} = '';
893 &General
::readhasharray
("${General::swroot}/fwhosts/icmp-types", \
%icmptypes);
894 foreach my $key (keys %icmptypes){
896 if ("$icmptypes{$key}[0] ($icmptypes{$key}[1])" eq $fwdfwsettings{'ICMP_TGT'}){
897 $fwdfwsettings{'ICMP_TGT'}=$icmptypes{$key}[0];
905 if ($fwdfwsettings{'USESRV'} ne 'ON'){
906 $fwdfwsettings{'grp3'}='';
907 $fwdfwsettings{$fwdfwsettings{'grp3'}}='';
908 $fwdfwsettings{'TGT_PROT'}='';
909 $fwdfwsettings{'ICMP_TGT'}='';
912 if($fwdfwsettings{'TIME'} eq 'ON'){
913 if($fwdfwsettings{'TIME_MON'} eq '' && $fwdfwsettings{'TIME_TUE'} eq '' && $fwdfwsettings{'TIME_WED'} eq '' && $fwdfwsettings{'TIME_THU'} eq '' && $fwdfwsettings{'TIME_FRI'} eq '' && $fwdfwsettings{'TIME_SAT'} eq '' && $fwdfwsettings{'TIME_SUN'} eq ''){
914 $errormessage=$Lang::tr
{'fwdfw err time'};
917 return $errormessage;
922 if ($fwdfwsettings{'ruleremark'} ne '' && !&validremark
($fwdfwsettings{'ruleremark'})){
923 $errormessage.=$Lang::tr
{'fwdfw err remark'}."<br>";
925 #check if source and target identical
926 if ($fwdfwsettings{$fwdfwsettings{'grp1'}} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} && $fwdfwsettings{$fwdfwsettings{'grp1'}} ne 'ALL'){
927 $errormessage.=$Lang::tr
{'fwdfw err same'};
928 return $errormessage;
931 #get source and targetip address if possible
932 my ($sip,$scidr,$tip,$tcidr);
933 ($sip,$scidr)=&get_ip
("src","grp1");
934 ($tip,$tcidr)=&get_ip
("tgt","grp2");
936 #check same iprange in source and target
937 if ($sip ne '' && $scidr ne '' && $tip ne '' && $tcidr ne ''){
938 my $networkip1=&General
::getnetworkip
($sip,$scidr);
939 my $networkip2=&General
::getnetworkip
($tip,$tcidr);
940 if ($scidr gt $tcidr){
941 if ( &General
::IpInSubnet
($networkip1,$tip,&General
::iporsubtodec
($tcidr))){
942 $errormessage.=$Lang::tr
{'fwdfw err samesub'};
944 }elsif($scidr eq $tcidr && $scidr eq '32'){
945 my ($sbyte1,$sbyte2,$sbyte3,$sbyte4)=split(/\./,$networkip1);
946 my ($tbyte1,$tbyte2,$tbyte3,$tbyte4)=split(/\./,$networkip2);
947 if ($sbyte1 eq $tbyte1 && $sbyte2 eq $tbyte2 && $sbyte3 eq $tbyte3){
948 $hint=$Lang::tr
{'fwdfw hint ip1'}."<br>";
949 $hint.=$Lang::tr
{'fwdfw hint ip2'}." Source: $networkip1/$scidr Target: $networkip2/$tcidr<br>";
952 if ( &General
::IpInSubnet
($networkip2,$sip,&General
::iporsubtodec
($scidr)) ){
953 $errormessage.=$Lang::tr
{'fwdfw err samesub'};
958 #check source and destination protocol if manual
959 if( $fwdfwsettings{'USE_SRC_PORT'} eq 'ON' && $fwdfwsettings{'USESRV'} eq 'ON'){
960 if($fwdfwsettings{'PROT'} ne $fwdfwsettings{'TGT_PROT'} && $fwdfwsettings{'grp3'} eq 'TGT_PORT'){
961 $errormessage.=$Lang::tr
{'fwdfw err prot'};
963 #check source and destination protocol if source manual and dest servicegrp
964 if ($fwdfwsettings{'grp3'} eq 'cust_srv'){
965 &General
::readhasharray
("$configsrv", \
%customservice);
966 foreach my $key (sort keys %customservice){
967 if($customservice{$key}[0] eq $fwdfwsettings{$fwdfwsettings{'grp3'}}){
968 if ($customservice{$key}[2] ne $fwdfwsettings{'PROT'}){
969 $errormessage.=$Lang::tr
{'fwdfw err prot'};
983 &General
::readhash
("/var/ipfire/ethernet/settings", \
%netsettings);
984 if ($fwdfwsettings{$grp} ne $Lang::tr
{'fwhost any'}){
985 if ($fwdfwsettings{$grp} eq $val.'_addr'){
986 ($a,$b) = split (/\//, $fwdfwsettings{$fwdfwsettings{$grp}});
987 }elsif($fwdfwsettings{$grp} eq 'std_net_'.$val){
988 if ($fwdfwsettings{$fwdfwsettings{$grp}} =~ /Gr/i){
989 $a=$netsettings{'GREEN_NETADDRESS'};
990 $b=&General
::iporsubtocidr
($netsettings{'GREEN_NETMASK'});
991 }elsif($fwdfwsettings{$fwdfwsettings{$grp}} =~ /Ora/i){
992 $a=$netsettings{'ORANGE_NETADDRESS'};
993 $b=&General
::iporsubtocidr
($netsettings{'ORANGE_NETMASK'});
994 }elsif($fwdfwsettings{$fwdfwsettings{$grp}} =~ /Bl/i){
995 $a=$netsettings{'BLUE_NETADDRESS'};
996 $b=&General
::iporsubtocidr
($netsettings{'BLUE_NETMASK'});
997 }elsif($fwdfwsettings{$fwdfwsettings{$grp}} =~ /OpenVPN/i){
998 &General
::readhash
("$configovpn",\
%ovpnsettings);
999 ($a,$b) = split (/\//, $ovpnsettings{'DOVPN_SUBNET'});
1000 $b=&General
::iporsubtocidr
($b);
1002 }elsif($fwdfwsettings{$grp} eq 'cust_net_'.$val){
1003 &General
::readhasharray
("$confignet", \
%customnetwork);
1004 foreach my $key (keys %customnetwork){
1005 if($customnetwork{$key}[0] eq $fwdfwsettings{$fwdfwsettings{$grp}}){
1006 $a=$customnetwork{$key}[1];
1007 $b=&General
::iporsubtocidr
($customnetwork{$key}[2]);
1010 }elsif($fwdfwsettings{$grp} eq 'cust_host_'.$val){
1011 &General
::readhasharray
("$confighost", \
%customhost);
1012 foreach my $key (keys %customhost){
1013 if($customhost{$key}[0] eq $fwdfwsettings{$fwdfwsettings{$grp}}){
1014 if ($customhost{$key}[1] eq 'ip'){
1015 ($a,$b)=split (/\//,$customhost{$key}[2]);
1016 $b=&General
::iporsubtocidr
($b);
1018 if ($grp eq 'grp2'){
1019 $errormessage=$Lang::tr
{'fwdfw err tgt_mac'};
1031 &General
::setup_default_networks
(\
%defaultNetworks);
1032 #read all configfiles
1033 &General
::readhasharray
("$configccdnet", \
%ccdnet);
1034 &General
::readhasharray
("$confignet", \
%customnetwork);
1035 &General
::readhasharray
("$configccdhost", \
%ccdhost);
1036 &General
::readhasharray
("$confighost", \
%customhost);
1037 &General
::readhasharray
("$configccdhost", \
%ccdhost);
1038 &General
::readhasharray
("$configgrp", \
%customgrp);
1039 &General
::readhasharray
("$configipsec", \
%ipsecconf);
1040 &General
::get_aliases
(\
%aliases);
1044 if($fwdfwsettings{'config'} eq ''){$fwdfwsettings{'config'}=$configfwdfw;}
1045 my $config=$fwdfwsettings{'config'};
1047 $checked{'grp1'}{$fwdfwsettings{'grp1'}} = 'CHECKED';
1048 $checked{'grp2'}{$fwdfwsettings{'grp2'}} = 'CHECKED';
1049 $checked{'grp3'}{$fwdfwsettings{'grp3'}} = 'CHECKED';
1050 $checked{'USE_SRC_PORT'}{$fwdfwsettings{'USE_SRC_PORT'}} = 'CHECKED';
1051 $checked{'USESRV'}{$fwdfwsettings{'USESRV'}} = 'CHECKED';
1052 $checked{'ACTIVE'}{$fwdfwsettings{'ACTIVE'}} = 'CHECKED';
1053 $checked{'LOG'}{$fwdfwsettings{'LOG'}} = 'CHECKED';
1054 $checked{'TIME'}{$fwdfwsettings{'TIME'}} = 'CHECKED';
1055 $checked{'TIME_MON'}{$fwdfwsettings{'TIME_MON'}} = 'CHECKED';
1056 $checked{'TIME_TUE'}{$fwdfwsettings{'TIME_TUE'}} = 'CHECKED';
1057 $checked{'TIME_WED'}{$fwdfwsettings{'TIME_WED'}} = 'CHECKED';
1058 $checked{'TIME_THU'}{$fwdfwsettings{'TIME_THU'}} = 'CHECKED';
1059 $checked{'TIME_FRI'}{$fwdfwsettings{'TIME_FRI'}} = 'CHECKED';
1060 $checked{'TIME_SAT'}{$fwdfwsettings{'TIME_SAT'}} = 'CHECKED';
1061 $checked{'TIME_SUN'}{$fwdfwsettings{'TIME_SUN'}} = 'CHECKED';
1062 $selected{'TIME_FROM'}{$fwdfwsettings{'TIME_FROM'}} = 'selected';
1063 $selected{'TIME_TO'}{$fwdfwsettings{'TIME_TO'}} = 'selected';
1064 $selected{'ipfire'}{$fwdfwsettings{$fwdfwsettings{'grp2'}}} ='selected';
1065 #check if update and get values
1066 if($fwdfwsettings{'updatefwrule'} eq 'on' || $fwdfwsettings{'copyfwrule'} eq 'on' && !$errormessage){
1067 &General
::readhasharray
("$config", \
%hash);
1068 foreach my $key (sort keys %hash){
1070 if ($key eq $fwdfwsettings{'key'}){
1071 $fwdfwsettings{'oldrulenumber'} = $fwdfwsettings{'key'};
1072 $fwdfwsettings{'RULE_ACTION'} = $hash{$key}[0];
1073 $fwdfwsettings{'ACTIVE'} = $hash{$key}[2];
1074 $fwdfwsettings{'grp1'} = $hash{$key}[3];
1075 $fwdfwsettings{$fwdfwsettings{'grp1'}} = $hash{$key}[4];
1076 $fwdfwsettings{'grp2'} = $hash{$key}[5];
1077 $fwdfwsettings{$fwdfwsettings{'grp2'}} = $hash{$key}[6];
1078 $fwdfwsettings{'USE_SRC_PORT'} = $hash{$key}[7];
1079 $fwdfwsettings{'PROT'} = $hash{$key}[8];
1080 $fwdfwsettings{'ICMP_TYPES'} = $hash{$key}[9];
1081 $fwdfwsettings{'SRC_PORT'} = $hash{$key}[10];
1082 $fwdfwsettings{'USESRV'} = $hash{$key}[11];
1083 $fwdfwsettings{'TGT_PROT'} = $hash{$key}[12];
1084 $fwdfwsettings{'ICMP_TGT'} = $hash{$key}[13];
1085 $fwdfwsettings{'grp3'} = $hash{$key}[14];
1086 $fwdfwsettings{$fwdfwsettings{'grp3'}} = $hash{$key}[15];
1087 $fwdfwsettings{'ruleremark'} = $hash{$key}[16];
1088 $fwdfwsettings{'LOG'} = $hash{$key}[17];
1089 $fwdfwsettings{'TIME'} = $hash{$key}[18];
1090 $fwdfwsettings{'TIME_MON'} = $hash{$key}[19];
1091 $fwdfwsettings{'TIME_TUE'} = $hash{$key}[20];
1092 $fwdfwsettings{'TIME_WED'} = $hash{$key}[21];
1093 $fwdfwsettings{'TIME_THU'} = $hash{$key}[22];
1094 $fwdfwsettings{'TIME_FRI'} = $hash{$key}[23];
1095 $fwdfwsettings{'TIME_SAT'} = $hash{$key}[24];
1096 $fwdfwsettings{'TIME_SUN'} = $hash{$key}[25];
1097 $fwdfwsettings{'TIME_FROM'} = $hash{$key}[26];
1098 $fwdfwsettings{'TIME_TO'} = $hash{$key}[27];
1099 $checked{'grp1'}{$fwdfwsettings{'grp1'}} = 'CHECKED';
1100 $checked{'grp2'}{$fwdfwsettings{'grp2'}} = 'CHECKED';
1101 $checked{'grp3'}{$fwdfwsettings{'grp3'}} = 'CHECKED';
1102 $checked{'USE_SRC_PORT'}{$fwdfwsettings{'USE_SRC_PORT'}} = 'CHECKED';
1103 $checked{'USESRV'}{$fwdfwsettings{'USESRV'}} = 'CHECKED';
1104 $checked{'ACTIVE'}{$fwdfwsettings{'ACTIVE'}} = 'CHECKED';
1105 $checked{'LOG'}{$fwdfwsettings{'LOG'}} = 'CHECKED';
1106 $checked{'TIME'}{$fwdfwsettings{'TIME'}} = 'CHECKED';
1107 $checked{'TIME_MON'}{$fwdfwsettings{'TIME_MON'}} = 'CHECKED';
1108 $checked{'TIME_TUE'}{$fwdfwsettings{'TIME_TUE'}} = 'CHECKED';
1109 $checked{'TIME_WED'}{$fwdfwsettings{'TIME_WED'}} = 'CHECKED';
1110 $checked{'TIME_THU'}{$fwdfwsettings{'TIME_THU'}} = 'CHECKED';
1111 $checked{'TIME_FRI'}{$fwdfwsettings{'TIME_FRI'}} = 'CHECKED';
1112 $checked{'TIME_SAT'}{$fwdfwsettings{'TIME_SAT'}} = 'CHECKED';
1113 $checked{'TIME_SUN'}{$fwdfwsettings{'TIME_SUN'}} = 'CHECKED';
1114 $selected{'TIME_FROM'}{$fwdfwsettings{'TIME_FROM'}} = 'selected';
1115 $selected{'TIME_TO'}{$fwdfwsettings{'TIME_TO'}} = 'selected';
1116 $selected{'ipfire'}{$fwdfwsettings{$fwdfwsettings{'grp2'}}} ='selected';
1119 $fwdfwsettings{'oldgrp1a'}=$fwdfwsettings{'grp1'};
1120 $fwdfwsettings{'oldgrp1b'}=$fwdfwsettings{$fwdfwsettings{'grp1'}};
1121 $fwdfwsettings{'oldgrp2a'}=$fwdfwsettings{'grp2'};
1122 $fwdfwsettings{'oldgrp2b'}=$fwdfwsettings{$fwdfwsettings{'grp2'}};
1123 $fwdfwsettings{'oldgrp3a'}=$fwdfwsettings{'grp3'};
1124 $fwdfwsettings{'oldgrp3b'}=$fwdfwsettings{$fwdfwsettings{'grp3'}};
1125 $fwdfwsettings{'oldusesrv'}=$fwdfwsettings{'USESRV'};
1126 $fwdfwsettings{'oldruleremark'}=$fwdfwsettings{'ruleremark'};
1128 $fwdfwsettings{'ACTIVE'}='ON';
1129 $checked{'ACTIVE'}{$fwdfwsettings{'ACTIVE'}} = 'CHECKED';
1132 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwdfw addrule'});
1135 <form method="post">
1137 <tr><td nowrap>$Lang::tr{'fwdfw rule action'}</td><td><select name='RULE_ACTION'>
1139 foreach ("ACCEPT","DROP","REJECT")
1141 if($fwdfwsettings{'updatefwrule'} eq 'on'){
1143 print "selected='selected'" if ($fwdfwsettings{'RULE_ACTION'} eq $_);
1144 print">$_</option>";
1146 if($fwdfwsettings{'POLICY'} eq 'MODE2'){
1147 $fwdfwsettings{'RULE_ACTION'} = 'DROP';
1150 if ($_ eq $fwdfwsettings{'RULE_ACTION'})
1152 print"<option selected>$_</option>";
1154 print"<option>$_</option>";
1158 print"</select></td></tr></table><hr>";
1160 &Header
::closebox
();
1161 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwdfw source'});
1162 #------SOURCE-------------------------------------------------------
1164 <table width='100%' border='0'>
1165 <tr><td width='1%'><input type='radio' name='grp1' value='src_addr' checked></td><td colspan='5'>$Lang::tr{'fwdfw sourceip'}<input type='TEXT' name='src_addr' value='$fwdfwsettings{'src_addr'}' ></td></tr>
1166 <tr><td colspan='7'><hr style='border:dotted #BFBFBF; border-width:1px 0 0 0 ; ' /></td></tr>
1167 <tr><td width='1%'><input type='radio' name='grp1' value='std_net_src' $checked{'grp1'}{'std_net_src'}></td><td nowrap='nowrap' width='12%'>$Lang::tr{'fwhost stdnet'}</td><td width='13%'><select name='std_net_src' style='min-width:185px;'>
1169 foreach my $network (sort keys %defaultNetworks)
1171 next if($defaultNetworks{$network}{'LOCATION'} eq "IPCOP");
1172 next if($defaultNetworks{$network}{'NAME'} eq "RED");
1173 print "<option value='$defaultNetworks{$network}{'NAME'}'";
1174 print " selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp1'}} eq $defaultNetworks{$network}{'NAME'});
1175 print ">$network</option>";
1178 </select></td><td width='1%'><input type='radio' name='grp1' value='ovpn_net_src' $checked{'grp1'}{'ovpn_net_src'}></td><td nowrap='nowrap' width='16%'>$Lang::tr{'fwhost ccdnet'}</td><td nowrap='nowrap' width='1%'><select name='ovpn_net_src' style='min-width:185px;'>
1180 &fillselect
(\
%ccdnet,$fwdfwsettings{$fwdfwsettings{'grp1'}});
1183 <tr><td><input type='radio' name='grp1' value='cust_net_src' $checked{'grp1'}{'cust_net_src'}></td><td>$Lang::tr{'fwhost cust net'}</td><td><select name='cust_net_src' style='min-width:185px;'>
1185 &fillselect
(\
%customnetwork,$fwdfwsettings{$fwdfwsettings{'grp1'}});
1187 </select></td><td width='1%'><input type='radio' name='grp1' value='ovpn_host_src' $checked{'grp1'}{'ovpn_host_src'}></td><td nowrap='nowrap' width='16%'>$Lang::tr{'fwhost ccdhost'}</td><td nowrap='nowrap' width='1%'><select name='ovpn_host_src' style='min-width:185px;'>
1189 foreach my $key (sort { uc($ccdhost{$a}[0]) cmp uc($ccdhost{$b}[0]) } keys %ccdhost)
1191 if ($ccdhost{$key}[33] ne ''){
1193 print "<option value='$ccdhost{$key}[1]'";
1194 print "selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp1'}} eq $ccdhost{$key}[1]);
1195 print ">$ccdhost{$key}[1]</option>";
1200 <tr><td valign='top'><input type='radio' name='grp1' value='cust_host_src' $checked{'grp1'}{'cust_host_src'}></td><td>$Lang::tr{'fwhost cust addr'}</td><td><select name='cust_host_src' style='min-width:185px;'>
1202 &fillselect
(\
%customhost,$fwdfwsettings{$fwdfwsettings{'grp1'}});
1204 </select></td><td width='1%'><input type='radio' name='grp1' value='ovpn_n2n_src' $checked{'grp1'}{'ovpn_n2n_src'}></td><td >$Lang::tr{'fwhost ovpn_n2n'}</td><td colspan='3'><select name='ovpn_n2n_src' style='min-width:185px;'>
1206 foreach my $key (sort { uc($ccdhost{$a}[0]) cmp uc($ccdhost{$b}[0]) } keys %ccdhost) {
1207 if($ccdhost{$key}[3] eq 'net'){
1209 print " selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp1'}} eq $ccdhost{$key}[1]);
1210 print ">$ccdhost{$key}[1]</option>";
1216 <tr><td valign='top'><input type='radio' name='grp1' value='cust_grp_src' $checked{'grp1'}{'cust_grp_src'}></td><td >$Lang::tr{'fwhost cust grp'}</td><td><select name='cust_grp_src' style='min-width:185px;'>
1218 foreach my $key (sort { uc($customgrp{$a}[0]) cmp uc($customgrp{$b}[0]) } keys %customgrp) {
1219 if($helper ne $customgrp{$key}[0]){
1221 print "selected='selected' " if ($fwdfwsettings{$fwdfwsettings{'grp1'}} eq $customgrp{$key}[0]);
1222 print ">$customgrp{$key}[0]</option>";
1224 $helper=$customgrp{$key}[0];
1228 <td valign='top'><input type='radio' name='grp1' value='ipsec_net_src' $checked{'grp1'}{'ipsec_net_src'}></td><td >$Lang::tr{'fwhost ipsec net'}</td><td><select name='ipsec_net_src' style='min-width:185px;'>
1230 foreach my $key (sort { uc($ipsecconf{$a}[1]) cmp uc($ipsecconf{$b}[1]) } keys %ipsecconf) {
1231 if ($ipsecconf{$key}[3] eq 'net'){
1233 print "selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp1'}} eq $ipsecconf{$key}[1]);
1234 print ">$ipsecconf{$key}[1]</option>";
1242 # <td valign='top'><input type='radio' name='grp1' value='ipsec_host_src' $checked{'grp1'}{'ipsec_host_src'}></td><td >$Lang::tr{'fwhost ipsec host'}</td><td><select name='ipsec_host_src' style='min-width:185px;'>
1244 # foreach my $key (sort { uc($ipsecconf{$a}[1]) cmp uc($ipsecconf{$b}[1]) } keys %ipsecconf) {
1245 # if ($ipsecconf{$key}[3] eq 'host'){
1247 # print "selected='selected'" if($fwdfwsettings{$fwdfwsettings{'grp1'}} eq $ipsecconf{$key}[1]);
1248 # print ">$ipsecconf{$key}[1]</option>";
1252 <tr><td colspan='8'><hr style='border:dotted #BFBFBF; border-width:1px 0 0 0 ; ' /></td></tr></table>
1253 <table width='100%' border='0'>
1254 <tr><td width='1%'><input type='checkbox' name='USE_SRC_PORT' value='ON' $checked{'USE_SRC_PORT'}{'ON'}></td><td width='51%' colspan='3'>$Lang::tr{'fwdfw use srcport'}</td>
1255 <td width='15%' nowrap='nowrap'>$Lang::tr{'fwdfw man port'}</td><td><select name='PROT'>
1257 foreach ("TCP","UDP","GRE","ESP","AH","ICMP")
1259 if ($_ eq $fwdfwsettings{'PROT'})
1261 print"<option selected>$_</option>";
1263 print"<option>$_</option>";
1266 $fwdfwsettings{'SRC_PORT'}=~ s/\|/,/g;
1268 </select></td><td align='right'><input type='text' name='SRC_PORT' value='$fwdfwsettings{'SRC_PORT'}' maxlength='20' size='18' ></td></tr>
1269 <tr><td></td><td></td><td></td><td></td><td nowrap='nowrap'>$Lang::tr{'fwhost icmptype'}</td><td colspan='2'><select name='ICMP_TYPES'>
1271 &General
::readhasharray
("${General::swroot}/fwhosts/icmp-types", \
%icmptypes);
1272 print"<option>All ICMP-Types</option>";
1273 foreach my $key (sort { uc($icmptypes{$a}[0]) cmp uc($icmptypes{$b}[0]) } keys %icmptypes){
1274 if($fwdfwsettings{'ICMP_TYPES'} eq "$icmptypes{$key}[0]"){
1275 print"<option selected>$icmptypes{$key}[0] ($icmptypes{$key}[1])</option>";
1277 print"<option>$icmptypes{$key}[0] ($icmptypes{$key}[1])</option>";
1281 </select></td></tr></table><hr>
1283 &Header
::closebox
();
1285 #---TARGET------------------------------------------------------
1286 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwdfw target'});
1288 <table width='100%' border='0'>
1289 <tr><td width='1%'><input type='radio' name='grp2' value='tgt_addr' checked></td><td colspan='2'>$Lang::tr{'fwdfw targetip'}<input type='TEXT' name='tgt_addr' value='$fwdfwsettings{'tgt_addr'}' size='16'><td><input type='radio' name='grp2' value='ipfire' $checked{'grp2'}{'ipfire'}></td><td><b>IPFire ($Lang::tr{'external access'})</b></td><td><select name='ipfire' style='min-width:185px;'>
1291 print "<option value='Default IP' $selected{'ipfire'}{'Default IP'}>Default IP</option>";
1293 foreach my $alias (sort keys %aliases)
1295 print "<option value='$alias' $selected{'ipfire'}{$alias}>$alias</option>";
1300 <tr><td colspan='7'><hr style='border:dotted #BFBFBF; border-width:1px 0 0 0 ; ' /></td></tr>
1301 <tr><td width='1%'><input type='radio' name='grp2' value='std_net_tgt' $checked{'grp2'}{'std_net_tgt'}></td><td nowrap='nowrap' width='12%'>$Lang::tr{'fwhost stdnet'}</td><td width='13%'><select name='std_net_tgt' style='min-width:185px;'>
1303 foreach my $network (sort keys %defaultNetworks)
1305 next if($defaultNetworks{$network}{'NAME'} eq "IPFire");
1306 print "<option value='$defaultNetworks{$network}{'NAME'}'";
1307 print " selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp2'}} eq $defaultNetworks{$network}{'NAME'});
1308 print ">$network</option>";
1311 </select></td><td width='1%'><input type='radio' name='grp2' value='ovpn_net_tgt' $checked{'grp2'}{'ovpn_net_tgt'}></td><td nowrap='nowrap' width='16%'>$Lang::tr{'fwhost ccdnet'}</td><td nowrap='nowrap' width='1%'><select name='ovpn_net_tgt' style='min-width:185px;'>
1313 &fillselect
(\
%ccdnet,$fwdfwsettings{$fwdfwsettings{'grp2'}});
1316 <tr><td><input type='radio' name='grp2' value='cust_net_tgt' $checked{'grp2'}{'cust_net_tgt'}></td><td>$Lang::tr{'fwhost cust net'}</td><td><select name='cust_net_tgt' style='min-width:185px;'>
1318 &fillselect
(\
%customnetwork,$fwdfwsettings{$fwdfwsettings{'grp2'}});
1320 </select></td><td width='1%'><input type='radio' name='grp2' value='ovpn_host_tgt' $checked{'grp2'}{'ovpn_host_tgt'}></td><td nowrap='nowrap' width='16%'>$Lang::tr{'fwhost ccdhost'}</td><td nowrap='nowrap' width='1%'><select name='ovpn_host_tgt' style='min-width:185px;'>
1322 foreach my $key (sort { uc($ccdhost{$a}[0]) cmp uc($ccdhost{$b}[0]) } keys %ccdhost)
1324 if ($ccdhost{$key}[33] ne ''){
1325 print "<option value='$ccdhost{$key}[1]' ";
1326 print "selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp2'}} eq $ccdhost{$key}[33]);
1327 print ">$ccdhost{$key}[1]</option>";
1332 <tr><td valign='top'><input type='radio' name='grp2' value='cust_host_tgt' $checked{'grp2'}{'cust_host_tgt'}></td><td>$Lang::tr{'fwhost cust addr'}</td><td><select name='cust_host_tgt' style='min-width:185px;'>
1334 &fillselect
(\
%customhost,$fwdfwsettings{$fwdfwsettings{'grp2'}});
1336 </select></td><td width='1%'><input type='radio' name='grp2' value='ovpn_n2n_tgt' $checked{'grp2'}{'ovpn_n2n_tgt'}></td><td >$Lang::tr{'fwhost ovpn_n2n'}</td><td colspan='3'><select name='ovpn_n2n_tgt' style='min-width:185px;'>
1338 foreach my $key (sort { uc($ccdhost{$a}[0]) cmp uc($ccdhost{$b}[0]) } keys %ccdhost) {
1339 if($ccdhost{$key}[3] eq 'net'){
1341 print "selected='selected'" if($fwdfwsettings{$fwdfwsettings{'grp2'}} eq $ccdhost{$key}[1]);
1342 print ">$ccdhost{$key}[1]</option>";
1347 <tr><td valign='top'><input type='radio' name='grp2' value='cust_grp_tgt' $checked{'grp2'}{'cust_grp_tgt'}></td><td >$Lang::tr{'fwhost cust grp'}</td><td><select name='cust_grp_tgt' style='min-width:185px;'>
1350 foreach my $key (sort { uc($customgrp{$a}[0]) cmp uc($customgrp{$b}[0]) } keys %customgrp) {
1351 if($helper ne $customgrp{$key}[0]){
1353 print"selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp2'}} eq $customgrp{$key}[0]);
1354 print">$customgrp{$key}[0]</option>";
1356 $helper=$customgrp{$key}[0];
1360 <td valign='top'><input type='radio' name='grp2' value='ipsec_net_tgt' $checked{'grp2'}{'ipsec_net_tgt'}></td><td >$Lang::tr{'fwhost ipsec net'}</td><td><select name='ipsec_net_tgt' style='min-width:185px;'>
1362 foreach my $key (sort { uc($ipsecconf{$a}[1]) cmp uc($ipsecconf{$b}[1]) } keys %ipsecconf) {
1363 if ($ipsecconf{$key}[3] eq 'net'){
1365 print"selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp2'}} eq $ipsecconf{$key}[1]);
1366 print">$ipsecconf{$key}[1]</option>";
1372 # <td valign='top'><input type='radio' name='grp2' value='ipsec_host_tgt' $checked{'grp2'}{'ipsec_host_tgt'}></td><td >$Lang::tr{'fwhost ipsec host'}</td><td><select name='ipsec_host_tgt' style='min-width:185px;'>
1374 # foreach my $key (sort { uc($ipsecconf{$a}[1]) cmp uc($ipsecconf{$b}[1]) } keys %ipsecconf) {
1375 # if ($ipsecconf{$key}[3] eq 'host'){
1377 # print"selected='Selected'" if ($fwdfwsettings{$fwdfwsettings{'grp2'}} eq $ipsecconf{$key}[1]);
1378 # print">$ipsecconf{$key}[1]</option>";
1383 <b>$Lang::tr{'fwhost attention'}:</b><br>
1384 $Lang::tr{'fwhost macwarn'}<br><hr style='border:dotted #BFBFBF; border-width:1px 0 0 0 ; '></hr><br>
1386 <table width='100%' border='0'>
1387 <tr><td width='1%'><input type='checkbox' name='USESRV' value='ON' $checked{'USESRV'}{'ON'} ></td><td width='48%'>$Lang::tr{'fwdfw use srv'}</td><td width='1%'><input type='radio' name='grp3' value='cust_srv' checked></td><td nowrap='nowrap'>$Lang::tr{'fwhost cust service'}</td><td width='1%' colspan='2'><select name='cust_srv'style='min-width:230px;' >
1389 &General
::readhasharray
("$configsrv", \
%customservice);
1390 foreach my $key (sort { uc($customservice{$a}[0]) cmp uc($customservice{$b}[0]) } keys %customservice){
1392 print"selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp3'}} eq $customservice{$key}[0]);
1393 print"value='$customservice{$key}[0]'>$customservice{$key}[0]</option>";
1397 <tr><td colspan='2'></td><td><input type='radio' name='grp3' value='cust_srvgrp' $checked{'grp3'}{'cust_srvgrp'}></td><td nowrap='nowrap'>$Lang::tr{'fwhost cust srvgrp'}:</td><td colspan='2'><select name='cust_srvgrp'style='min-width:230px;' >
1399 &General
::readhasharray
("$configsrvgrp", \
%customservicegrp);
1401 foreach my $key (sort { uc($customservicegrp{$a}[0]) cmp uc($customservicegrp{$b}[0]) } keys %customservicegrp){
1402 if ($helper ne $customservicegrp{$key}[0]){
1404 print"selected='selected'" if ($fwdfwsettings{$fwdfwsettings{'grp3'}} eq $customservicegrp{$key}[0]);
1405 print">$customservicegrp{$key}[0]</option>";
1407 $helper=$customservicegrp{$key}[0];
1411 <tr><td colspan='2'></td><td><input type='radio' name='grp3' value='TGT_PORT' $checked{'grp3'}{'TGT_PORT'}></td><td>$Lang::tr{'fwdfw man port'}</td><td><select name='TGT_PROT'>
1413 foreach ("TCP","UDP","GRE","ESP","AH","ICMP")
1415 if ($_ eq $fwdfwsettings{'TGT_PROT'})
1417 print"<option selected>$_</option>";
1419 print"<option>$_</option>";
1422 $fwdfwsettings{'TGT_PORT'} =~ s/\|/,/g;
1424 </select></td><td align='right'><input type='text' name='TGT_PORT' value='$fwdfwsettings{'TGT_PORT'}' maxlength='20' size='18' ></td></tr>
1425 <tr><td colspan='2'></td><td></td><td>$Lang::tr{'fwhost icmptype'}</td><td colspan='2'><select name='ICMP_TGT'>
1427 &General
::readhasharray
("${General::swroot}/fwhosts/icmp-types", \
%icmptypes);
1428 print"<option>All ICMP-Types</option>";
1429 foreach my $key (sort { uc($icmptypes{$a}[0]) cmp uc($icmptypes{$b}[0]) }keys %icmptypes){
1430 if($fwdfwsettings{'ICMP_TGT'} eq "$icmptypes{$key}[0]"){
1431 print"<option selected>$icmptypes{$key}[0] ($icmptypes{$key}[1])</option>";
1433 print"<option>$icmptypes{$key}[0] ($icmptypes{$key}[1])</option>";
1438 </table><hr><br><br>
1441 #---Activate/logging/remark-------------------------------------
1442 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwdfw additional'});
1444 <table width='100%' border='0'>
1445 <tr><td width='12%'>$Lang::tr{'remark'}:</td><td align='left'><input type='text' name='ruleremark' size='40' maxlength='255' value='$fwdfwsettings{'ruleremark'}'></td></tr>
1447 if($fwdfwsettings{'updatefwrule'} eq 'on' || $fwdfwsettings{'copyfwrule'} eq 'on'){
1448 print "<tr><td width='12%'>$Lang::tr{'fwdfw rulepos'}:</td><td><select name='rulepos' >";
1449 for (my $count =1; $count <= $sum; $count++){
1450 print"<option value='$count' ";
1451 print"selected='selected'" if($fwdfwsettings{'oldrulenumber'} eq $count);
1452 print">$count</option>";
1454 print"</select></td></tr>";
1456 print "<tr><td width='12%'>$Lang::tr{'fwdfw rulepos'}:</td><td><input type='text' name='rulepos' size='2'></td></tr>";
1460 </table><table width='100%'>
1461 <tr><td width='1%'><input type='checkbox' name='ACTIVE' value='ON' $checked{'ACTIVE'}{'ON'}></td><td>$Lang::tr{'fwdfw rule activate'}</td></tr>
1462 <tr><td width='1%'><input type='checkbox' name='LOG' value='ON' $checked{'LOG'}{'ON'} ></td><td>$Lang::tr{'fwdfw log rule'}</td></tr>
1465 &Header
::closebox
();
1466 #---ADD TIMEFRAME-----------------------------------------------
1467 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwdfw timeframe'});
1469 <table width='70%' border='0'>
1470 <tr><td width='1%'><input type='checkbox' name='TIME' value='ON' $checked{'TIME'}{'ON'}></td><td colspan='4'>$Lang::tr{'fwdfw timeframe'}</td></tr>
1471 <tr><td colspan='7'> </td></tr>
1473 <td align='left'>$Lang::tr{'time'}:</td>
1474 <td width='30%' align='left'>$Lang::tr{'advproxy monday'} $Lang::tr{'advproxy tuesday'} $Lang::tr{'advproxy wednesday'} $Lang::tr{'advproxy thursday'} $Lang::tr{'advproxy friday'} $Lang::tr{'advproxy saturday'} $Lang::tr{'advproxy sunday'}</td>
1475 <td width='15%' align='left'>$Lang::tr{'advproxy from'}</td>
1476 <td width='15%' align='left'>$Lang::tr{'advproxy to'}</td>
1479 <td align='right'></td>
1480 <td width='30%' align='left'>
1481 <input type='checkbox' name='TIME_MON' value='on' $checked{'TIME_MON'}{'on'} />
1482 <input type='checkbox' name='TIME_TUE' value='on' $checked{'TIME_TUE'}{'on'} />
1483 <input type='checkbox' name='TIME_WED' value='on' $checked{'TIME_WED'}{'on'} />
1484 <input type='checkbox' name='TIME_THU' value='on' $checked{'TIME_THU'}{'on'} />
1485 <input type='checkbox' name='TIME_FRI' value='on' $checked{'TIME_FRI'}{'on'} />
1486 <input type='checkbox' name='TIME_SAT' value='on' $checked{'TIME_SAT'}{'on'} />
1487 <input type='checkbox' name='TIME_SUN' value='on' $checked{'TIME_SUN'}{'on'} />
1489 <td><select name='TIME_FROM'>
1491 for (my $i=0;$i<=23;$i++) {
1492 $i = sprintf("%02s",$i);
1493 for (my $j=0;$j<=45;$j+=15) {
1494 $j = sprintf("%02s",$j);
1495 my $time = $i.":".$j;
1496 print "\t\t\t\t\t<option $selected{'TIME_FROM'}{$time}>$i:$j</option>\n";
1501 <td><select name='TIME_TO'>
1503 for (my $i=0;$i<=23;$i++) {
1504 $i = sprintf("%02s",$i);
1505 for (my $j=0;$j<=45;$j+=15) {
1506 $j = sprintf("%02s",$j);
1507 my $time = $i.":".$j;
1508 print "\t\t\t\t\t<option $selected{'TIME_TO'}{$time}>$i:$j</option>\n";
1515 &Header
::closebox
();
1516 #---ACTION------------------------------------------------------
1517 if($fwdfwsettings{'updatefwrule'} ne 'on'){
1519 <table border='0' width='100%'>
1520 <tr><td align='right'><input type='submit' value='$Lang::tr{'add'}' style='min-width:100px;' />
1521 <input type='hidden' name='config' value='$config' >
1522 <input type='hidden' name='ACTION' value='saverule' >
1523 </form><form method='post' style='display:inline'><input type='submit' value='$Lang::tr{'fwhost back'}' style='min-width:100px;'><input type='hidden' name='ACTION' value'reset'></td></td>
1528 <table border='0' width='100%'>
1529 <tr><td align='right'><input type='submit' value='$Lang::tr{'fwdfw change'}' style='min-width:100px;' /><input type='hidden' name='updatefwrule' value='$fwdfwsettings{'updatefwrule'}'><input type='hidden' name='key' value='$fwdfwsettings{'key'}'>
1530 <input type='hidden' name='oldgrp1a' value='$fwdfwsettings{'oldgrp1a'}' />
1531 <input type='hidden' name='oldgrp1b' value='$fwdfwsettings{'oldgrp1b'}' />
1532 <input type='hidden' name='oldgrp2a' value='$fwdfwsettings{'oldgrp2a'}' />
1533 <input type='hidden' name='oldgrp2b' value='$fwdfwsettings{'oldgrp2b'}' />
1534 <input type='hidden' name='oldgrp3a' value='$fwdfwsettings{'oldgrp3a'}' />
1535 <input type='hidden' name='oldgrp3b' value='$fwdfwsettings{'oldgrp3b'}' />
1536 <input type='hidden' name='oldusesrv' value='$fwdfwsettings{'oldusesrv'}' />
1537 <input type='hidden' name='oldrulenumber' value='$fwdfwsettings{'oldrulenumber'}' />
1538 <input type='hidden' name='rulenumber' value='$fwdfwsettings{'rulepos'}' />
1539 <input type='hidden' name='oldruleremark' value='$fwdfwsettings{'oldruleremark'}' />
1540 <input type='hidden' name='ACTION' value='saverule' ></form><form method='post' style='display:inline'><input type='submit' value='$Lang::tr{'fwhost back'}' style='min-width:100px;'><input type='hidden' name='ACTION' value'reset'></td></td>
1544 &Header
::closebox
();
1550 &General
::readhasharray
("$config", $hash);
1551 if (!$errormessage){
1552 #check if we change an forward rule to an external access
1553 if( $fwdfwsettings{'grp2'} eq 'ipfire' && $fwdfwsettings{'oldgrp2a'} ne 'ipfire' && $fwdfwsettings{'updatefwrule'} eq 'on'){
1554 &changerule
($configfwdfw);
1556 #check if we change an forward rule to an outgoing
1557 if( $fwdfwsettings{$fwdfwsettings{'grp1'}} eq 'IPFire' && $fwdfwsettings{'oldgrp1b'} ne 'IPFire' && $fwdfwsettings{'updatefwrule'} eq 'on'){
1558 &changerule
($configfwdfw);
1560 #check if we change an external access rule to a forward
1561 if( $fwdfwsettings{'grp2'} ne 'ipfire' && $fwdfwsettings{'oldgrp2a'} eq 'ipfire' && $fwdfwsettings{'updatefwrule'} eq 'on'){
1562 &changerule
($configinput);
1564 #check if we change an external access rule to a outgoing
1565 if( $fwdfwsettings{$fwdfwsettings{'grp1'}} eq 'IPFire' && $fwdfwsettings{'grp2'} ne 'ipfire' && $fwdfwsettings{'oldgrp2a'} eq 'ipfire' && $fwdfwsettings{'updatefwrule'} eq 'on'){
1566 &changerule
($configinput);
1568 #check if we change an outgoing rule to a forward
1569 if( $fwdfwsettings{$fwdfwsettings{'grp1'}} ne 'IPFire' && $fwdfwsettings{'oldgrp1b'} eq 'IPFire' && $fwdfwsettings{'grp2'} ne 'ipfire' &&$fwdfwsettings{'updatefwrule'} eq 'on'){
1570 &changerule
($configoutgoing);
1572 #check if we change an outgoing rule to a external access
1573 if( $fwdfwsettings{$fwdfwsettings{'grp1'}} ne 'IPFire' && $fwdfwsettings{'oldgrp1b'} eq 'IPFire' && $fwdfwsettings{'grp2'} eq 'ipfire' && $fwdfwsettings{'updatefwrule'} eq 'on'){
1574 &changerule
($configoutgoing);
1576 if ($fwdfwsettings{'updatefwrule'} ne 'on'){
1577 my $key = &General
::findhasharraykey
($hash);
1578 $$hash{$key}[0] = $fwdfwsettings{'RULE_ACTION'};
1579 $$hash{$key}[1] = $fwdfwsettings{'chain'};
1580 $$hash{$key}[2] = $fwdfwsettings{'ACTIVE'};
1581 $$hash{$key}[3] = $fwdfwsettings{'grp1'};
1582 $$hash{$key}[4] = $fwdfwsettings{$fwdfwsettings{'grp1'}};
1583 $$hash{$key}[5] = $fwdfwsettings{'grp2'};
1584 $$hash{$key}[6] = $fwdfwsettings{$fwdfwsettings{'grp2'}};
1585 $$hash{$key}[7] = $fwdfwsettings{'USE_SRC_PORT'};
1586 $$hash{$key}[8] = $fwdfwsettings{'PROT'};
1587 $$hash{$key}[9] = $fwdfwsettings{'ICMP_TYPES'};
1588 $$hash{$key}[10] = $fwdfwsettings{'SRC_PORT'};
1589 $$hash{$key}[11] = $fwdfwsettings{'USESRV'};
1590 $$hash{$key}[12] = $fwdfwsettings{'TGT_PROT'};
1591 $$hash{$key}[13] = $fwdfwsettings{'ICMP_TGT'};
1592 $$hash{$key}[14] = $fwdfwsettings{'grp3'};
1593 $$hash{$key}[15] = $fwdfwsettings{$fwdfwsettings{'grp3'}};
1594 $$hash{$key}[16] = $fwdfwsettings{'ruleremark'};
1595 $$hash{$key}[17] = $fwdfwsettings{'LOG'};
1596 $$hash{$key}[18] = $fwdfwsettings{'TIME'};
1597 $$hash{$key}[19] = $fwdfwsettings{'TIME_MON'};
1598 $$hash{$key}[20] = $fwdfwsettings{'TIME_TUE'};
1599 $$hash{$key}[21] = $fwdfwsettings{'TIME_WED'};
1600 $$hash{$key}[22] = $fwdfwsettings{'TIME_THU'};
1601 $$hash{$key}[23] = $fwdfwsettings{'TIME_FRI'};
1602 $$hash{$key}[24] = $fwdfwsettings{'TIME_SAT'};
1603 $$hash{$key}[25] = $fwdfwsettings{'TIME_SUN'};
1604 $$hash{$key}[26] = $fwdfwsettings{'TIME_FROM'};
1605 $$hash{$key}[27] = $fwdfwsettings{'TIME_TO'};
1606 &General
::writehasharray
("$config", $hash);
1608 foreach my $key (sort {$a <=> $b} keys %$hash){
1609 if($key eq $fwdfwsettings{'key'}){
1610 $$hash{$key}[0] = $fwdfwsettings{'RULE_ACTION'};
1611 $$hash{$key}[1] = $fwdfwsettings{'chain'};
1612 $$hash{$key}[2] = $fwdfwsettings{'ACTIVE'};
1613 $$hash{$key}[3] = $fwdfwsettings{'grp1'};
1614 $$hash{$key}[4] = $fwdfwsettings{$fwdfwsettings{'grp1'}};
1615 $$hash{$key}[5] = $fwdfwsettings{'grp2'};
1616 $$hash{$key}[6] = $fwdfwsettings{$fwdfwsettings{'grp2'}};
1617 $$hash{$key}[7] = $fwdfwsettings{'USE_SRC_PORT'};
1618 $$hash{$key}[8] = $fwdfwsettings{'PROT'};
1619 $$hash{$key}[9] = $fwdfwsettings{'ICMP_TYPES'};
1620 $$hash{$key}[10] = $fwdfwsettings{'SRC_PORT'};
1621 $$hash{$key}[11] = $fwdfwsettings{'USESRV'};
1622 $$hash{$key}[12] = $fwdfwsettings{'TGT_PROT'};
1623 $$hash{$key}[13] = $fwdfwsettings{'ICMP_TGT'};
1624 $$hash{$key}[14] = $fwdfwsettings{'grp3'};
1625 $$hash{$key}[15] = $fwdfwsettings{$fwdfwsettings{'grp3'}};
1626 $$hash{$key}[16] = $fwdfwsettings{'ruleremark'};
1627 $$hash{$key}[17] = $fwdfwsettings{'LOG'};
1628 $$hash{$key}[18] = $fwdfwsettings{'TIME'};
1629 $$hash{$key}[19] = $fwdfwsettings{'TIME_MON'};
1630 $$hash{$key}[20] = $fwdfwsettings{'TIME_TUE'};
1631 $$hash{$key}[21] = $fwdfwsettings{'TIME_WED'};
1632 $$hash{$key}[22] = $fwdfwsettings{'TIME_THU'};
1633 $$hash{$key}[23] = $fwdfwsettings{'TIME_FRI'};
1634 $$hash{$key}[24] = $fwdfwsettings{'TIME_SAT'};
1635 $$hash{$key}[25] = $fwdfwsettings{'TIME_SUN'};
1636 $$hash{$key}[26] = $fwdfwsettings{'TIME_FROM'};
1637 $$hash{$key}[27] = $fwdfwsettings{'TIME_TO'};
1642 &General
::writehasharray
("$config", $hash);
1643 if($fwdfwsettings{'oldrulenumber'} > $fwdfwsettings{'rulepos'}){
1645 my $val=$fwdfwsettings{'oldrulenumber'}-$fwdfwsettings{'rulepos'};
1646 for (my $z=0;$z<$val;$z++){
1647 foreach my $key (sort {$a <=> $b} keys %$hash){
1648 if ($key eq $fwdfwsettings{'oldrulenumber'}) {
1650 if (exists $$hash{$last}){
1652 foreach my $y (0 .. $#{$$hash{$last}}) {
1653 $tmp{0}[$y] = $$hash{$last}[$y];
1655 #copy active rule to last
1656 foreach my $i (0 .. $#{$$hash{$last}}) {
1657 $$hash{$last}[$i] = $$hash{$key}[$i];
1659 #copy saved rule to actual position
1660 foreach my $x (0 .. $#{$tmp{0}}) {
1661 $$hash{$key}[$x] = $tmp{0}[$x];
1666 $fwdfwsettings{'oldrulenumber'}--;
1668 &General
::writehasharray
("$config", $hash);
1670 }elsif($fwdfwsettings{'rulepos'} > $fwdfwsettings{'oldrulenumber'}){
1672 my $val=$fwdfwsettings{'rulepos'}-$fwdfwsettings{'oldrulenumber'};
1673 for (my $z=0;$z<$val;$z++){
1674 foreach my $key (sort {$a <=> $b} keys %$hash){
1675 if ($key eq $fwdfwsettings{'oldrulenumber'}) {
1676 my $next = $key + 1;
1677 if (exists $$hash{$next}){
1679 foreach my $y (0 .. $#{$$hash{$next}}) {
1680 $tmp{0}[$y] = $$hash{$next}[$y];
1682 #copy active rule to next
1683 foreach my $i (0 .. $#{$$hash{$next}}) {
1684 $$hash{$next}[$i] = $$hash{$key}[$i];
1686 #copy saved rule to actual position
1687 foreach my $x (0 .. $#{$tmp{0}}) {
1688 $$hash{$key}[$x] = $tmp{0}[$x];
1693 $fwdfwsettings{'oldrulenumber'}++;
1695 &General
::writehasharray
("$config", $hash);
1702 if ($errormessage) {
1703 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
1704 print "<class name='base'>$errormessage\n";
1705 print " </class>\n";
1706 &Header
::closebox
();
1713 &Header
::openbox
('100%', 'left', $Lang::tr
{'fwhost hint'});
1714 print "<class name='base'>$hint\n";
1715 print " </class>\n";
1716 &Header
::closebox
();
1723 &General
::setup_default_networks
(\
%defaultNetworks);
1724 foreach my $network (sort keys %defaultNetworks)
1726 return "$network" if ($val eq $defaultNetworks{$network}{'NAME'});
1731 # Checks a hostname against RFC1035
1734 # Each part should be at least two characters in length
1735 # but no more than 63 characters
1736 if (length ($remark) < 1 || length ($remark) > 255) {
1738 # Only valid characters are a-z, A-Z, 0-9 and -
1739 if ($remark !~ /^[a-zäöüA-ZÖÄÜ0-9-.:;\|_()\/\s
]*$/) {
1741 # First character can only be a letter or a digit
1742 if (substr ($remark, 0, 1) !~ /^[a-zäöüA-ZÖÄÜ0-9]*$/) {
1744 # Last character can only be a letter or a digit
1745 if (substr ($remark, -1, 1) !~ /^[a-zöäüA-ZÖÄÜ0-9.:;_)]*$/) {
1751 my %hash=%{(shift)};
1753 if($hash{$key}[7] eq 'ON' && $hash{$key}[8] ne '' && $hash{$key}[10]){
1754 $hash{$key}[10]=~ s/\|/,/g;
1755 print": $hash{$key}[10]";
1756 }elsif($hash{$key}[7] eq 'ON' && $hash{$key}[8] eq 'ICMP'){
1757 print": <br>$hash{$key}[9] ";
1762 my %hash=%{(shift)};
1766 if($hash{$key}[11] eq 'ON' && $hash{$key}[12] ne 'ICMP'){
1767 if($hash{$key}[14] eq 'cust_srv'){
1768 &General
::readhasharray
("$configsrv", \
%customservice);
1769 foreach my $i (sort keys %customservice){
1770 if($customservice{$i}[0] eq $hash{$key}[15]){
1771 $service = $customservice{$i}[0];
1774 }elsif($hash{$key}[14] eq 'cust_srvgrp'){
1775 $service=$hash{$key}[15];
1776 }elsif($hash{$key}[14] eq 'TGT_PORT'){
1777 $hash{$key}[15]=~ s/\|/,/g;
1778 $service=$hash{$key}[15];
1783 }elsif($hash{$key}[11] eq 'ON' && $hash{$key}[12] eq 'ICMP'){
1784 print":<br>$hash{$key}[13]";
1787 sub get_serviceports
1791 &General
::readhasharray
("$configsrv", \
%customservice);
1792 &General
::readhasharray
("$configsrvgrp", \
%customservicegrp);
1796 if($type eq 'service'){
1797 foreach my $key (sort { uc($customservice{$a}[0]) cmp uc($customservice{$b}[0]) } keys %customservice){
1798 if ($customservice{$key}[0] eq $name){
1799 $protocols=$customservice{$key}[2];
1802 }elsif($type eq 'group'){
1803 foreach my $key (sort { uc($customservicegrp{$a}[0]) cmp uc($customservicegrp{$b}[0]) } keys %customservicegrp){
1804 if ($customservicegrp{$key}[0] eq $name){
1805 foreach my $key1 (sort { uc($customservice{$a}[0]) cmp uc($customservice{$b}[0]) } keys %customservice){
1806 if ($customservice{$key1}[0] eq $customservicegrp{$key}[2]){
1807 if($customservice{$key1}[2] eq 'TCP'){$tcp='TCP';}else{$udp='UDP';}
1813 if($tcp && $udp){$protocols="TCP,UDP";
1814 }elsif($tcp){$protocols.="TCP";
1815 }elsif($udp){$protocols.="UDP";}
1821 &viewtablenew
(\
%configfwdfw,$configfwdfw,$Lang::tr
{'fwdfw rules'},"Forward" );
1822 &viewtablenew
(\
%configinputfw,$configinput,"",$Lang::tr
{'external access'} );
1823 &viewtablenew
(\
%configoutgoingfw,$configoutgoing,"","Outgoing" );
1832 &General
::readhasharray
("$config", $hash);
1834 &Header
::openbox
('100%', 'left',$title);
1842 print"<b>$title1</b><br>";
1843 print"<table width='100%' style='border: 1px solid #000000;' rules='none'; padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;'>";
1844 print"<tr><td align='center' width='1%'><b>#</td><td width='1%'></td><td align='center' ><b>$Lang::tr{'fwdfw source'}</td><td width='1%'><b>Log</td><td align='center' width='20%'><b>$Lang::tr{'fwdfw target'}</td><td align='center'><b>$Lang::tr{'protocol'}</b></td><td align='center' width='70%'><b>$Lang::tr{'remark'}</td><td align='center' colspan='3' width='1%'><b>$Lang::tr{'fwdfw action'}</td></tr>";
1845 foreach my $key (sort {$a <=> $b} keys %$hash){
1847 #check if vpn hosts/nets have been deleted
1848 if($$hash{$key}[3] =~ /ipsec/i || $$hash{$key}[3] =~ /ovpn/i){
1849 push (@tmpsrc,$$hash{$key}[4]);
1851 if($$hash{$key}[5] =~ /ipsec/i || $$hash{$key}[5] =~ /ovpn/i){
1852 push (@tmpsrc,$$hash{$key}[6]);
1854 foreach my $host (@tmpsrc){
1855 if($$hash{$key}[3] eq 'ipsec_net_src' || $$hash{$key}[5] eq 'ipsec_net_tgt'){
1856 if(&fwlib
::get_ipsec_net_ip
($host,11) eq ''){
1858 &disable_rule
($key);
1861 }elsif($$hash{$key}[3] eq 'ovpn_net_src' || $$hash{$key}[5] eq 'ovpn_net_tgt'){
1862 if(&fwlib
::get_ovpn_net_ip
($host,1) eq ''){
1864 &disable_rule
($key);
1867 }elsif($$hash{$key}[3] eq 'ovpn_n2n_src' || $$hash{$key}[5] eq 'ovpn_n2n_tgt'){
1868 if(&fwlib
::get_ovpn_n2n_ip
($host,27) eq ''){
1870 &disable_rule
($key);
1873 }elsif($$hash{$key}[3] eq 'ovpn_host_src' || $$hash{$key}[5] eq 'ovpn_host_tgt'){
1874 if(&fwlib
::get_ovpn_host_ip
($host,33) eq ''){
1876 &disable_rule
($key);
1883 $$hash{'ACTIVE'}=$$hash{$key}[2];
1885 if($coloryellow eq 'on'){
1886 print"<tr bgcolor='$color{'color14'}' >";
1888 }elsif($coloryellow eq ''){
1890 print"<tr bgcolor='$color{'color22'}' >";
1893 print"<tr bgcolor='$color{'color20'}' >";
1897 <td align='right'>$key</td>
1899 if ($$hash{$key}[0] eq 'ACCEPT'){
1902 $rulecolor=$color{'color17'};
1903 }elsif($$hash{$key}[0] eq 'DROP'){
1906 $rulecolor=$color{'color25'};
1907 }elsif($$hash{$key}[0] eq 'REJECT'){
1910 $rulecolor=$color{'color16'};
1912 print"<td bgcolor='$rulecolor' width='2%' align='center'><span title='$tooltip'><b>$ruletype</b></span></td>";
1913 print"<td align='center' nowrap='nowrap'>";
1914 if ($$hash{$key}[3] eq 'std_net_src'){
1915 print &get_name
($$hash{$key}[4]);
1917 print $$hash{$key}[4];
1919 &getsrcport
(\
%$hash,$key);
1920 if ($$hash{$key}[17] eq 'ON'){
1921 $log="/images/on.gif";
1923 $log="/images/off.gif";
1927 <form method='post'>
1928 <td width='1%' align='left'><input type='image' img src='$log' alt='$Lang::tr{'click to disable'}' title='$Lang::tr{'fwdfw togglelog'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;'/>
1929 <input type='hidden' name='key' value='$key' />
1930 <input type='hidden' name='config' value='$config' />
1931 <input type='hidden' name='ACTION' value='$Lang::tr{'fwdfw togglelog'}' />
1935 <td align='center' nowrap='nowrap'>
1937 if ($$hash{$key}[5] eq 'std_net_tgt'){
1938 print &get_name
($$hash{$key}[6]);
1940 print $$hash{$key}[6];
1942 &gettgtport
(\
%$hash,$key);
1943 ################################################################################
1947 if ($$hash{$key}[12]){ #target prot if manual
1948 $prot=$$hash{$key}[12];
1949 }elsif($$hash{$key}[8]){ #source prot if manual
1950 $prot=$$hash{$key}[8];
1951 }elsif($$hash{$key}[14] eq 'cust_srv'){
1952 $prot=&get_serviceports
("service",$$hash{$key}[15]);
1953 }elsif($$hash{$key}[14] eq 'cust_srvgrp'){
1954 $prot=&get_serviceports
("group",$$hash{$key}[15]);
1956 $prot=$Lang::tr
{'all'};
1958 print"<td align='center'>$prot</td>";
1960 print"<td width='20%'>$$hash{$key}[16]</td>";
1962 if($$hash{$key}[2] eq 'ON'){
1963 $gif="/images/on.gif"
1966 $gif="/images/off.gif"
1969 <form method='post'>
1970 <td width='1%'><input type='image' img src='$gif' alt='$Lang::tr{'click to disable'}' title='$Lang::tr{'fwdfw toggle'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;display: block;' />
1971 <input type='hidden' name='key' value='$key' />
1972 <input type='hidden' name='config' value='$config' />
1973 <input type='hidden' name='ACTION' value='$Lang::tr{'fwdfw toggle'}' />
1975 <form method='post'>
1976 <td width='1%' ><input type='image' img src='/images/edit.gif' alt='$Lang::tr{'edit'}' title='$Lang::tr{'fwdfw edit'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;display: block;' />
1977 <input type='hidden' name='key' value='$key' />
1978 <input type='hidden' name='config' value='$config' />
1979 <input type='hidden' name='ACTION' value='editrule' />
1981 <form method='post'>
1982 <td width='1%'><input type='image' img src='/images/addblue.gif' alt='$Lang::tr{'fwdfw copy'}' title='$Lang::tr{'fwdfw copy'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;display: block;' />
1983 <input type='hidden' name='key' value='$key' />
1984 <input type='hidden' name='config' value='$config' />
1985 <input type='hidden' name='ACTION' value='copyrule' />
1987 <form method='post'>
1988 <td width='1%' ><input type='image' img src='/images/delete.gif' alt='$Lang::tr{'delete'}' title='$Lang::tr{'fwdfw delete'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;display: block;' />
1989 <input type='hidden' name='key' value='$key' />
1990 <input type='hidden' name='config' value='$config' />
1991 <input type='hidden' name='ACTION' value='deleterule' />
1994 if (exists $$hash{$key-1}){
1996 <form method='post'>
1997 <td width='1%'><input type='image' img src='/images/up.gif' alt='$Lang::tr{'fwdfw moveup'}' title='$Lang::tr{'fwdfw moveup'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;display: block;' />
1998 <input type='hidden' name='key' value='$key' />
1999 <input type='hidden' name='config' value='$config' />
2000 <input type='hidden' name='ACTION' value='moveup' />
2006 if (exists $$hash{$key+1}){
2008 <form method='post'>
2009 <td width='1%' ><input type='image' img src='/images/down.gif' alt='$Lang::tr{'fwdfw movedown'}' title='$Lang::tr{'fwdfw movedown'}' style='padding-top: 0px; padding-left: 0px; padding-bottom: 0px ;padding-right: 0px ;display: block;' />
2010 <input type='hidden' name='key' value='$key' />
2011 <input type='hidden' name='config' value='$config' />
2012 <input type='hidden' name='ACTION' value='movedown' />
2013 </td></form></td></tr>
2016 print"<td></td></tr>";
2018 #if timeframe set, print new line in table
2019 if ($$hash{$key}[18] eq 'ON'){
2021 if($$hash{$key}[19] ne ''){push (@days,$Lang::tr
{'fwdfw wd_mon'});}
2022 if($$hash{$key}[20] ne ''){push (@days,$Lang::tr
{'fwdfw wd_tue'});}
2023 if($$hash{$key}[21] ne ''){push (@days,$Lang::tr
{'fwdfw wd_wed'});}
2024 if($$hash{$key}[22] ne ''){push (@days,$Lang::tr
{'fwdfw wd_thu'});}
2025 if($$hash{$key}[23] ne ''){push (@days,$Lang::tr
{'fwdfw wd_fri'});}
2026 if($$hash{$key}[24] ne ''){push (@days,$Lang::tr
{'fwdfw wd_sat'});}
2027 if($$hash{$key}[25] ne ''){push (@days,$Lang::tr
{'fwdfw wd_sun'});}
2028 my $weekdays=join(",",@days);
2030 print"<tr bgcolor='#FFE4B5'><td colspan='6'>$Lang::tr{'fwdfw time'} ";
2032 print "  $Lang::tr{'fwdfw from'} $$hash{$key}[26]   $Lang::tr{'fwdfw till'} $$hash{$key}[27]</td><td colspan='8'></d></tr>";
2037 &Header
::closebox
();
2042 my %hash=%{(shift)};
2045 foreach my $key (sort { uc($hash{$a}[0]) cmp uc($hash{$b}[0]) } keys %hash){
2046 if($hash{$key}[0] eq $val){
2047 print"<option value='$hash{$key}[0]' selected>$hash{$key}[0]</option>";
2049 print"<option value='$hash{$key}[0]'>$hash{$key}[0]</option>";
2055 if (!-f
"${General::swroot}/forward/reread"){
2056 system("touch ${General::swroot}/forward/reread");
2057 system("touch ${General::swroot}/fwhosts/reread");
2062 system("/usr/local/bin/forwardfwctrl");
2063 if ( -f
"${General::swroot}/forward/reread"){
2064 system("rm ${General::swroot}/forward/reread");
2065 system("rm ${General::swroot}/fwhosts/reread");
2068 &Header
::closebigbox
();
2069 &Header
::closepage
();