Project

General

Profile

Download (8.67 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	system_advanced_misc.php
5
	part of pfSense
6
	Copyright (C) 2005-2007 Scott Ullrich
7

    
8
	Copyright (C) 2008 Shrew Soft Inc
9

    
10
	originally part of m0n0wall (http://m0n0.ch/wall)
11
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
12
	All rights reserved.
13

    
14
	Redistribution and use in source and binary forms, with or without
15
	modification, are permitted provided that the following conditions are met:
16

    
17
	1. Redistributions of source code must retain the above copyright notice,
18
	   this list of conditions and the following disclaimer.
19

    
20
	2. Redistributions in binary form must reproduce the above copyright
21
	   notice, this list of conditions and the following disclaimer in the
22
	   documentation and/or other materials provided with the distribution.
23

    
24
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
25
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
26
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
28
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
	POSSIBILITY OF SUCH DAMAGE.
34
*/
35

    
36
##|+PRIV
37
##|*IDENT=page-system-advanced-misc
38
##|*NAME=System: Advanced: Miscellaneous page
39
##|*DESCR=Allow access to the 'System: Advanced: Miscellaneous' page.
40
##|*MATCH=system_advanced.php*
41
##|-PRIV
42

    
43

    
44
require("guiconfig.inc");
45

    
46
$pconfig['harddiskstandby'] = $config['system']['harddiskstandby'];
47
$pconfig['lb_use_sticky'] = isset($config['system']['lb_use_sticky']);
48
$pconfig['preferoldsa_enable'] = isset($config['ipsec']['preferoldsa']);
49
$pconfig['powerd_enable'] = isset($config['system']['powerd_enable']);
50

    
51
if ($_POST) {
52

    
53
    unset($input_errors);
54
    $pconfig = $_POST;
55

    
56
	ob_flush();
57
	flush();
58

    
59
	if (!$input_errors) {
60

    
61
		if($_POST['harddiskstandby'] <> "") {
62
			$config['system']['harddiskstandby'] = $_POST['harddiskstandby'];
63
			system_set_harddisk_standby();
64
		} else
65
			unset($config['system']['harddiskstandby']);
66

    
67
		if($_POST['lb_use_sticky'] == "yes")
68
			$config['system']['lb_use_sticky'] = true;
69
		else
70
			unset($config['system']['lb_use_sticky']);
71

    
72
		$config['ipsec']['preferoldsa'] = $_POST['preferoldsa_enable'] ? true : false;
73
		$config['system']['powerd_enable'] = $_POST['powerd_enable'] ? true : false;
74

    
75
		write_config();
76

    
77
		$retval = 0;
78
		config_lock();
79
		$retval = filter_configure();
80
		if(stristr($retval, "error") <> true)
81
		    $savemsg = get_std_save_message($retval);
82
		else
83
		    $savemsg = $retval;
84
		config_unlock();
85
		
86
		activate_powerd();
87
	}
88
}
89

    
90
$pgtitle = array("System","Advanced: Miscellaneous");
91
include("head.inc");
92

    
93
?>
94

    
95
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
96
<?php
97
	include("fbegin.inc");
98
	if ($input_errors)
99
		print_input_errors($input_errors);
100
	if ($savemsg)
101
		print_info_box($savemsg);
102
?>
103
	<form action="system_advanced_misc.php" method="post" name="iform" id="iform">
104
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
105
			<tr>
106
				<td>
107
					<?php
108
						$tab_array = array();
109
						$tab_array[] = array("Admin Access", false, "system_advanced_admin.php");
110
						$tab_array[] = array("Firewall / NAT", false, "system_advanced_firewall.php");
111
						$tab_array[] = array("Networking", false, "system_advanced_network.php");
112
						$tab_array[] = array("Miscellaneous", true, "system_advanced_misc.php");
113
						$tab_array[] = array("System Tunables", false, "system_advanced_sysctl.php");
114
						display_top_tabs($tab_array);
115
					?>
116
				</td>
117
			</tr>
118
			<tr>
119
				<td id="mainarea">
120
					<div class="tabcont">
121
						<span class="vexpl">
122
							<span class="red">
123
								<strong>NOTE:&nbsp</strong>
124
							</span>
125
							The options on this page are intended for use by advanced users only.
126
							<br/>
127
						</span>
128
						<br/>
129
						<table width="100%" border="0" cellpadding="6" cellspacing="0">
130
							<tr>
131
								<td colspan="2" valign="top" class="listtopic">Load Balancing</td>
132
							</tr>
133
							<tr>
134
								<td width="22%" valign="top" class="vncell">Load Balancing</td>
135
								<td width="78%" class="vtable">
136
									<input name="lb_use_sticky" type="checkbox" id="lb_use_sticky" value="yes" <?php if ($pconfig['lb_use_sticky']) echo "checked=\"checked\""; ?> />
137
									<strong>Use sticky connections</strong><br/>
138
									Successive connections will be redirected to the servers
139
									in a round-robin manner with connections from the same
140
									source being sent to the same web server. This "sticky
141
									connection" will exist as long as there are states that
142
									refer to this connection. Once the states expire, so will
143
									the sticky connection. Further connections from that host
144
									will be redirected to the next web server in the round
145
									robin.
146
								</td>
147
							</tr>
148
							<tr>
149
								<td colspan="2" class="list" height="12">&nbsp;</td>
150
							</tr>
151
							<tr>
152
								<td colspan="2" valign="top" class="listtopic">Power savings</td>
153
							</tr>
154
							<tr>
155
								<td width="22%" valign="top" class="vncell">PowerD</td>
156
								<td width="78%" class="vtable">
157
									<input name="powerd_enable" type="checkbox" id="powerd_enable" value="yes" <?php if ($pconfig['powerd_enable']) echo "checked"; ?> />
158
									<strong>Use PowerD</strong><br/>
159
									<br />
160
								     The powerd utility monitors the system state and sets various power con-
161
								     trol options accordingly.	It offers three modes (maximum, minimum, and
162
								     adaptive) that can be individually selected while on AC power or batter-
163
								     ies.  The modes maximum, minimum, and adaptive may be abbreviated max,
164
								     min, adp.   Maximum mode chooses the highest performance values.  Minimum 
165
								     mode selects the lowest performance values to get the most power savings.
166
								     Adaptive mode attempts to strike a balance by degrading performance when
167
								     the system appears idle and increasing it when the system is busy.  It
168
								     offers a good balance between a small performance loss for greatly
169
								     increased power savings.  The default mode for pfSense is adaptive.
170
								</td>
171
							</tr>
172
							<tr>
173
								<td colspan="2" class="list" height="12">&nbsp;</td>
174
							</tr>
175
							<tr>
176
								<td colspan="2" valign="top" class="listtopic">IP Security</td>
177
							</tr>
178
							<tr>
179
								<td width="22%" valign="top" class="vncell">Security Assocications</td>
180
								<td width="78%" class="vtable">
181
									<input name="preferoldsa_enable" type="checkbox" id="preferoldsa_enable" value="yes" <?php if ($pconfig['preferoldsa_enable']) echo "checked"; ?> />
182
									<strong>Prefer older IPsec SAs</strong>
183
									<br />
184
									By default, if several SAs match, the newest one is
185
									preferred if it's at least 30 seconds old. Select this
186
									option to always prefer old SAs over new ones.
187
								</td>
188
							</tr>
189
							<tr>
190
								<td colspan="2" class="list" height="12">&nbsp;</td>
191
							</tr>
192
							<?php if($g['platform'] == "pfSenseDISABLED"): ?>
193
							<tr>
194
								<td colspan="2" valign="top" class="listtopic">Hardware Settings</td>
195
							</tr>
196
							<tr>
197
								<td width="22%" valign="top" class="vncell">Hard disk standby time </td>
198
								<td width="78%" class="vtable">
199
									<select name="harddiskstandby" class="formselect">
200
										<?php
201
										 	## Values from ATA-2 http://www.t13.org/project/d0948r3-ATA-2.pdf (Page 66)
202
											$sbvals = explode(" ", "0.5,6 1,12 2,24 3,36 4,48 5,60 7.5,90 10,120 15,180 20,240 30,241 60,242");
203
										?>
204
										<option value="" <?php if(!$pconfig['harddiskstandby']) echo('selected');?>>Always on</option>
205
										<?php
206
											foreach ($sbvals as $sbval):
207
												list($min,$val) = explode(",", $sbval);
208
										?>
209
										<option value="<?=$val;?>" <?php if($pconfig['harddiskstandby'] == $val) echo('selected');?>><?=$min;?> minutes</option>
210
										<?php endforeach; ?>
211
									</select>
212
									<br/>
213
									Puts the hard disk into standby mode when the selected amount of time after the last
214
									access has elapsed. <em>Do not set this for CF cards.</em>
215
								</td>
216
							</tr>
217
							<tr>
218
								<td colspan="2" class="list" height="12">&nbsp;</td>
219
							</tr>
220
							<?php endif; ?>
221

    
222
							<tr>
223
								<td width="22%" valign="top">&nbsp;</td>
224
								<td width="78%">
225
									<input name="Submit" type="submit" class="formbtn" value="Save" />
226
								</td>
227
							</tr>
228
						</table>
229
					</div>
230
				</td>
231
			</tr>
232
		</table>
233
	</form>
234

    
235
<?php include("fend.inc"); ?>
236
</body>
237
</html>
238

    
(162-162/207)