1
|
#!/usr/local/bin/php
|
2
|
<?php
|
3
|
/* $Id$ */
|
4
|
/*
|
5
|
diag_resetstate.php
|
6
|
Copyright (C) 2004 Scott Ullrich
|
7
|
All rights reserved.
|
8
|
|
9
|
originially part of m0n0wall (http://m0n0.ch/wall)
|
10
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11
|
All rights reserved.
|
12
|
|
13
|
Redistribution and use in source and binary forms, with or without
|
14
|
modification, are permitted provided that the following conditions are met:
|
15
|
|
16
|
1. Redistributions of source code must retain the above copyright notice,
|
17
|
this list of conditions and the following disclaimer.
|
18
|
|
19
|
2. Redistributions in binary form must reproduce the above copyright
|
20
|
notice, this list of conditions and the following disclaimer in the
|
21
|
documentation and/or other materials provided with the distribution.
|
22
|
|
23
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
24
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
25
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
26
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
27
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
POSSIBILITY OF SUCH DAMAGE.
|
33
|
*/
|
34
|
|
35
|
require("guiconfig.inc");
|
36
|
|
37
|
if ($_POST) {
|
38
|
|
39
|
$savemsg = "";
|
40
|
if ($_POST['nattable']) {
|
41
|
filter_flush_nat_table();
|
42
|
$savemsg = "The NAT table has been flushed successfully.";
|
43
|
}
|
44
|
if ($_POST['statetable']) {
|
45
|
filter_flush_state_table();
|
46
|
if ($savemsg)
|
47
|
$savemsg .= " ";
|
48
|
$savemsg .= "The state table has been flushed successfully.";
|
49
|
}
|
50
|
}
|
51
|
|
52
|
$pgtitle = "Diagnostics: Reset state";
|
53
|
include("head.inc");
|
54
|
|
55
|
?>
|
56
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
57
|
<?php include("fbegin.inc"); ?>
|
58
|
<p class="pgtitle"><?=$pgtitle?></p>
|
59
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
60
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
61
|
<form action="diag_resetstate.php" method="post" name="iform" id="iform">
|
62
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
63
|
<tr><td>
|
64
|
<?php
|
65
|
$tab_array = array();
|
66
|
$tab_array[0] = array("States", false, "diag_dump_states.php");
|
67
|
$tab_array[1] = array("Reset States", true, "diag_resetstate.php");
|
68
|
display_top_tabs($tab_array);
|
69
|
?>
|
70
|
</td></tr>
|
71
|
<tr><td class="tabcont">
|
72
|
|
73
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
74
|
<tr>
|
75
|
<td width="22%" valign="top" class="vtable"> </td>
|
76
|
<td width="78%" class="vtable"> <p>
|
77
|
<input name="nattable" type="checkbox" id="nattable" value="yes" checked>
|
78
|
<strong>NAT table</strong><br>
|
79
|
<input name="statetable" type="checkbox" id="statetable" value="yes" checked>
|
80
|
<strong>Firewall state table</strong><br>
|
81
|
<span class="vexpl"><br>
|
82
|
Resetting the state tables will remove all entries from
|
83
|
the corresponding tables. This means that all open connections
|
84
|
will be broken and will have to be re-established. This
|
85
|
may be necessary after making substantial changes to the
|
86
|
firewall and/or NAT rules, especially if there are IP protocol
|
87
|
mappings (e.g. for PPTP or IPv6) with open connections.<br>
|
88
|
<br>
|
89
|
</span><span class="vexpl">The firewall will normally leave
|
90
|
the state tables intact when changing rules.<br>
|
91
|
<br>
|
92
|
NOTE: If you reset the firewall state table, the browser
|
93
|
session may appear to be hung after clicking "Reset".
|
94
|
Simply refresh the page to continue.</span></p>
|
95
|
</td>
|
96
|
</tr>
|
97
|
<tr>
|
98
|
<td width="22%" valign="top"> </td>
|
99
|
<td width="78%">
|
100
|
<input name="Submit" type="submit" class="formbtn" value="Reset">
|
101
|
</td>
|
102
|
</tr>
|
103
|
</table>
|
104
|
</td></tr>
|
105
|
</table>
|
106
|
</form>
|
107
|
<?php include("fend.inc"); ?>
|
108
|
</body>
|
109
|
</html>
|