Project

General

Profile

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

    
58
##|+PRIV
59
##|*IDENT=page-diagnostics-resetstate
60
##|*NAME=Diagnostics: Reset states
61
##|*DESCR=Allow access to the 'Diagnostics: Reset states' page.
62
##|*MATCH=diag_resetstate.php*
63
##|-PRIV
64

    
65
require_once("guiconfig.inc");
66
require_once("filter.inc");
67

    
68
if ($_POST) {
69
	$savemsg = "";
70

    
71
	if ($_POST['statetable']) {
72
		filter_flush_state_table();
73
		if ($savemsg) {
74
			$savemsg .= " ";
75
		}
76
		$savemsg .= gettext("The state table has been flushed successfully.");
77
	}
78

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

    
88
$pgtitle = array(gettext("Diagnostics"), gettext("States"), gettext("Reset States"));
89
include("head.inc");
90

    
91
if ($input_errors) {
92
	print_input_errors($input_errors);
93
}
94

    
95
if ($savemsg) {
96
	print_info_box($savemsg, 'success');
97
}
98

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

    
106
$sourcetablehelp = sprintf(gettext('Resetting the source tracking table will remove all source/destination associations. ' .
107
					'This means that the \"sticky\" source/destination association ' .
108
					'will be cleared for all clients.%s' .
109
					'This does not clear active connection states, only source tracking.'), "<br /><br />");
110

    
111
$tab_array = array();
112
$tab_array[] = array(gettext("States"), false, "diag_dump_states.php");
113

    
114
if (isset($config['system']['lb_use_sticky'])) {
115
	$tab_array[] = array(gettext("Source Tracking"), false, "diag_dump_states_sources.php");
116
}
117

    
118
$tab_array[] = array(gettext("Reset States"), true, "diag_resetstate.php");
119
display_top_tabs($tab_array);
120

    
121
$form = new Form(false);
122

    
123
$section = new Form_Section('Select States to Reset');
124

    
125
$section->addInput(new Form_Checkbox(
126
	'statetable',
127
	'State Table',
128
	'Reset the firewall state table',
129
	true
130
))->setHelp($statetablehelp);
131

    
132
if (isset($config['system']['lb_use_sticky'])) {
133
	$section->addInput(new Form_Checkbox(
134
		'sourcetracking',
135
		'Source Tracking',
136
		'Reset firewall source tracking',
137
		true
138
	))->setHelp($sourcetablehelp);
139
}
140

    
141
$form->add($section);
142

    
143
$form->addGlobal(new Form_Button(
144
	'Submit',
145
	'Reset',
146
	null,
147
	'fa-trash'
148
))->addClass('btn-danger');
149

    
150
print $form;
151
?>
152

    
153
<?php include("foot.inc"); ?>
(24-24/225)