Project

General

Profile

Download (5.44 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	diag_resetstate.php
5
*/
6
/* ====================================================================
7
 *  Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved. 
8
 *  Copyright (c)  2004-2009 Scott Ullrich
9
 *
10
 *  Redistribution and use in source and binary forms, with or without modification, 
11
 *  are permitted provided that the following conditions are met: 
12
 *
13
 *  1. Redistributions of source code must retain the above copyright notice,
14
 *      this list of conditions and the following disclaimer.
15
 *
16
 *  2. Redistributions in binary form must reproduce the above copyright
17
 *      notice, this list of conditions and the following disclaimer in
18
 *      the documentation and/or other materials provided with the
19
 *      distribution. 
20
 *
21
 *  3. All advertising materials mentioning features or use of this software 
22
 *      must display the following acknowledgment:
23
 *      "This product includes software developed by the pfSense Project
24
 *       for use in the pfSense software distribution. (http://www.pfsense.org/). 
25
 *
26
 *  4. The names "pfSense" and "pfSense Project" must not be used to
27
 *       endorse or promote products derived from this software without
28
 *       prior written permission. For written permission, please contact
29
 *       coreteam@pfsense.org.
30
 *
31
 *  5. Products derived from this software may not be called "pfSense"
32
 *      nor may "pfSense" appear in their names without prior written
33
 *      permission of the Electric Sheep Fencing, LLC.
34
 *
35
 *  6. Redistributions of any form whatsoever must retain the following
36
 *      acknowledgment:
37
 *
38
 *  "This product includes software developed by the pfSense Project
39
 *  for use in the pfSense software distribution (http://www.pfsense.org/).
40
  *
41
 *  THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
42
 *  EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43
 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
44
 *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
45
 *  ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
46
 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
47
 *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
48
 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49
 *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
50
 *  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
51
 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52
 *  OF THE POSSIBILITY OF SUCH DAMAGE.
53
 *
54
 *  ====================================================================
55
 *
56
 */
57

    
58
/*
59
	pfSense_MODULE: filter
60
*/
61

    
62
##|+PRIV
63
##|*IDENT=page-diagnostics-resetstate
64
##|*NAME=Diagnostics: Reset state page
65
##|*DESCR=Allow access to the 'Diagnostics: Reset state' page.
66
##|*MATCH=diag_resetstate.php*
67
##|-PRIV
68

    
69
require("guiconfig.inc");
70
require_once("filter.inc");
71

    
72
if ($_POST) {
73
	$savemsg = "";
74

    
75
	if ($_POST['statetable']) {
76
		filter_flush_state_table();
77
		if ($savemsg) {
78
			$savemsg .= " ";
79
		}
80
		$savemsg .= gettext("The state table has been flushed successfully.");
81
	}
82

    
83
	if ($_POST['sourcetracking']) {
84
		mwexec("/sbin/pfctl -F Sources");
85
		if ($savemsg) {
86
			$savemsg .= " <br />";
87
		}
88
		$savemsg .= gettext("The source tracking table has been flushed successfully.");
89
	}
90
}
91

    
92
$pgtitle = array(gettext("Diagnostics"), gettext("Reset state"));
93
include("head.inc");
94

    
95
if ($input_errors)
96
	print_input_errors($input_errors);
97

    
98
if ($savemsg)
99
	print_info_box($savemsg, 'alert-success');
100

    
101
$statetablehelp =	'Resetting the state tables will remove all entries from the corresponding tables. This means that all open connections ' .
102
					'will be broken and will have to be re-established. This may be necessary after making substantial changes to the ' .
103
					'firewall and/or NAT rules, especially if there are IP protocol mappings (e.g. for PPTP or IPv6) with open connections.' .
104
					'<br /><br />' .
105
					'The firewall will normally leave the state tables intact when changing rules.' .
106
					'<br /><br />' .
107
					'<strong>NOTE:</strong> If you reset the firewall state table, the browser session may appear to be hung after clicking &quot;Reset&quot;. ' .
108
					'Simply refresh the page to continue.';
109

    
110
$sourcetablehelp =	'Resetting the source tracking table will remove all source/destination associations. ' .
111
					'This means that the \"sticky\" source/destination association ' .
112
					'will be cleared for all clients.' .
113
					' <br /><br />' .
114
					'This does not clear active connection states, only source tracking.';
115

    
116
$tab_array = array();
117
$tab_array[] = array(gettext("States"), false, "diag_dump_states.php");
118

    
119
if (isset($config['system']['lb_use_sticky']))
120
	$tab_array[] = array(gettext("Source Tracking"), false, "diag_dump_states_sources.php");
121

    
122
$tab_array[] = array(gettext("Reset States"), true, "diag_resetstate.php");
123
display_top_tabs($tab_array);
124

    
125
require_once('classes/Form.class.php');
126

    
127
$resetbtn = new Form_Button(
128
	'Submit',
129
	'Reset'
130
);
131

    
132
$resetbtn->removeClass('btn-primary')->addClass('btn-danger');
133

    
134
$form = new Form($resetbtn);
135

    
136
$section = new Form_Section('Select states to reset');
137

    
138
$section->addInput(new Form_Checkbox(
139
	'statetable',
140
	'State Table',
141
	'Reset the firewall state table',
142
	true
143
))->setHelp($statetablehelp);
144

    
145
if (isset($config['system']['lb_use_sticky'])) {
146
	$section->addInput(new Form_Checkbox(
147
		'sourcetracking',
148
		'Source Tracking',
149
		'Reset firewall source tracking',
150
		true
151
	))->setHelp($sourcetablehelp);
152
}
153

    
154
$form->add($section);
155
print $form;
156
?>
157

    
158
<?php include("foot.inc"); ?>
(34-34/235)