Menu

[r3264]: / trunk / www / system_advanced.php  Maximize  Restore  History

Download this file

195 lines (172 with data), 8.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/usr/local/bin/php
<?php
/*
system_advanced.php
part of FreeNAS (http://www.freenas.org)
Copyright (C) 2005-2008 Olivier Cochard-Labbé <olivier@freenas.org>.
All rights reserved.
Based on m0n0wall (http://m0n0.ch/wall)
Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
require("guiconfig.inc");
$pgtitle = array(gettext("System"), gettext("Advanced"));
$pconfig['disableconsolemenu'] = isset($config['system']['disableconsolemenu']);
$pconfig['disablefirmwarecheck'] = isset($config['system']['disablefirmwarecheck']);
$pconfig['expanddiags'] = isset($config['system']['webgui']['expanddiags']);
$pconfig['disablebeep'] = isset($config['system']['disablebeep']);
$pconfig['tune_enable'] = isset($config['system']['tune']);
$pconfig['zeroconf'] = isset($config['system']['zeroconf']);
$pconfig['powerd'] = isset($config['system']['powerd']);
if ($_POST) {
unset($input_errors);
$pconfig = $_POST;
// Input validation.
if ($_POST['tcpidletimeout'] && !is_numericint($_POST['tcpidletimeout'])) {
$input_errors[] = gettext("The TCP idle timeout must be an integer.");
}
if (!$input_errors) {
// Process system tuning.
if ($_POST['tune_enable']) {
sysctl_tune(1);
} else if (isset($config['system']['tune']) && (!$_POST['tune_enable'])) {
// Simply force a reboot to reset to default values.
// This makes programming easy :-) Also we are sure that
// system will use origin values (maybe default values
// change from one FreeBSD release to the next. This will
// reduce maintenance).
sysctl_tune(0);
touch($d_sysrebootreqd_path);
}
$config['system']['disableconsolemenu'] = $_POST['disableconsolemenu'] ? true : false;
$config['system']['disablefirmwarecheck'] = $_POST['disablefirmwarecheck'] ? true : false;
$config['system']['webgui']['expanddiags'] = $_POST['expanddiags'] ? true : false;
$config['system']['webgui']['noantilockout'] = $_POST['noantilockout'] ? true : false;
$config['system']['disablebeep'] = $_POST['disablebeep'] ? true : false;
$config['system']['tune'] = $_POST['tune_enable'] ? true : false;
$config['system']['zeroconf'] = $_POST['zeroconf'] ? true : false;
$config['system']['powerd'] = $_POST['powerd'] ? true : false;
write_config();
$retval = 0;
if (!file_exists($d_sysrebootreqd_path)) {
config_lock();
$retval |= rc_update_service("powerd");
$retval |= rc_update_service("mdnsresponder");
if (isset($config['system']['tune']))
$retval |= rc_update_service("sysctl");
config_unlock();
}
$savemsg = get_std_save_message($retval);
}
}
function sysctl_tune($mode) {
global $config;
if (!is_array($config['system']['sysctl']['param']))
$config['system']['sysctl']['param'] = array();
array_sort_key($config['system']['sysctl']['param'], "name");
$a_sysctlvar = &$config['system']['sysctl']['param'];
$a_mib = array(
"net.inet.tcp.delayed_ack" => 0,
"net.inet.tcp.sendspace" => 65536,
"net.inet.tcp.recvspace" => 65536,
"net.inet.udp.recvspace" => 65536,
"net.inet.udp.maxdgram" => 57344,
"net.local.stream.recvspace" => 65536,
"net.local.stream.sendspace" => 65536,
"kern.ipc.maxsockbuf" => 2097152,
"kern.ipc.somaxconn" => 8192,
"kern.ipc.nmbclusters" => 32768,
"kern.maxfiles" => 65536,
"kern.maxfilesperproc" => 32768,
"net.inet.tcp.inflight.enable" => 0,
"net.inet.tcp.path_mtu_discovery" => 0
);
switch ($mode) {
case 0:
// Remove system tune MIB's.
while (list($name, $value) = each($a_mib)) {
$id = array_search_ex($name, $a_sysctlvar, "name");
if (false === $id)
continue;
unset($a_sysctlvar[$id]);
}
break;
case 1:
// Add system tune MIB's.
while (list($name, $value) = each($a_mib)) {
$id = array_search_ex($name, $a_sysctlvar, "name");
if (false !== $id)
continue;
$param = array();
$param['name'] = $name;
$param['value'] = $value;
$param['comment'] = gettext("System tuning");
$a_sysctlvar[] = $param;
}
break;
}
}
?>
<?php include("fbegin.inc");?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="tabnavtbl">
<ul id="tabnav">
<li class="tabact"><a href="system_advanced.php" title="<?=gettext("Reload page");?>"><?=gettext("Advanced");?></a></li>
<li class="tabinact"><a href="system_email.php"><?=gettext("Email");?></a></li>
<li class="tabinact"><a href="system_proxy.php"><?=gettext("Proxy");?></a></li>
<li class="tabinact"><a href="system_swap.php"><?=gettext("Swap");?></a></li>
<li class="tabinact"><a href="system_rc.php"><?=gettext("Command scripts");?></a></li>
<li class="tabinact"><a href="system_cron.php"><?=gettext("Cron");?></a></li>
<li class="tabinact"><a href="system_rcconf.php"><?=gettext("rc.conf");?></a></li>
<li class="tabinact"><a href="system_sysctl.php"><?=gettext("sysctl.conf");?></a></li>
</ul>
</td>
</tr>
<tr>
<td class="tabcont">
<form action="system_advanced.php" method="post" name="iform" id="iform">
<?php if ($input_errors) print_input_errors($input_errors);?>
<?php if ($savemsg) print_info_box($savemsg);?>
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Miscellaneous");?></td>
</tr>
<?php html_checkbox("disableconsolemenu", gettext("Console menu"), $pconfig['disableconsolemenu'] ? true : false, gettext("Disable console menu"), gettext("Changes to this option will take effect after a reboot."));?>
<?php if ("full" !== $g['platform']):?>
<?php html_checkbox("disablefirmwarecheck", gettext("Firmware version check"), $pconfig['disablefirmwarecheck'] ? true : false, gettext("Disable firmware version check"), sprintf(gettext("This will cause %s not to check for newer firmware versions when the <a href=%s>%s</a> page is viewed."), get_product_name(), "system_firmware.php", gettext("System").": ".gettext("Firmware")));?>
<?php endif;?>
<?php html_checkbox("expanddiags", gettext("Navigation"), $pconfig['expanddiags'] ? true : false, gettext("Keep diagnostics in navigation expanded"));?>
<?php html_checkbox("disablebeep", gettext("System Beep"), $pconfig['disablebeep'] ? true : false, gettext("Disable speaker beep on startup and shutdown"));?>
<?php html_checkbox("tune_enable", gettext("Tuning"), $pconfig['tune_enable'] ? true : false, gettext("Enable tuning of some kernel variables"));?>
<?php html_checkbox("powerd", gettext("Power Daemon"), $pconfig['powerd'] ? true : false, gettext("Enable the system power control utility"), gettext("The powerd utility monitors the system state and sets various power control options accordingly."));?>
<?php html_checkbox("zeroconf", gettext("Zeroconf/Bonjour"), $pconfig['zeroconf'] ? true : false, gettext("Enable Zeroconf/Bonjour to advertise services of this device"));?>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<?php include("fend.inc");?>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.