Project

General

Profile

Download (46.8 KB) Statistics
| Branch: | Tag: | Revision:
1 5ba18897 Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4 bdb7d6e7 Scott Ullrich
	firewall_rules_edit.php
5 e4cabb75 Scott Ullrich
	part of pfSense (http://www.pfsense.com)
6
        Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com)
7 5ba18897 Scott Ullrich
8 e4cabb75 Scott Ullrich
	originally part of m0n0wall (http://m0n0.ch/wall)
9 bdb7d6e7 Scott Ullrich
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
	All rights reserved.
11 5ba18897 Scott Ullrich
12 bdb7d6e7 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
13
	modification, are permitted provided that the following conditions are met:
14 5ba18897 Scott Ullrich
15 bdb7d6e7 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
16
	   this list of conditions and the following disclaimer.
17 5ba18897 Scott Ullrich
18 bdb7d6e7 Scott Ullrich
	2. Redistributions in binary form must reproduce the above copyright
19
	   notice, this list of conditions and the following disclaimer in the
20
	   documentation and/or other materials provided with the distribution.
21 5ba18897 Scott Ullrich
22 bdb7d6e7 Scott Ullrich
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
	POSSIBILITY OF SUCH DAMAGE.
32 5b237745 Scott Ullrich
*/
33
34 6b07c15a Matthew Grooms
##|+PRIV
35
##|*IDENT=page-firewall-rules-edit
36
##|*NAME=Firewall: Rules: Edit page
37
##|*DESCR=Allow access to the 'Firewall: Rules: Edit' page.
38
##|*MATCH=firewall_rules_edit.php*
39
##|-PRIV
40
41
42 5b237745 Scott Ullrich
require("guiconfig.inc");
43
44 e825920f Scott Ullrich
$specialsrcdst = explode(" ", "any wanip lanip lan pptp pppoe");
45 5b237745 Scott Ullrich
46
if (!is_array($config['filter']['rule'])) {
47
	$config['filter']['rule'] = array();
48
}
49
filter_rules_sort();
50
$a_filter = &$config['filter']['rule'];
51
52
$id = $_GET['id'];
53
if (is_numeric($_POST['id']))
54
	$id = $_POST['id'];
55 5ba18897 Scott Ullrich
56 5b237745 Scott Ullrich
$after = $_GET['after'];
57
58
if (isset($_POST['after']))
59
	$after = $_POST['after'];
60
61
if (isset($_GET['dup'])) {
62
	$id = $_GET['dup'];
63
	$after = $_GET['dup'];
64
}
65
66
if (isset($id) && $a_filter[$id]) {
67
	$pconfig['interface'] = $a_filter[$id]['interface'];
68 5ba18897 Scott Ullrich
69 5b237745 Scott Ullrich
	if (!isset($a_filter[$id]['type']))
70
		$pconfig['type'] = "pass";
71
	else
72
		$pconfig['type'] = $a_filter[$id]['type'];
73 5ba18897 Scott Ullrich
74 4633edc2 Ermal Luçi
	if (isset($a_filter[$id]['floating']) || $if == "FloatingRules") {
75 661aed33 Ermal Luçi
		$pconfig['floating'] = $a_filter[$id]['floating'];
76
		if (isset($a_filter[$id]['interface']) && $a_filter[$id]['interface'] <> "") 
77
			$pconfig['interface'] = $a_filter[$id]['interface'];
78
	}
79
	
80
	if (isset($a_filter['floating'])) 
81
		$pconfig['floating'] = "yes";
82
83
	if (isset($a_filter[$id]['direction']))
84
                $pconfig['direction'] = $a_filter[$id]['direction'];
85
86 5b237745 Scott Ullrich
	if (isset($a_filter[$id]['protocol']))
87
		$pconfig['proto'] = $a_filter[$id]['protocol'];
88
	else
89
		$pconfig['proto'] = "any";
90 5ba18897 Scott Ullrich
91 5b237745 Scott Ullrich
	if ($a_filter[$id]['protocol'] == "icmp")
92
		$pconfig['icmptype'] = $a_filter[$id]['icmptype'];
93 5ba18897 Scott Ullrich
94 5b237745 Scott Ullrich
	address_to_pconfig($a_filter[$id]['source'], $pconfig['src'],
95
		$pconfig['srcmask'], $pconfig['srcnot'],
96
		$pconfig['srcbeginport'], $pconfig['srcendport']);
97 5ba18897 Scott Ullrich
98 8be60f21 Scott Ullrich
	if($a_filter[$id]['os'] <> "")
99
		$pconfig['os'] = $a_filter[$id]['os'];
100 e33c8694 Bill Marquette
101 5b237745 Scott Ullrich
	address_to_pconfig($a_filter[$id]['destination'], $pconfig['dst'],
102
		$pconfig['dstmask'], $pconfig['dstnot'],
103
		$pconfig['dstbeginport'], $pconfig['dstendport']);
104
105 c5fc1b2e Ermal Luçi
	if ($a_filter[$id]['dscp'] <> "")
106
		$pconfig['dscp'] = $a_filter[$id]['dscp'];
107
108 5b237745 Scott Ullrich
	$pconfig['disabled'] = isset($a_filter[$id]['disabled']);
109
	$pconfig['log'] = isset($a_filter[$id]['log']);
110
	$pconfig['descr'] = $a_filter[$id]['descr'];
111 8c84fe43 Scott Ullrich
112 5c1f5584 Ermal Luçi
	if (isset($a_filter[$id]['tag']) && $a_filter[$id]['tag'] <> "") 
113 661aed33 Ermal Luçi
		$pconfig['tag'] = $a_filter[$id]['tag'];
114 5c1f5584 Ermal Luçi
	if (isset($a_filter[$id]['tagged']) && $a_filter[$id]['tag'] <> "")
115 661aed33 Ermal Luçi
        	$pconfig['tagged'] = $a_filter[$id]['tagged'];
116
	if (isset($a_filter[$id]['quick']) && $a_filter[$id]['quick'])
117
		$pconfig['quick'] = $a_filter[$id]['quick'];
118 775ccea3 Ermal Luci
	if (isset($a_filter[$id]['allowopts']))
119
		$pconfig['allowopts'] = true;
120 661aed33 Ermal Luçi
121 ed08ef3e Scott Ullrich
	/* advanced */
122 fa9af164 Scott Ullrich
        $pconfig['max-src-nodes'] = $a_filter[$id]['max-src-nodes'];
123
        $pconfig['max-src-states'] = $a_filter[$id]['max-src-states'];
124
        $pconfig['statetype'] = $a_filter[$id]['statetype'];
125 5ba18897 Scott Ullrich
	$pconfig['statetimeout'] = $a_filter[$id]['statetimeout'];
126 8c84fe43 Scott Ullrich
127
	$pconfig['nosync'] = isset($a_filter[$id]['nosync']);
128 10f21e70 Scott Ullrich
129 ed08ef3e Scott Ullrich
	/* advanced - new connection per second banning*/
130
	$pconfig['max-src-conn-rate'] = $a_filter[$id]['max-src-conn-rate'];
131
	$pconfig['max-src-conn-rates'] = $a_filter[$id]['max-src-conn-rates'];
132 5ba18897 Scott Ullrich
133 e5980370 Scott Ullrich
	/* Multi-WAN next-hop support */
134 c98ddde2 Bill Marquette
	$pconfig['gateway'] = $a_filter[$id]['gateway'];
135 615b27bc Scott Dale
	
136 197bfe96 Ermal Luçi
	/* Shaper support */
137
	$pconfig['defaultqueue'] = $a_filter[$id]['defaultqueue'];
138
	$pconfig['ackqueue'] = $a_filter[$id]['ackqueue'];
139 a5fd67e1 Ermal Luçi
	$pconfig['dnpipe'] = $a_filter[$id]['dnpipe'];
140
	$pconfig['pdnpipe'] = $a_filter[$id]['pdnpipe'];
141 7e50413c Ermal Luçi
	$pconfig['l7container'] = $a_filter[$id]['l7container'];
142 197bfe96 Ermal Luçi
143 615b27bc Scott Dale
	//schedule support
144
	$pconfig['sched'] = $a_filter[$id]['sched'];
145 c98ddde2 Bill Marquette
146 5b237745 Scott Ullrich
} else {
147
	/* defaults */
148 a23d7248 Scott Ullrich
	if ($_GET['if'])
149
		$pconfig['interface'] = $_GET['if'];
150 5b237745 Scott Ullrich
	$pconfig['type'] = "pass";
151
	$pconfig['src'] = "any";
152
	$pconfig['dst'] = "any";
153
}
154 72320b88 Ermal Luçi
/* Allow the FlotingRules to work */
155
$if = $pconfig['interface'];
156 5b237745 Scott Ullrich
157
if (isset($_GET['dup']))
158
	unset($id);
159
160
if ($_POST) {
161 87f0be87 Chris Buechler
162
	if ($_POST['type'] == "reject" && $_POST['proto'] <> "tcp")
163
		$input_errors[] = "Reject type rules only works when the protocol is set to TCP.";
164 28f9e493 Scott Ullrich
165 5b237745 Scott Ullrich
	if (($_POST['proto'] != "tcp") && ($_POST['proto'] != "udp") && ($_POST['proto'] != "tcp/udp")) {
166
		$_POST['srcbeginport'] = 0;
167
		$_POST['srcendport'] = 0;
168
		$_POST['dstbeginport'] = 0;
169
		$_POST['dstendport'] = 0;
170
	} else {
171 5ba18897 Scott Ullrich
172 5b237745 Scott Ullrich
		if ($_POST['srcbeginport_cust'] && !$_POST['srcbeginport'])
173
			$_POST['srcbeginport'] = $_POST['srcbeginport_cust'];
174
		if ($_POST['srcendport_cust'] && !$_POST['srcendport'])
175
			$_POST['srcendport'] = $_POST['srcendport_cust'];
176 5ba18897 Scott Ullrich
177 5b237745 Scott Ullrich
		if ($_POST['srcbeginport'] == "any") {
178
			$_POST['srcbeginport'] = 0;
179
			$_POST['srcendport'] = 0;
180 5ba18897 Scott Ullrich
		} else {
181 5b237745 Scott Ullrich
			if (!$_POST['srcendport'])
182
				$_POST['srcendport'] = $_POST['srcbeginport'];
183
		}
184
		if ($_POST['srcendport'] == "any")
185
			$_POST['srcendport'] = $_POST['srcbeginport'];
186 5ba18897 Scott Ullrich
187 5b237745 Scott Ullrich
		if ($_POST['dstbeginport_cust'] && !$_POST['dstbeginport'])
188
			$_POST['dstbeginport'] = $_POST['dstbeginport_cust'];
189
		if ($_POST['dstendport_cust'] && !$_POST['dstendport'])
190
			$_POST['dstendport'] = $_POST['dstendport_cust'];
191 5ba18897 Scott Ullrich
192 5b237745 Scott Ullrich
		if ($_POST['dstbeginport'] == "any") {
193
			$_POST['dstbeginport'] = 0;
194
			$_POST['dstendport'] = 0;
195 5ba18897 Scott Ullrich
		} else {
196 5b237745 Scott Ullrich
			if (!$_POST['dstendport'])
197
				$_POST['dstendport'] = $_POST['dstbeginport'];
198
		}
199
		if ($_POST['dstendport'] == "any")
200 5ba18897 Scott Ullrich
			$_POST['dstendport'] = $_POST['dstbeginport'];
201 5b237745 Scott Ullrich
	}
202 5ba18897 Scott Ullrich
203 5b237745 Scott Ullrich
	if (is_specialnet($_POST['srctype'])) {
204
		$_POST['src'] = $_POST['srctype'];
205
		$_POST['srcmask'] = 0;
206
	} else if ($_POST['srctype'] == "single") {
207
		$_POST['srcmask'] = 32;
208
	}
209
	if (is_specialnet($_POST['dsttype'])) {
210
		$_POST['dst'] = $_POST['dsttype'];
211
		$_POST['dstmask'] = 0;
212
	}  else if ($_POST['dsttype'] == "single") {
213
		$_POST['dstmask'] = 32;
214
	}
215 5ba18897 Scott Ullrich
216 5b237745 Scott Ullrich
	unset($input_errors);
217
	$pconfig = $_POST;
218
219 ef2a753c Scott Ullrich
	/*  run through $_POST items encoding HTML entties so that the user
220
	 *  cannot think he is slick and perform a XSS attack on the unwilling 
221
	 */
222 21eff66f Scott Ullrich
	foreach ($_POST as $key => $value) {
223
		$temp = $value;
224 661aed33 Ermal Luçi
		if (isset($_POST['floating']) && $key == "interface")
225
			continue;
226 21eff66f Scott Ullrich
		$newpost = htmlentities($temp);
227 5157927f Scott Ullrich
		if($newpost <> $temp)   	 
228
			$input_errors[] = "Invalid characters detected ($temp).  Please remove invalid characters and save again.";		
229 ef2a753c Scott Ullrich
	}
230
231 5b237745 Scott Ullrich
	/* input validation */
232 661aed33 Ermal Luçi
	$reqdfields = explode(" ", "type proto src dst");
233
	$reqdfieldsn = explode(",", "Type,Protocol,Source,Destination");
234 5b237745 Scott Ullrich
235 452ade89 Bill Marquette
	if($_POST['statetype'] == "modulate state" or $_POST['statetype'] == "synproxy state") {
236 c22767b1 Bill Marquette
		if( $_POST['proto'] != "tcp" )
237
			$input_errors[] = "{$_POST['statetype']} is only valid with protocol tcp.";
238 452ade89 Bill Marquette
		if(($_POST['statetype'] == "synproxy state") && ($_POST['gateway'] != ""))
239
			$input_errors[] = "{$_POST['statetype']} is only valid if the gateway is set to 'default'.";
240
	}
241 10f7933f Chris Buechler
        
242 5b237745 Scott Ullrich
	if (!(is_specialnet($_POST['srctype']) || ($_POST['srctype'] == "single"))) {
243
		$reqdfields[] = "srcmask";
244
		$reqdfieldsn[] = "Source bit count";
245
	}
246
	if (!(is_specialnet($_POST['dsttype']) || ($_POST['dsttype'] == "single"))) {
247
		$reqdfields[] = "dstmask";
248
		$reqdfieldsn[] = "Destination bit count";
249
	}
250 5ba18897 Scott Ullrich
251 5b237745 Scott Ullrich
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
252 5ba18897 Scott Ullrich
253 5b237745 Scott Ullrich
	if (!$_POST['srcbeginport']) {
254
		$_POST['srcbeginport'] = 0;
255
		$_POST['srcendport'] = 0;
256
	}
257
	if (!$_POST['dstbeginport']) {
258
		$_POST['dstbeginport'] = 0;
259
		$_POST['dstendport'] = 0;
260
	}
261 5ba18897 Scott Ullrich
262 19757279 Scott Ullrich
	if (($_POST['srcbeginport'] && !alias_expand($_POST['srcbeginport']) && !is_port($_POST['srcbeginport']))) {
263 aba8aace Scott Ullrich
		$input_errors[] = "The start source port must be an alias or integer between 1 and 65535.";
264 bdb7d6e7 Scott Ullrich
	}
265 19757279 Scott Ullrich
	if (($_POST['srcendport'] && !alias_expand($_POST['srcendport']) && !is_port($_POST['srcendport']))) {
266 aba8aace Scott Ullrich
		$input_errors[] = "The end source port must be an alias or integer between 1 and 65535.";
267 bdb7d6e7 Scott Ullrich
	}
268 19757279 Scott Ullrich
	if (($_POST['dstbeginport'] && !alias_expand($_POST['dstbeginport']) && !is_port($_POST['dstbeginport']))) {
269 aba8aace Scott Ullrich
		$input_errors[] = "The start destination port must be an alias or integer between 1 and 65535.";
270 bdb7d6e7 Scott Ullrich
	}
271 19757279 Scott Ullrich
	if (($_POST['dstendport'] && !alias_expand($_POST['dstbeginport']) && !is_port($_POST['dstendport']))) {
272 aba8aace Scott Ullrich
		$input_errors[] = "The end destination port must be an alias or integer between 1 and 65535.";
273 bdb7d6e7 Scott Ullrich
	}
274 5ba18897 Scott Ullrich
275 0e5ddcd9 Scott Ullrich
	/* if user enters an alias and selects "network" then disallow. */
276
	if($_POST['srctype'] == "network") {
277
		if(is_alias($_POST['src']))
278
			$input_errors[] = "You must specify single host or alias for alias entries.";
279
	}
280
	if($_POST['dsttype'] == "network") {
281
		if(is_alias($_POST['dst']))
282
			$input_errors[] = "You must specify single host or alias for alias entries.";
283
	}
284
285 5b237745 Scott Ullrich
	if (!is_specialnet($_POST['srctype'])) {
286
		if (($_POST['src'] && !is_ipaddroranyalias($_POST['src']))) {
287 87f0be87 Chris Buechler
			$input_errors[] = "A valid source IP address or alias must be specified.";
288 5b237745 Scott Ullrich
		}
289
		if (($_POST['srcmask'] && !is_numericint($_POST['srcmask']))) {
290
			$input_errors[] = "A valid source bit count must be specified.";
291
		}
292
	}
293
	if (!is_specialnet($_POST['dsttype'])) {
294
		if (($_POST['dst'] && !is_ipaddroranyalias($_POST['dst']))) {
295 87f0be87 Chris Buechler
			$input_errors[] = "A valid destination IP address or alias must be specified.";
296 5b237745 Scott Ullrich
		}
297
		if (($_POST['dstmask'] && !is_numericint($_POST['dstmask']))) {
298
			$input_errors[] = "A valid destination bit count must be specified.";
299
		}
300
	}
301 5ba18897 Scott Ullrich
302 5b237745 Scott Ullrich
	if ($_POST['srcbeginport'] > $_POST['srcendport']) {
303
		/* swap */
304
		$tmp = $_POST['srcendport'];
305
		$_POST['srcendport'] = $_POST['srcbeginport'];
306
		$_POST['srcbeginport'] = $tmp;
307
	}
308
	if ($_POST['dstbeginport'] > $_POST['dstendport']) {
309
		/* swap */
310
		$tmp = $_POST['dstendport'];
311
		$_POST['dstendport'] = $_POST['dstbeginport'];
312
		$_POST['dstbeginport'] = $tmp;
313
	}
314 e33c8694 Bill Marquette
	if ($_POST['os'])
315
		if( $_POST['proto'] != "tcp" )
316
			$input_errors[] = "OS detection is only valid with protocol tcp.";
317 5b237745 Scott Ullrich
318 197bfe96 Ermal Luçi
	if ($_POST['ackqueue'] && $_POST['ackqueue'] != "none") {
319
		if ($_POST['defaultqueue'] == "none" )
320
			$input_errors[] = "You have to select a queue when you select an acknowledge queue too.";
321
		else if ($_POST['ackqueue'] == $_POST['defaultqueue'])
322 aa8cdf52 Scott Ullrich
			$input_errors[] = "Acknowledge queue and Queue cannot be the same.";		
323 197bfe96 Ermal Luçi
	}
324 a5fd67e1 Ermal Luçi
	if ($_POST['pdnpipe'] && $_POST['pdnpipe'] != "none") {
325
		if ($_POST['dnpipe'] == "none" )
326
			$input_errors[] = "You must select a queue for the In direction before selecting one for Out too.";
327
		else if ($_POST['pdnpipe'] == $_POST['dnpipe'])
328
			$input_errors[] = "In and Out Queue cannot be the same.";
329
		else if ($pdnpipe[0] == "?" && $dnpipe[0] <> "?")
330
			$input_errors[] = "You cannot select one queue and one virtual interface for IN and Out. both must be from the same type.";
331
		else if ($dnpipe[0] == "?" && $pdnpipe[0] <> "?")
332
			$input_errors[] = "You cannot select one queue and one virtual interface for IN and Out. both must be from the same type.";
333
	}
334 7e50413c Ermal Luçi
	if($_POST['l7container'] && $_POST['l7container'] != "none") {
335
		if(!($_POST['proto'] == "tcp" || $_POST['proto'] == "udp" || $_POST['proto'] == "tcp/udp"))
336
			$input_errors[] = "You can only select a layer7 container for tcp and/or udp protocols";
337
	}
338 197bfe96 Ermal Luçi
339 5b237745 Scott Ullrich
	if (!$input_errors) {
340
		$filterent = array();
341
		$filterent['type'] = $_POST['type'];
342 661aed33 Ermal Luçi
		if (isset($_POST['interface'] ))
343
			$filterent['interface'] = $_POST['interface'];
344
345
		if ($if == "FloatingRules" || isset($_POST['floating'])) {
346
			if (isset($_POST['tag']))
347
				$filterent['tag'] = $_POST['tag'];
348
			if (isset($_POST['tagged']))
349
            			$filterent['tagged'] = $_POST['tagged'];
350
			$filterent['direction'] = $_POST['direction'];
351
			if (isset($_POST['quick']) && $_POST['quick'] <> "")
352
				$filterent['quick'] = $_POST['quick'];
353
			$filterent['floating'] = "yes";
354
			if (isset($_POST['interface']) && count($_POST['interface']) > 0)  {
355
					$filterent['interface'] = implode(",", $_POST['interface']);
356
			}
357
		}
358 d59874c1 Scott Ullrich
359 bdb7d6e7 Scott Ullrich
		/* Advanced options */
360 775ccea3 Ermal Luci
		if ($_POST['allowopts'] == "yes")
361
			$filterent['allowopts'] = true;
362
		else
363
			unset($filterent['allowopts']);
364 bdb7d6e7 Scott Ullrich
		$filterent['max-src-nodes'] = $_POST['max-src-nodes'];
365
		$filterent['max-src-states'] = $_POST['max-src-states'];
366 5ba18897 Scott Ullrich
		$filterent['statetimeout'] = $_POST['statetimeout'];
367 fa9af164 Scott Ullrich
		$filterent['statetype'] = $_POST['statetype'];
368 e33c8694 Bill Marquette
		$filterent['os'] = $_POST['os'];
369 10f21e70 Scott Ullrich
370
		/* Nosync directive - do not xmlrpc sync this item */
371 8c84fe43 Scott Ullrich
		if($_POST['nosync'] <> "")
372 10f21e70 Scott Ullrich
			$filterent['nosync'] = true;
373
		else
374
			unset($filterent['nosync']);
375
376 3f00c1dc Scott Ullrich
		/* unless both values are provided, unset the values - ticket #650 */
377
		if($_POST['max-src-conn-rate'] <> "" and $_POST['max-src-conn-rates'] <> "") {
378
			$filterent['max-src-conn-rate'] = $_POST['max-src-conn-rate'];
379
			$filterent['max-src-conn-rates'] = $_POST['max-src-conn-rates'];
380
		} else {
381
			unset($filterent['max-src-conn-rate']);
382
			unset($filterent['max-src-conn-rates']);
383
		}
384 5ba18897 Scott Ullrich
385 5b237745 Scott Ullrich
		if ($_POST['proto'] != "any")
386
			$filterent['protocol'] = $_POST['proto'];
387
		else
388
			unset($filterent['protocol']);
389 5ba18897 Scott Ullrich
390 5b237745 Scott Ullrich
		if ($_POST['proto'] == "icmp" && $_POST['icmptype'])
391
			$filterent['icmptype'] = $_POST['icmptype'];
392
		else
393
			unset($filterent['icmptype']);
394 5ba18897 Scott Ullrich
395 5b237745 Scott Ullrich
		pconfig_to_address($filterent['source'], $_POST['src'],
396
			$_POST['srcmask'], $_POST['srcnot'],
397
			$_POST['srcbeginport'], $_POST['srcendport']);
398 5ba18897 Scott Ullrich
399 5b237745 Scott Ullrich
		pconfig_to_address($filterent['destination'], $_POST['dst'],
400
			$_POST['dstmask'], $_POST['dstnot'],
401
			$_POST['dstbeginport'], $_POST['dstendport']);
402 5ba18897 Scott Ullrich
403 f87f85c3 Bill Marquette
                if ($_POST['disabled'])
404
                        $filterent['disabled'] = true;
405
                else
406
                        unset($filterent['disabled']);
407 c5fc1b2e Ermal Luçi
		
408
		if ($_POST['dscp'])
409
			$filterent['dscp'] = $_POST['dscp'];
410
411 f87f85c3 Bill Marquette
                if ($_POST['log'])
412
                        $filterent['log'] = true;
413
                else
414
                        unset($filterent['log']);
415 c68fc1e7 Bill Marquette
		strncpy($filterent['descr'], $_POST['descr'], 52);
416 5ba18897 Scott Ullrich
417 c98ddde2 Bill Marquette
		if ($_POST['gateway'] != "") {
418
			$filterent['gateway'] = $_POST['gateway'];
419
		}
420 197bfe96 Ermal Luçi
		
421
		if (isset($_POST['defaultqueue']) && $_POST['defaultqueue'] != "none") {
422
			$filterent['defaultqueue'] = $_POST['defaultqueue'];
423
			if (isset($_POST['ackqueue']) && $_POST['ackqueue'] != "none")
424
				$filterent['ackqueue'] = $_POST['ackqueue'];
425
		}
426 c98ddde2 Bill Marquette
427 a5fd67e1 Ermal Luçi
		if (isset($_POST['dnpipe']) && $_POST['dnpipe'] != "none") {
428
			$filterent['dnpipe'] = $_POST['dnpipe'];
429
			if (isset($_POST['pdnpipe']) && $_POST['pdnpipe'] != "none")
430
				$filterent['pdnpipe'] = $_POST['pdnpipe'];
431
		}
432
433 7e50413c Ermal Luçi
		if (isset($_POST['l7container']) && $_POST['l7container'] != "none") {
434
			$filterent['l7container'] = $_POST['l7container'];
435
		}
436
		
437 615b27bc Scott Dale
		if ($_POST['sched'] != "") {
438
			$filterent['sched'] = $_POST['sched'];
439
		}
440
441 5b237745 Scott Ullrich
		if (isset($id) && $a_filter[$id])
442
			$a_filter[$id] = $filterent;
443
		else {
444
			if (is_numeric($after))
445
				array_splice($a_filter, $after+1, 0, array($filterent));
446
			else
447
				$a_filter[] = $filterent;
448
		}
449 f4e2a352 Scott Ullrich
450 5b237745 Scott Ullrich
		write_config();
451
		touch($d_filterconfdirty_path);
452 5ba18897 Scott Ullrich
453 661aed33 Ermal Luçi
		if (isset($_POST['floating']))
454
			header("Location: firewall_rules.php?if=FloatingRules");
455
		else
456
			header("Location: firewall_rules.php?if=" . $_POST['interface']);
457 5b237745 Scott Ullrich
		exit;
458
	}
459 c60824d2 Scott Ullrich
}
460
461 37c53a0d Ermal Lu?i
read_altq_config(); /* XXX: */
462
$qlist =& get_unique_queue_list();
463
read_dummynet_config(); /* XXX: */
464
$dnqlist =& get_unique_dnqueue_list();
465
read_layer7_config();
466
$l7clist =& get_l7_unique_list();
467
468 d88c6a9f Scott Ullrich
$pgtitle = array("Firewall","Rules","Edit");
469 a1357fe0 Bill Marquette
$closehead = false;
470 8ab3e9ed Erik Kristensen
471
$page_filename = "firewall_rules_edit.php";
472 da7ae7ef Bill Marquette
include("head.inc");
473 c60824d2 Scott Ullrich
474 5b237745 Scott Ullrich
?>
475 da7ae7ef Bill Marquette
476 5b237745 Scott Ullrich
</head>
477
478
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
479
<?php include("fbegin.inc"); ?>
480
<?php if ($input_errors) print_input_errors($input_errors); ?>
481 8ab3e9ed Erik Kristensen
482
<form action="firewall_rules_edit.php" method="post" name="iform" id="iform">
483
	<table width="100%" border="0" cellpadding="6" cellspacing="0">
484 e091cb45 Scott Ullrich
		<tr>
485
			<td colspan="2" valign="top" class="listtopic">Edit Firewall rule</td>
486
		</tr>	
487 8ab3e9ed Erik Kristensen
    	<tr>
488
			<td width="22%" valign="top" class="vncellreq">Action</td>
489
			<td width="78%" class="vtable">
490 b5c78501 Seth Mos
				<select name="type" class="formselect">
491 8ab3e9ed Erik Kristensen
					<?php $types = explode(" ", "Pass Block Reject"); foreach ($types as $type): ?>
492
					<option value="<?=strtolower($type);?>" <?php if (strtolower($type) == strtolower($pconfig['type'])) echo "selected"; ?>>
493
					<?=htmlspecialchars($type);?>
494
					</option>
495
					<?php endforeach; ?>
496 8c84fe43 Scott Ullrich
				</select>
497 8ab3e9ed Erik Kristensen
				<br/>
498
				<span class="vexpl">
499
					Choose what to do with packets that match the criteria specified below. <br/>
500
					Hint: the difference between block and reject is that with reject, a packet (TCP RST or ICMP port unreachable for UDP) is returned to the sender, whereas with block the packet is dropped silently. In either case, the original packet is discarded. Reject only works when the protocol is set to either TCP or UDP (but not &quot;TCP/UDP&quot;) below.
501
				</span>
502
			</td>
503
		</tr>
504
		<tr>
505
			<td width="22%" valign="top" class="vncellreq">Disabled</td>
506
			<td width="78%" class="vtable">
507
				<input name="disabled" type="checkbox" id="disabled" value="yes" <?php if ($pconfig['disabled']) echo "checked"; ?>>
508
				<strong>Disable this rule</strong><br />
509
				<span class="vexpl">Set this option to disable this rule without removing it from the list.</span>
510
			</td>
511
		</tr>
512 661aed33 Ermal Luçi
<?php if ($if == "FloatingRules" || isset($pconfig['floating'])): ?>
513
		<tr>
514
                        <td width="22%" valign="top" class="vncellreq"><?=gettext("Quick");?></td>
515
                        <td width="78%" class="vtable">
516
                                <input name="quick" type="checkbox" id="quick" value="yes" <?php if ($pconfig['quick']) echo "checked=\"checked\""; ?> />
517
                                <strong><?=gettext("Apply the action immediately on match.");?></strong><br />
518
                                <span class="vexpl"><?=gettext("Set this option if you need to apply this action to traffic that matches this rule immediately.");?></span>
519
                        </td>
520
                </tr>
521
<? endif; ?>
522 8ab3e9ed Erik Kristensen
		<tr>
523
			<td width="22%" valign="top" class="vncellreq">Interface</td>
524
			<td width="78%" class="vtable">
525 4633edc2 Ermal Luçi
<?php if ($if == "FloatingRules" || isset($pconfig['floating'])): ?>
526 8e6ac824 Ermal Luçi
				<select name="interface[]" multiple="true" class="formselect" size="3">
527 661aed33 Ermal Luçi
<? else: ?>
528 b5c78501 Seth Mos
				<select name="interface" class="formselect">
529 8ab3e9ed Erik Kristensen
<?php
530 661aed33 Ermal Luçi
   endif;
531 a7782099 Ermal Lu?i
				/* add group interfaces */
532
                                if (is_array($config['ifgroups']['ifgroupentry']))
533
					foreach($config['ifgroups']['ifgroupentry'] as $ifgen)
534
						if (have_ruleint_access($ifgen['ifname']))
535
							$interfaces[$ifgen['ifname']] = $ifgen['ifname'];
536
537 b7391125 Ermal Luçi
				$ifdescs = get_configured_interface_with_descr();
538
539 5335811d Ermal Luçi
				foreach ($ifdescs as $ifent => $ifdesc)
540
        				if(have_ruleint_access($ifent))
541
                				$interfaces[$ifent] = $ifdesc;
542 b6742927 Scott Ullrich
543 617f8d25 Ermal Lu?i
					if ($config['l2tp']['mode'] == "server")
544
                                                if(have_ruleint_access("l2tp"))
545
                                                        $interfaces['l2tp'] = "L2TP VPN";
546
547 b6742927 Scott Ullrich
					if ($config['pptpd']['mode'] == "server")
548
						if(have_ruleint_access("pptp")) 
549
							$interfaces['pptp'] = "PPTP VPN";
550
					
551
					if ($config['pppoe']['mode'] == "server")
552
						if(have_ruleint_access("pppoe")) 
553
							$interfaces['pppoe'] = "PPPoE VPN";
554
					
555
					/* add ipsec interfaces */
556
					if (isset($config['ipsec']['enable']) || isset($config['ipsec']['mobileclients']['enable']))
557
						if(have_ruleint_access("enc0")) 
558 0f266b2e Chris Buechler
							$interfaces["enc0"] = "IPsec";
559 bfb60ac8 Ermal Luçi
		
560
					/* add openvpn/tun interfaces */
561 d799787e Matthew Grooms
					if  ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
562
       					$interfaces["openvpn"] = "OpenVPN";
563 b6742927 Scott Ullrich
564 8ab3e9ed Erik Kristensen
					foreach ($interfaces as $iface => $ifacename): ?>
565 661aed33 Ermal Luçi
						<option value="<?=$iface;?>" <?php if ($pconfig['interface'] <> "" && stristr($pconfig['interface'], $iface)) echo "selected"; ?>><?=gettext($ifacename);?></option>
566 8ab3e9ed Erik Kristensen
<?php 				endforeach; ?>
567 8c84fe43 Scott Ullrich
				</select>
568 8ab3e9ed Erik Kristensen
				<br />
569
				<span class="vexpl">Choose on which interface packets must come in to match this rule.</span>
570
			</td>
571
		</tr>
572 661aed33 Ermal Luçi
<?php if ($if == "FloatingRules" || isset($pconfig['floating'])): ?>
573
                <tr>
574
                        <td width="22%" valign="top" class="vncellreq"><?=gettext("Direction");?></td>
575
                        <td width="78%" class="vtable">
576
                                 <select name="direction" class="formselect">
577
                                  <?php      $directions = array('any', 'in', 'out');
578
                                        foreach ($directions as $direction): ?>
579
                                                <option value="<?=$direction;?>"
580
                                                <?php if ($direction == $pconfig['direction']): ?>
581
                                                        selected="selected" 
582
						<?php endif; ?>
583
                                                ><?=$direction;?></option>
584
                  	                <?php endforeach; ?>      
585
                                </select>
586 0e640f76 Ermal Luçi
                		<input type="hidden" id="floating" name="floating" value="floating">
587 661aed33 Ermal Luçi
                        </td>
588
                <tr>
589
<?php endif; ?>
590 8ab3e9ed Erik Kristensen
		<tr>
591
			<td width="22%" valign="top" class="vncellreq">Protocol</td>
592
			<td width="78%" class="vtable">
593 b5c78501 Seth Mos
				<select name="proto" class="formselect" onchange="proto_change()">
594 8ab3e9ed Erik Kristensen
<?php
595 87f0be87 Chris Buechler
				$protocols = explode(" ", "TCP UDP TCP/UDP ICMP ESP AH GRE IGMP any carp pfsync");
596 8ab3e9ed Erik Kristensen
				foreach ($protocols as $proto): ?>
597
					<option value="<?=strtolower($proto);?>" <?php if (strtolower($proto) == $pconfig['proto']) echo "selected"; ?>><?=htmlspecialchars($proto);?></option>
598
<?php 			endforeach; ?>
599
				</select>
600
				<br />
601
				<span class="vexpl">Choose which IP protocol this rule should match. <br /> Hint: in most cases, you should specify <em>TCP</em> &nbsp;here.</span>
602
			</td>
603
		</tr>
604 3de8af0e Scott Ullrich
		<tr id="icmpbox" name="icmpbox">
605 8ab3e9ed Erik Kristensen
			<td valign="top" class="vncell">ICMP type</td>
606
			<td class="vtable">
607 b5c78501 Seth Mos
				<select name="icmptype" class="formselect">
608 8ab3e9ed Erik Kristensen
<?php
609
				$icmptypes = array(
610
				"" => "any",
611
				"echorep" => "Echo reply",
612
				"unreach" => "Destination unreachable",
613
				"squench" => "Source quench",
614
				"redir" => "Redirect",
615
				"althost" => "Alternate Host",
616
				"echoreq" => "Echo",
617
				"routeradv" => "Router advertisement",
618
				"routersol" => "Router solicitation",
619
				"timex" => "Time exceeded",
620
				"paramprob" => "Invalid IP header",
621
				"timereq" => "Timestamp",
622
				"timerep" => "Timestamp reply",
623
				"inforeq" => "Information request",
624
				"inforep" => "Information reply",
625
				"maskreq" => "Address mask request",
626
				"maskrep" => "Address mask reply"
627
				);
628
629
				foreach ($icmptypes as $icmptype => $descr): ?>
630
					<option value="<?=$icmptype;?>" <?php if ($icmptype == $pconfig['icmptype']) echo "selected"; ?>><?=htmlspecialchars($descr);?></option>
631
<?php 			endforeach; ?>
632
			</select>
633
			<br />
634
			<span class="vexpl">If you selected ICMP for the protocol above, you may specify an ICMP type here.</span>
635
		</td>
636
		</tr>
637
		<tr>
638
			<td width="22%" valign="top" class="vncellreq">Source</td>
639
			<td width="78%" class="vtable">
640
				<input name="srcnot" type="checkbox" id="srcnot" value="yes" <?php if ($pconfig['srcnot']) echo "checked"; ?>>
641
				<strong>not</strong>
642
				<br />
643
				Use this option to invert the sense of the match.
644
				<br />
645
				<br />
646
				<table border="0" cellspacing="0" cellpadding="0">
647
					<tr>
648
						<td>Type:&nbsp;&nbsp;</td>
649
						<td>
650 b5c78501 Seth Mos
							<select name="srctype" class="formselect" onChange="typesel_change()">
651 87f0be87 Chris Buechler
<?php
652
								$sel = is_specialnet($pconfig['src']); ?>
653 8ab3e9ed Erik Kristensen
								<option value="any"     <?php if ($pconfig['src'] == "any") { echo "selected"; } ?>>any</option>
654 87f0be87 Chris Buechler
								<option value="single"  <?php if (($pconfig['srcmask'] == 32) && !$sel) { echo "selected"; $sel = 1; } ?>>Single host or alias</option>
655
								<option value="network" <?php if (!$sel) echo "selected"; ?>>Network</option>
656 99ea4439 Scott Ullrich
								<?php if(have_ruleint_access("pptp")): ?>
657 8ab3e9ed Erik Kristensen
								<option value="pptp"    <?php if ($pconfig['src'] == "pptp") { echo "selected"; } ?>>PPTP clients</option>
658 99ea4439 Scott Ullrich
								<?php endif; ?>
659
								<?php if(have_ruleint_access("pppoe")): ?>
660 8c84fe43 Scott Ullrich
								<option value="pppoe"   <?php if ($pconfig['src'] == "pppoe") { echo "selected"; } ?>>PPPoE clients</option>
661 99ea4439 Scott Ullrich
								<?php endif; ?>								
662 8ab3e9ed Erik Kristensen
<?php
663 b7391125 Ermal Luçi
								$ifdisp = get_configured_interface_with_descr();
664 5335811d Ermal Luçi
								foreach ($ifdisp as $ifent => $ifdesc): ?>
665
								<?php if(have_ruleint_access($ifent)): ?>
666
									<option value="<?=$ifent;?>" <?php if ($pconfig['src'] == $ifent) { echo "selected"; } ?>><?=htmlspecialchars($ifdesc);?> subnet</option>
667
									<option value="<?=$ifent;?>ip"<?php if ($pconfig['src'] ==  $ifent . "ip") { echo "selected"; } ?>>
668 b7391125 Ermal Luçi
										<?=$ifdesc?> address
669 e30a5970 Scott Ullrich
									</option>
670 99ea4439 Scott Ullrich
								<?php endif; ?>
671 b7391125 Ermal Luçi
<?php 							endforeach; ?>
672 8ab3e9ed Erik Kristensen
							</select>
673
						</td>
674
					</tr>
675
					<tr>
676
						<td>Address:&nbsp;&nbsp;</td>
677
						<td>
678
							<input autocomplete='off' name="src" type="text" class="formfldalias" id="src" size="20" value="<?php if (!is_specialnet($pconfig['src'])) echo htmlspecialchars($pconfig['src']);?>"> /
679 b5c78501 Seth Mos
							<select name="srcmask" class="formselect" id="srcmask">
680 8ab3e9ed Erik Kristensen
<?php						for ($i = 31; $i > 0; $i--): ?>
681
								<option value="<?=$i;?>" <?php if ($i == $pconfig['srcmask']) echo "selected"; ?>><?=$i;?></option>
682
<?php 						endfor; ?>
683
							</select>
684 bdb7d6e7 Scott Ullrich
						</td>
685 8ab3e9ed Erik Kristensen
					</tr>
686
				</table>
687 22abf2ef Scott Ullrich
				<div id="showadvancedboxspr">
688
					<p>
689 be812936 Scott Ullrich
					<input type="button" onClick="show_source_port_range()" value="Advanced"></input> - Show source port range</a>
690 22abf2ef Scott Ullrich
				</div>
691 8ab3e9ed Erik Kristensen
			</td>
692 e33c8694 Bill Marquette
		</tr>
693 3de8af0e Scott Ullrich
		<tr style="display:none" id="sprtable" name="sprtable">
694 8ab3e9ed Erik Kristensen
			<td width="22%" valign="top" class="vncellreq">Source port range</td>
695
			<td width="78%" class="vtable">
696
				<table border="0" cellspacing="0" cellpadding="0">
697
					<tr>
698
						<td>from:&nbsp;&nbsp;</td>
699
						<td>
700 b5c78501 Seth Mos
							<select name="srcbeginport" class="formselect" onchange="src_rep_change();ext_change()">
701 8ab3e9ed Erik Kristensen
								<option value="">(other)</option>
702
								<option value="any" <?php $bfound = 0; if ($pconfig['srcbeginport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
703
<?php 							foreach ($wkports as $wkport => $wkportdesc): ?>
704
									<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['srcbeginport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option>
705
<?php 							endforeach; ?>
706 8c84fe43 Scott Ullrich
							</select>
707 8ab3e9ed Erik Kristensen
							<input autocomplete='off' class="formfldalias" name="srcbeginport_cust" id="srcbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['srcbeginport']) echo $pconfig['srcbeginport']; ?>">
708
						</td>
709
					</tr>
710
					<tr>
711
						<td>to:</td>
712
						<td>
713 b5c78501 Seth Mos
							<select name="srcendport" class="formselect" onchange="ext_change()">
714 8ab3e9ed Erik Kristensen
								<option value="">(other)</option>
715
								<option value="any" <?php $bfound = 0; if ($pconfig['srcendport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
716
<?php							foreach ($wkports as $wkport => $wkportdesc): ?>
717
									<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['srcendport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option>
718
<?php							endforeach; ?>
719 8c84fe43 Scott Ullrich
							</select>
720 8ab3e9ed Erik Kristensen
							<input autocomplete='off' class="formfldalias" name="srcendport_cust" id="srcendport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['srcendport']) echo $pconfig['srcendport']; ?>">
721
						</td>
722
					</tr>
723
				</table>
724
				<br />
725 5548a077 Scott Ullrich
				<span class="vexpl">Specify the port or port range for the source of the packet for this rule. This is usually not equal to the destination port range (and is often &quot;any&quot;). <br /> Hint: you can leave the <em>'to'</em> field empty if you only want to filter a single port</span><br/>
726 67199e71 Scott Ullrich
				<span class="vexpl"><B>NOTE:</B> You will not need to enter anything here in 99.99999% of the circumstances.  If you're unsure, do not enter anything here!</span>
727 8ab3e9ed Erik Kristensen
			</td>
728 8c84fe43 Scott Ullrich
		</tr>
729 8ab3e9ed Erik Kristensen
		<tr>
730 f281e32e Chris Buechler
			<td width="22%" valign="top" class="vncell">Source OS</td>
731 8ab3e9ed Erik Kristensen
			<td width="78%" class="vtable">OS Type:&nbsp;
732 b5c78501 Seth Mos
				<select name="os" id="os" class="formselect">
733 8ab3e9ed Erik Kristensen
<?php
734
		           $ostypes = array(
735
						 "" => "any",
736
		                 "AIX" => "AIX",
737
		                 "Linux" => "Linux",
738
		                 "FreeBSD" => "FreeBSD",
739
		                 "NetBSD" => "NetBSD",
740
		                 "OpenBSD" => "OpenBSD",
741
		                 "Solaris" => "Solaris",
742
		                 "MacOS" => "MacOS",
743
		                 "Windows" => "Windows",
744 59d62b6c Scott Ullrich
		                 "Novell" => "Novell",
745
		                 "NMAP" => "NMAP"
746 8ab3e9ed Erik Kristensen
		           );
747
748
					foreach ($ostypes as $ostype => $descr): ?>
749
						<option value="<?=$ostype;?>" <?php if ($ostype == $pconfig['os']) echo "selected"; ?>><?=htmlspecialchars($descr);?></option>
750
<?php				endforeach; ?>
751
				</select>
752
				<br />
753
				Note: this only works for TCP rules
754
			</td>
755 5ba18897 Scott Ullrich
		</tr>
756 8ab3e9ed Erik Kristensen
		<tr>
757
			<td width="22%" valign="top" class="vncellreq">Destination</td>
758
			<td width="78%" class="vtable">
759
				<input name="dstnot" type="checkbox" id="dstnot" value="yes" <?php if ($pconfig['dstnot']) echo "checked"; ?>>
760
				<strong>not</strong>
761
					<br />
762
				Use this option to invert the sense of the match.
763
					<br />
764
					<br />
765
				<table border="0" cellspacing="0" cellpadding="0">
766
					<tr>
767
						<td>Type:&nbsp;&nbsp;</td>
768
						<td>
769 b5c78501 Seth Mos
							<select name="dsttype" class="formselect" onChange="typesel_change()">
770 87f0be87 Chris Buechler
<?php
771
								$sel = is_specialnet($pconfig['dst']); ?>
772 8ab3e9ed Erik Kristensen
								<option value="any" <?php if ($pconfig['dst'] == "any") { echo "selected"; } ?>>any</option>
773 87f0be87 Chris Buechler
								<option value="single" <?php if (($pconfig['dstmask'] == 32) && !$sel) { echo "selected"; $sel = 1; } ?>>Single host or alias</option>
774
								<option value="network" <?php if (!$sel) echo "selected"; ?>>Network</option>
775 99ea4439 Scott Ullrich
								<?php if(have_ruleint_access("wan")): ?>
776 76934b05 Scott Ullrich
								<option value="wanip" <?php if ($pconfig['dst'] == "wanip") { echo "selected"; } ?>>WAN address</option>
777 99ea4439 Scott Ullrich
								<?php endif; ?>
778
								<?php if(have_ruleint_access("lan")): ?>
779 acb31d29 Scott Ullrich
								<option value="lanip" <?php if ($pconfig['dst'] == "lanip") { echo "selected"; } ?>>LAN address</option>
780 99ea4439 Scott Ullrich
								<?php endif; ?>
781
								<?php if(have_ruleint_access("lan")): ?>
782 8ab3e9ed Erik Kristensen
								<option value="lan" <?php if ($pconfig['dst'] == "lan") { echo "selected"; } ?>>LAN subnet</option>
783 99ea4439 Scott Ullrich
								<?php endif; ?>
784
								<?php if(have_ruleint_access("pptp")): ?>
785 8ab3e9ed Erik Kristensen
								<option value="pptp" <?php if ($pconfig['dst'] == "pptp") { echo "selected"; } ?>>PPTP clients</option>
786 99ea4439 Scott Ullrich
								<?php endif; ?>
787
								<?php if(have_ruleint_access("pppoe")): ?>
788 8ab3e9ed Erik Kristensen
								<option value="pppoe" <?php if ($pconfig['dst'] == "pppoe") { echo "selected"; } ?>>PPPoE clients</option>
789 99ea4439 Scott Ullrich
								<?php endif; ?>								
790
								
791 b7391125 Ermal Luçi
792
<?php 							foreach ($ifdisp as $if => $ifdesc): ?>
793
								<?php if(have_ruleint_access($if)): ?>
794
									<option value="<?=$if;?>" <?php if ($pconfig['dst'] == $if) { echo "selected"; } ?>><?=htmlspecialchars($ifdesc);?> subnet</option>
795
									<option value="<?=$if;?>ip"<?php if ($pconfig['dst'] == $if . "ip") { echo "selected"; } ?>>
796
										<?=$ifdesc;?> address
797 cbff71a1 Scott Ullrich
									</option>
798 99ea4439 Scott Ullrich
								<?php endif; ?>
799 b7391125 Ermal Luçi
<?php 							endforeach; ?>
800 8ab3e9ed Erik Kristensen
							</select>
801
						</td>
802
					</tr>
803
					<tr>
804
						<td>Address:&nbsp;&nbsp;</td>
805
						<td>
806
							<input name="dst" type="text" class="formfldalias" id="dst" size="20" value="<?php if (!is_specialnet($pconfig['dst'])) echo htmlspecialchars($pconfig['dst']);?>">
807
							/
808 b5c78501 Seth Mos
							<select name="dstmask" class="formselect" id="dstmask">
809 8ab3e9ed Erik Kristensen
<?php
810
							for ($i = 31; $i > 0; $i--): ?>
811
								<option value="<?=$i;?>" <?php if ($i == $pconfig['dstmask']) echo "selected"; ?>><?=$i;?></option>
812
<?php						endfor; ?>
813
							</select>
814
						</td>
815
					</tr>
816
				</table>
817 5ba18897 Scott Ullrich
818 8ab3e9ed Erik Kristensen
			</td>
819
		</tr>
820 3de8af0e Scott Ullrich
		<tr id="dprtr" name="dprtr">
821 8ab3e9ed Erik Kristensen
			<td width="22%" valign="top" class="vncellreq">Destination port range </td>
822
			<td width="78%" class="vtable">
823
				<table border="0" cellspacing="0" cellpadding="0">
824
					<tr>
825
						<td>from:&nbsp;&nbsp;</td>
826
						<td>
827 b5c78501 Seth Mos
							<select name="dstbeginport" class="formselect" onchange="dst_rep_change();ext_change()">
828 8ab3e9ed Erik Kristensen
								<option value="">(other)</option>
829
								<option value="any" <?php $bfound = 0; if ($pconfig['dstbeginport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
830
<?php 							foreach ($wkports as $wkport => $wkportdesc): ?>
831
									<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['dstbeginport']) { echo "selected"; $bfound = 1; }?>><?=htmlspecialchars($wkportdesc);?></option>
832
<?php 							endforeach; ?>
833
							</select>
834
							<input autocomplete='off' class="formfldalias" name="dstbeginport_cust" id="dstbeginport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['dstbeginport']) echo $pconfig['dstbeginport']; ?>">
835
						</td>
836
					</tr>
837
					<tr>
838
						<td>to:</td>
839
						<td>
840 b5c78501 Seth Mos
							<select name="dstendport" class="formselect" onchange="ext_change()">
841 8ab3e9ed Erik Kristensen
								<option value="">(other)</option>
842
								<option value="any" <?php $bfound = 0; if ($pconfig['dstendport'] == "any") { echo "selected"; $bfound = 1; } ?>>any</option>
843
<?php							foreach ($wkports as $wkport => $wkportdesc): ?>
844
									<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['dstendport']) { echo "selected"; $bfound = 1; } ?>><?=htmlspecialchars($wkportdesc);?></option>
845
<?php 							endforeach; ?>
846 8c84fe43 Scott Ullrich
							</select>
847 8ab3e9ed Erik Kristensen
							<input autocomplete='off' class="formfldalias" name="dstendport_cust" id="dstendport_cust" type="text" size="5" value="<?php if (!$bfound && $pconfig['dstendport']) echo $pconfig['dstendport']; ?>">
848
						</td>
849
					</tr>
850
				</table>
851
				<br />
852
				<span class="vexpl">
853
					Specify the port or port range for the destination of the packet for this rule.
854
						<br />
855
					Hint: you can leave the <em>'to'</em> field empty if you only want to filter a single port
856
				</span>
857
			</td>
858
		</tr>
859 c5fc1b2e Ermal Luçi
                <tr>
860
                        <td width="22%" valign="top" class="vncellreq">Diffserv Code Point</td>
861
                        <td width="78%" class="vtable">
862
                                <input name="dscp" id="dscp" value="<?=htmlspecialchars($pconfig['dscp']);?>">
863
                                        <br />
864
                                <span class="vexpl">Valid values are: af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, EF, 1-64, 0x04-0xfc.</span>
865
                        </td>
866
                </tr>
867 8ab3e9ed Erik Kristensen
		<tr>
868
			<td width="22%" valign="top" class="vncellreq">Log</td>
869
			<td width="78%" class="vtable">
870
				<input name="log" type="checkbox" id="log" value="yes" <?php if ($pconfig['log']) echo "checked"; ?>>
871
				<strong>Log packets that are handled by this rule</strong>
872
					<br />
873
				<span class="vexpl">Hint: the firewall has limited local log space. Don't turn on logging for everything. If you want to do a lot of logging, consider using a remote syslog server (see the <a href="diag_logs_settings.php">Diagnostics: System logs: Settings</a> page).</span>
874
			</td>
875
		</tr>
876 661aed33 Ermal Luçi
		<tr>
877 e6db3f58 Ermal Luçi
			<td width="22%" valign="top" class="vncell">Advanced Options</td>
878
			<td width="78%" class="vtable">
879
			<div id="aoadv" name="aoadv">
880
				<input type="button" onClick="show_aodiv();" value="Advanced"> - Show advanced options
881
			</div>
882
			<div id="aodivmain" name="aodivmain" style="display:none">
883 661aed33 Ermal Luçi
884 775ccea3 Ermal Luci
                                <input type="checkbox" id="allowopts" value="yes" name="allowopts"<?php if($pconfig['allowopts'] == true) echo " checked"; ?>>
885
                                <br/><span class="vexpl"><?=gettext("This allows packets with ip options to pass otherwise they are blocked by default i.e. with multicast routing/proxing.");?>
886
				</span><p>
887 661aed33 Ermal Luçi
                                <input name="tag" id="tag" value="<?=htmlspecialchars($pconfig['tag']);?>">
888 ad3979f2 Ermal Luçi
                                <br /><span class="vexpl"><?=gettext("You can mark a packet matching this rule and use this mark to match on other nat/filter rules. It is called <b>Policy filtering</b>");?>
889 661aed33 Ermal Luçi
                                </span><p>
890 ad3979f2 Ermal Luçi
                                <input name="tagged" id="tagged" value="<?=htmlspecialchars($pconfig['tagged']);?>">
891
                                <br /><span class="vexpl"><?=gettext("You can match packet on a mark placed before on another rule.")?>
892 661aed33 Ermal Luçi
                                </span> <p>
893 8ab3e9ed Erik Kristensen
				<input name="max-src-nodes" id="max-src-nodes" value="<?php echo $pconfig['max-src-nodes'] ?>"><br> Simultaneous client connection limit<p>
894
				<input name="max-src-states" id="max-src-states" value="<?php echo $pconfig['max-src-states'] ?>"><br> Maximum state entries per host<p>
895
				<input name="max-src-conn-rate" id="max-src-conn-rate" value="<?php echo $pconfig['max-src-conn-rate'] ?>"> /
896
				<select name="max-src-conn-rates" id="max-src-conn-rates">
897
					<option value=""<?php if(intval($pconfig['max-src-conn-rates']) < 1) echo " selected"; ?>></option>
898
<?php				for($x=1; $x<255; $x++) {
899
						if($x == $pconfig['max-src-conn-rates']) $selected = " selected"; else $selected = "";
900
						echo "<option value=\"{$x}\"{$selected}>{$x}</option>\n";
901
					} ?>
902 47042140 Scott Ullrich
				</select><br />
903 8ab3e9ed Erik Kristensen
				Maximum new connections / per second
904 47042140 Scott Ullrich
				<p>
905
906
				<input name="statetimeout" value="<?php echo $pconfig['statetimeout'] ?>"><br>
907 3906617b Scott Ullrich
				State Timeout in seconds
908 47042140 Scott Ullrich
				<p />
909
910 8ab3e9ed Erik Kristensen
				<p><strong>NOTE: Leave these fields blank to disable this feature.</strong>
911 197b2a47 Scott Ullrich
			  </div>
912 8ab3e9ed Erik Kristensen
			</td>
913
		</tr>
914
		<tr>
915
			<td width="22%" valign="top" class="vncell">State Type</td>
916
			<td width="78%" class="vtable">
917 f6970b2f Scott Ullrich
				<div id="showadvstatebox">
918
					<input type="button" onClick="show_advanced_state()" value="Advanced"></input> - Show state</a>
919
				</div>
920
				<div id="showstateadv" style="display:none">
921
					<select name="statetype">
922
						<option value="keep state" <?php if(!isset($pconfig['statetype']) or $pconfig['statetype'] == "keep state") echo "selected"; ?>>keep state</option>
923
						<option value="synproxy state"<?php if($pconfig['statetype'] == "synproxy state")  echo "selected"; ?>>synproxy state</option>
924
						<option value="none"<?php if($pconfig['statetype'] == "none") echo "selected"; ?>>none</option>
925
					</select><br>HINT: Select which type of state tracking mechanism you would like to use.  If in doubt, use keep state.
926
					<p>
927
					<table width="90%">
928 c62ff4e7 Chris Buechler
						<tr><td width="25%"><ul><li>keep state</li></td><td>Works with all IP protocols.</ul></td></tr>
929 8eb08ba7 Chris Buechler
						<tr><td width="25%"><ul><li>synproxy state</li></td><td>Proxies incoming TCP connections to help protect servers from spoofed TCP SYN floods. This option includes the functionality of keep state and modulate state combined.</ul></td></tr>
930
						<tr><td width="25%"><ul><li>none</li></td><td>Do not use state mechanisms to keep track.  This is only useful if you're doing advanced queueing in certain situations.  Please check the documentation.</ul></td></tr>
931 f6970b2f Scott Ullrich
					</table>
932
					</p>
933
			  </div>
934 8ab3e9ed Erik Kristensen
			</td>
935
		</tr>
936 10f21e70 Scott Ullrich
		<tr>
937
			<td width="22%" valign="top" class="vncell">No XMLRPC Sync</td>
938
			<td width="78%" class="vtable">
939 c32518fa Scott Ullrich
				<input type="checkbox" name="nosync"<?php if($pconfig['nosync']) echo " CHECKED"; ?>><br>
940 782c65b8 Scott Ullrich
				HINT: This prevents the rule from automatically syncing to other carp members.
941 10f21e70 Scott Ullrich
			</td>
942 8c84fe43 Scott Ullrich
		</tr>
943 615b27bc Scott Dale
		<?php
944
			//build list of schedules
945
			$schedules = array();
946
			$schedules[] = "none";//leave none to leave rule enabled all the time
947 a60fd0cb Scott Ullrich
			if(is_array($config['schedules']['schedule'])) {
948
				foreach ($config['schedules']['schedule'] as $schedule) {
949
					if ($schedule['name'] <> "")
950
						$schedules[] = $schedule['name'];
951
				}
952
			}
953 615b27bc Scott Dale
		?>
954
		<tr>
955
			<td width="22%" valign="top" class="vncell">Schedule</td>
956
			<td width="78%" class="vtable">
957
				<select name='sched'>
958
<?php
959
				foreach($schedules as $schedule) {
960
					if($schedule == $pconfig['sched']) {
961
						$selected = " SELECTED";
962
					} else {
963
						$selected = "";
964
					}
965
					if ($schedule == "none") {
966
						echo "<option value=\"\" {$selected}>{$schedule}</option>\n";
967
					} else {
968
						echo "<option value=\"{$schedule}\" {$selected}>{$schedule}</option>\n";
969
					}
970
				}?>
971
				</select>
972 49decb66 Scott Ullrich
				<p>Leave as 'none' to leave the rule enabled all the time.</p>
973 615b27bc Scott Dale
			</td>
974
		</tr>
975
		
976 8ab3e9ed Erik Kristensen
<?php
977 82628210 Scott Ullrich
			/* build a list of gateways */
978
			$gateways = array();
979 615b27bc Scott Dale
			$gateways[] = "default"; // default to don't use this feature :)
980 3d81372f Chris Buechler
			if (is_array($config['gateways']['gateway_item'])) {
981
				foreach($config['gateways']['gateway_item'] as $gw_item) {
982
				if($gw_item['gateway'] <> "")
983
					$gateways[] = $gw_item['name'];
984
				}
985 82628210 Scott Ullrich
			}
986 3d81372f Chris Buechler
			
987 8ab3e9ed Erik Kristensen
?>
988 82628210 Scott Ullrich
		<tr>
989 8ab3e9ed Erik Kristensen
			<td width="22%" valign="top" class="vncell">Gateway</td>
990
			<td width="78%" class="vtable">
991
				<select name='gateway'>
992
<?php
993 82628210 Scott Ullrich
				foreach($gateways as $gw) {
994 0581660c Scott Ullrich
					if($gw == "") 
995
						continue;
996 e6c0da7c Scott Ullrich
					if($gw == $pconfig['gateway']) {
997 82628210 Scott Ullrich
						$selected = " SELECTED";
998 e6c0da7c Scott Ullrich
					} else {
999 82628210 Scott Ullrich
						$selected = "";
1000 e6c0da7c Scott Ullrich
					}
1001
					if ($gw == "default") {
1002 8c84fe43 Scott Ullrich
						echo "<option value=\"\" {$selected}>{$gw}</option>\n";
1003 e6c0da7c Scott Ullrich
					} else {
1004 d9720602 Seth Mos
						$gwip = lookup_gateway_ip_by_name($gw);
1005
						echo "<option value=\"{$gw}\" {$selected}>{$gw} - {$gwip}</option>\n";
1006 e6c0da7c Scott Ullrich
					}
1007
				}
1008 e11202d5 Seth Mos
				/* add gateway groups to the list */
1009
				if (is_array($config['gateways']['gateway_group'])) {
1010
					foreach($config['gateways']['gateway_group'] as $gw_group) {
1011
						if($gw_group['name'] == "")
1012 0581660c Scott Ullrich
							continue;
1013 e11202d5 Seth Mos
						if($pconfig['gateway'] == $gw_group['name']) {
1014
							echo "<option value=\"{$gw_group['name']}\" SELECTED>{$gw_group['name']}</option>\n";
1015 a68bd38b Scott Ullrich
						} else {
1016 e11202d5 Seth Mos
							echo "<option value=\"{$gw_group['name']}\">{$gw_group['name']}</option>\n";
1017 a68bd38b Scott Ullrich
						}
1018 8c84fe43 Scott Ullrich
					}
1019 82628210 Scott Ullrich
				}
1020 b7391125 Ermal Luçi
				$iflist = get_configured_interface_with_descr();
1021 5335811d Ermal Luçi
				foreach ($iflist as $ifent => $ifdesc) {
1022 f1f60c92 Ermal Luçi
					if (in_array($config['interfaces'][$ifent]['ipaddr'],
1023
						 array("dhcp", "pppoe", "pptp"))) {
1024 5335811d Ermal Luçi
						if ($pconfig['gateway'] == $ifent) {
1025 4443d4d6 Scott Ullrich
							$selected = " SELECTED";
1026 1fda0968 Scott Ullrich
						} else {
1027
							$selected = "";
1028
						}
1029 b7391125 Ermal Luçi
						if($ifdesc <> "") 
1030 5335811d Ermal Luçi
							echo "<option value=\"{$ifent}\" {$selected}>".strtoupper($if)." - {$ifdesc}</option>\n";
1031 1fda0968 Scott Ullrich
					}
1032
				}
1033 8ab3e9ed Erik Kristensen
?>
1034
				</select>
1035 58a4eecd Bill Marquette
				<p><strong>Leave as 'default' to use the system routing table.  Or choose a gateway to utilize policy based routing.</strong></p>
1036 8ab3e9ed Erik Kristensen
			</td>
1037
		</tr>
1038 a5fd67e1 Ermal Luçi
		<tr>
1039
			<td width="22%" valign="top" class="vncell">In/Out</td>
1040
			<td width="78%" class="vtable">
1041
			<select name="dnpipe">
1042
<?php
1043
		if (!is_array($dnqlist))
1044
			$dnqlist = array();
1045
		echo "<option value=\"none\"";
1046
		if (!$dnqselected) echo " SELECTED";
1047
		echo " >none</option>";
1048
		foreach ($dnqlist as $dnq => $dnqkey) {
1049
			if($dnq == "")
1050
				continue;
1051
			echo "<option value=\"$dnqkey\"";
1052
			if ($dnqkey == $pconfig['dnpipe']) {
1053
				$dnqselected = 1;
1054
				echo " SELECTED";
1055
			}
1056
			echo ">{$dnq}</option>"; 
1057
		}
1058
?>
1059
			</select> / 			
1060
			<select name="pdnpipe">
1061
<?php
1062
		$dnqselected = 0;
1063
		echo "<option value=\"none\"";
1064
		if (!$dnqselected) echo " SELECTED";
1065
		echo " >none</option>";
1066
		foreach ($dnqlist as $dnq => $dnqkey) {
1067
			if($dnq == "")
1068
				continue;
1069
			echo "<option value=\"$dnqkey\"";
1070
			if ($dnqkey == $pconfig['pdnpipe']) {
1071
				$dnqselected = 1;
1072
				echo " SELECTED";
1073
			}
1074
			echo ">{$dnq}</option>"; 
1075
		}
1076
?>
1077
			</select>
1078
				<br />
1079
				<span class="vexpl">Choose the Out queue/Virtual interface only if you have selected In too. <br/> The Out selection is applied to traffic going out the interface the rule is created, In is the incoming one. <br/> If you are creating a rule on the Floating tab if the direction is In then the same rules apply, if the direction is out the selections are reverted Out is for incoming and In is for outgoing and if you do not select any direction use only the In since the Out selection does not make sense in there to prevent oddities.</span>
1080
			</td>
1081
		</tr>
1082
1083 197bfe96 Ermal Luçi
		<tr>
1084
			<td width="22%" valign="top" class="vncell">Ackqueue/Queue</td>
1085
			<td width="78%" class="vtable">
1086
			<select name="ackqueue">
1087
<?php
1088 21a0464c Ermal Luçi
		if (!is_array($qlist))
1089
			$qlist = array();
1090 cca8d74e Seth Mos
		echo "<option value=\"none\"";
1091
		if (!$qselected) echo " SELECTED";
1092
		echo " >none</option>";
1093 21a0464c Ermal Luçi
		foreach ($qlist as $q => $qkey) {
1094 cca8d74e Seth Mos
			if($q == "")
1095
				continue;
1096 197bfe96 Ermal Luçi
			echo "<option value=\"$q\"";
1097
			if ($q == $pconfig['ackqueue']) {
1098
				$qselected = 1;
1099
				echo " SELECTED";
1100
			}
1101
			echo ">{$q}</option>"; 
1102
		}
1103
?>
1104
			</select> / 			
1105
			<select name="defaultqueue">
1106
<?php
1107
		$qselected = 0;
1108 cca8d74e Seth Mos
		echo "<option value=\"none\"";
1109
		if (!$qselected) echo " SELECTED";
1110
		echo " >none</option>";
1111 21a0464c Ermal Luçi
		foreach ($qlist as $q => $qkey) {
1112 cca8d74e Seth Mos
			if($q == "")
1113
				continue;
1114 197bfe96 Ermal Luçi
			echo "<option value=\"$q\"";
1115
			if ($q == $pconfig['defaultqueue']) {
1116
				$qselected = 1;
1117
				echo " SELECTED";
1118
			}
1119
			echo ">{$q}</option>"; 
1120
		}
1121
?>
1122
			</select>
1123
				<br />
1124
				<span class="vexpl">Choose the Acknowledge Queue only if you have selected Queue.</span>
1125
			</td>
1126
		</tr>
1127 7e50413c Ermal Luçi
		<tr>
1128
			<td width="22%" valign="top" class="vncell">Layer7</td>
1129
			<td width="78%" class="vtable">
1130
			<select name="l7container">
1131
<?php
1132
		if (!is_array($l7clist))
1133
			$dnqlist = array();
1134
		echo "<option value=\"none\"";
1135
		echo " >none</option>";
1136
		foreach ($l7clist as $l7ckey) {
1137
			echo "<option value=\"{$l7ckey}\"";
1138
			if ($l7ckey == $pconfig['l7container']) {
1139
				echo " SELECTED";
1140
			}
1141
			echo ">{$l7ckey}</option>"; 
1142
		}
1143
?>
1144
			</select>			
1145
				<br/>
1146
				<span class="vexpl">Choose a Layer7 container to apply application protocol inspection rules.
1147
				This rule are valid for tcp and udp protocols for now.</span>
1148
			</td>
1149
		</tr>
1150 bca8e0ec Scott Ullrich
		<tr>
1151
			<td width="22%" valign="top" class="vncell">Description</td>
1152
			<td width="78%" class="vtable">
1153 b5c78501 Seth Mos
				<input name="descr" type="text" class="formfld unknown" id="descr" size="52" maxlength="52" value="<?=htmlspecialchars($pconfig['descr']);?>">
1154 bca8e0ec Scott Ullrich
				<br />
1155 586293d1 Scott Ullrich
				<span class="vexpl">You may enter a description here for your reference.</span>
1156 bca8e0ec Scott Ullrich
			</td>
1157
		</tr>
1158 8ab3e9ed Erik Kristensen
		<tr>
1159
			<td width="22%" valign="top">&nbsp;</td>
1160
			<td width="78%">
1161
				<input name="Submit" type="submit" class="formbtn" value="Save">  <input type="button" class="formbtn" value="Cancel" onclick="history.back()">
1162
<?php			if (isset($id) && $a_filter[$id]): ?>
1163
					<input name="id" type="hidden" value="<?=$id;?>">
1164
<?php 			endif; ?>
1165
				<input name="after" type="hidden" value="<?=$after;?>">
1166
			</td>
1167 82628210 Scott Ullrich
		</tr>
1168 8ab3e9ed Erik Kristensen
	</table>
1169 5b237745 Scott Ullrich
</form>
1170
<script language="JavaScript">
1171
<!--
1172 8ab3e9ed Erik Kristensen
	ext_change();
1173
	typesel_change();
1174
	proto_change();
1175 19757279 Scott Ullrich
1176
<?php
1177 8ab3e9ed Erik Kristensen
	$isfirst = 0;
1178
	$aliases = "";
1179
	$addrisfirst = 0;
1180
	$aliasesaddr = "";
1181
	if($config['aliases']['alias'] <> "" and is_array($config['aliases']['alias']))
1182
		foreach($config['aliases']['alias'] as $alias_name) {
1183
			if(!stristr($alias_name['address'], ".")) {
1184
				if($isfirst == 1) $aliases .= ",";
1185
				$aliases .= "'" . $alias_name['name'] . "'";
1186
				$isfirst = 1;
1187
			} else {
1188
				if($addrisfirst == 1) $aliasesaddr .= ",";
1189
				$aliasesaddr .= "'" . $alias_name['name'] . "'";
1190
				$addrisfirst = 1;
1191
			}
1192 092ac49d Scott Ullrich
		}
1193 19757279 Scott Ullrich
?>
1194
1195 8ab3e9ed Erik Kristensen
	var addressarray=new Array(<?php echo $aliasesaddr; ?>);
1196
	var customarray=new Array(<?php echo $aliases; ?>);
1197 19757279 Scott Ullrich
1198 5b237745 Scott Ullrich
//-->
1199
</script>
1200 8ab3e9ed Erik Kristensen
1201
1202 5b237745 Scott Ullrich
<?php include("fend.inc"); ?>
1203
</body>
1204
</html>