Project

General

Profile

Download (14.3 KB) Statistics
| Branch: | Tag: | Revision:

univnautes / usr / local / www / system_advanced_network.php @ a1b66bec

1
<?php
2
/*
3
	system_advanced_network.php
4
	part of pfSense
5
	Copyright (C) 2005-2007 Scott Ullrich
6

    
7
	Copyright (C) 2008 Shrew Soft Inc
8

    
9
	originally 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
	pfSense_MODULE:	system
36
*/
37

    
38
##|+PRIV
39
##|*IDENT=page-system-advanced-network
40
##|*NAME=System: Advanced: Network page
41
##|*DESCR=Allow access to the 'System: Advanced: Networking' page.
42
##|*MATCH=system_advanced_network.php*
43
##|-PRIV
44

    
45
require("guiconfig.inc");
46
require_once("functions.inc");
47
require_once("filter.inc");
48
require_once("shaper.inc");
49

    
50

    
51
$pconfig['ipv6nat_enable'] = isset($config['diag']['ipv6nat']['enable']);
52
$pconfig['ipv6nat_ipaddr'] = $config['diag']['ipv6nat']['ipaddr'];
53
$pconfig['ipv6allow'] = isset($config['system']['ipv6allow']);
54
$pconfig['prefer_ipv4'] = isset($config['system']['prefer_ipv4']);
55
$pconfig['polling_enable'] = isset($config['system']['polling']);
56
$pconfig['sharednet'] = $config['system']['sharednet'];
57
$pconfig['disablechecksumoffloading'] = isset($config['system']['disablechecksumoffloading']);
58
$pconfig['disablesegmentationoffloading'] = isset($config['system']['disablesegmentationoffloading']);
59
$pconfig['disablelargereceiveoffloading'] = isset($config['system']['disablelargereceiveoffloading']);
60
$pconfig['flowtable'] = isset($config['system']['flowtable']);
61

    
62
if ($_POST) {
63

    
64
	unset($input_errors);
65
	$pconfig = $_POST;
66

    
67
	if ($_POST['ipv6nat_enable'] && !is_ipaddr($_POST['ipv6nat_ipaddr']))
68
		$input_errors[] = gettext("You must specify an IP address to NAT IPv6 packets.");
69

    
70
	ob_flush();
71
	flush();
72
	if (!$input_errors) {
73

    
74
		if($_POST['ipv6nat_enable'] == "yes") {
75
			$config['diag']['ipv6nat']['enable'] = true;
76
			$config['diag']['ipv6nat']['ipaddr'] = $_POST['ipv6nat_ipaddr'];
77
		} else {
78
			if($config['diag']) {
79
				if($config['diag']['ipv6nat']) {
80
					unset($config['diag']['ipv6nat']['enable']);
81
					unset($config['diag']['ipv6nat']['ipaddr']);
82
				}
83
			}
84
		}
85

    
86
		if($_POST['ipv6allow'] == "yes") {
87
			$config['system']['ipv6allow'] = true;
88
		} else {
89
			unset($config['system']['ipv6allow']);
90
		}
91

    
92
		if($_POST['prefer_ipv4'] == "yes") {
93
			$config['system']['prefer_ipv4'] = true;
94
		} else {
95
			unset($config['system']['prefer_ipv4']);
96
		}
97

    
98
		if($_POST['sharednet'] == "yes") {
99
			$config['system']['sharednet'] = true;
100
			system_disable_arp_wrong_if();
101
		} else {
102
			unset($config['system']['sharednet']);
103
			system_enable_arp_wrong_if();
104
		}
105

    
106
		if($_POST['polling_enable'] == "yes") {
107
			$config['system']['polling'] = true;
108
			setup_polling();
109
		} else {
110
			unset($config['system']['polling']);
111
			setup_polling();
112
		}
113

    
114
		if($_POST['flowtable'] == "yes") {
115
			$config['system']['flowtable'] = $_POST['flowtable'];
116
		} else {
117
			unset($config['system']['flowtable']);
118
		}
119

    
120
		if($_POST['disablechecksumoffloading'] == "yes") {
121
			$config['system']['disablechecksumoffloading'] = true;
122
		} else {
123
			unset($config['system']['disablechecksumoffloading']);
124
		}
125

    
126
		if($_POST['disablesegmentationoffloading'] == "yes") {
127
			$config['system']['disablesegmentationoffloading'] = true;
128
		} else {
129
			unset($config['system']['disablesegmentationoffloading']);
130
		}
131

    
132
		if($_POST['disablelargereceiveoffloading'] == "yes") {
133
			$config['system']['disablelargereceiveoffloading'] = true;
134
		} else {
135
			unset($config['system']['disablelargereceiveoffloading']);
136
		}
137

    
138
		setup_microcode();
139

    
140
		// Write out configuration (config.xml)
141
		write_config();
142

    
143
		// Set preferred protocol
144
		prefer_ipv4_or_ipv6();
145

    
146
		$retval = filter_configure();
147
		if(stristr($retval, "error") <> true)
148
			$savemsg = get_std_save_message(gettext($retval));
149
		else
150
			$savemsg = gettext($retval);
151
	}
152
}
153

    
154
$pgtitle = array(gettext("System"),gettext("Advanced: Networking"));
155
include("head.inc");
156

    
157
?>
158

    
159
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
160
<?php include("fbegin.inc"); ?>
161

    
162
<script type="text/javascript">
163
//<![CDATA[
164

    
165
function enable_change(enable_over) {
166
	if (document.iform.ipv6nat_enable.checked || enable_over)
167
		document.iform.ipv6nat_ipaddr.disabled = 0;
168
	else
169
		document.iform.ipv6nat_ipaddr.disabled = 1;
170
}
171

    
172
//]]>
173
</script>
174

    
175

    
176
<?
177
	if ($input_errors)
178
		print_input_errors($input_errors);
179
	if ($savemsg)
180
		print_info_box($savemsg);
181
?>
182
	<form action="system_advanced_network.php" method="post" name="iform" id="iform">
183
		<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="system advanced newtwork">
184
			<tr>
185
				<td>
186
					<?php
187
						$tab_array = array();
188
						$tab_array[] = array(gettext("Admin Access"), false, "system_advanced_admin.php");
189
						$tab_array[] = array(gettext("Firewall / NAT"), false, "system_advanced_firewall.php");
190
						$tab_array[] = array(gettext("Networking"), true, "system_advanced_network.php");
191
						$tab_array[] = array(gettext("Miscellaneous"), false, "system_advanced_misc.php");
192
						$tab_array[] = array(gettext("System Tunables"), false, "system_advanced_sysctl.php");
193
						$tab_array[] = array(gettext("Notifications"), false, "system_advanced_notifications.php");
194
						display_top_tabs($tab_array);
195
					?>
196
				</td>
197
			</tr>
198
			<tr>
199
				<td id="mainarea">
200
					<div class="tabcont">
201
						<span class="vexpl">
202
						<span class="red">
203
								<strong><?=gettext("NOTE:"); ?>&nbsp;</strong>
204
							</span>
205
							<?=gettext("The options on this page are intended for use by advanced users only."); ?>
206
							<br />
207
						</span>
208
						<br />
209
						<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
210
							<tr>
211
								<td colspan="2" valign="top" class="listtopic"><?=gettext("IPv6 Options"); ?></td>
212
							</tr>
213
							<tr>
214
								<td width="22%" valign="top" class="vncell"><?=gettext("Allow IPv6"); ?></td>
215
								<td width="78%" class="vtable">
216
									<input name="ipv6allow" type="checkbox" id="ipv6allow" value="yes" <?php if ($pconfig['ipv6allow']) echo "checked=\"checked\""; ?> onclick="enable_change(false)" />
217
									<strong><?=gettext("Allow IPv6"); ?></strong><br />
218
									<?=gettext("All IPv6 traffic will be blocked by the firewall unless this box is checked."); ?><br />
219
									<?=gettext("NOTE: This does not disable any IPv6 features on the firewall, it only blocks traffic."); ?><br />
220
									<br />
221
								</td>
222
							</tr>
223
							<tr>
224
								<td width="22%" valign="top" class="vncell"><?=gettext("IPv6 over IPv4 Tunneling"); ?></td>
225
								<td width="78%" class="vtable">
226
									<input name="ipv6nat_enable" type="checkbox" id="ipv6nat_enable" value="yes" <?php if ($pconfig['ipv6nat_enable']) echo "checked=\"checked\""; ?> onclick="enable_change(false)" />
227
									<strong><?=gettext("Enable IPv4 NAT encapsulation of IPv6 packets"); ?></strong><br />
228
									<?=gettext("This provides an RFC 2893 compatibility mechanism ".
229
									"that can be used to tunneling IPv6 packets over IPv4 ".
230
									"routing infrastructures. If enabled, don't forget to ".
231
									"add a firewall rule to permit IPv6 packets."); ?><br />
232
									<br />
233
									<?=gettext("IP address"); ?>&nbsp;:&nbsp;
234
									<input name="ipv6nat_ipaddr" type="text" class="formfld unknown" id="ipv6nat_ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipv6nat_ipaddr']);?>" />
235
								</td>
236
							</tr>
237
							<tr>
238
								<td width="22%" valign="top" class="vncell"><?=gettext("Prefer IPv4 over IPv6"); ?></td>
239
								<td width="78%" class="vtable">
240
									<input name="prefer_ipv4" type="checkbox" id="prefer_ipv4" value="yes" <?php if ($pconfig['prefer_ipv4']) echo "checked=\"checked\""; ?> />
241
									<strong><?=gettext("Prefer to use IPv4 even if IPv6 is available"); ?></strong><br />
242
									<?=gettext("By default, if a hostname resolves IPv6 and IPv4 addresses ".
243
									"IPv6 will be used, if you check this option, IPv4 will be " .
244
									"used instead of IPv6."); ?><br />
245
								</td>
246
							</tr>
247
							<tr>
248
								<td colspan="2" class="list" height="12">&nbsp;</td>
249
							</tr>
250
							<tr>
251
								<td colspan="2" valign="top" class="listtopic"><?=gettext("Network Interfaces"); ?></td>
252
							</tr>
253
							<tr>
254
								<td width="22%" valign="top" class="vncell"><?=gettext("Device polling"); ?></td>
255
								<td width="78%" class="vtable">
256
									<input name="polling_enable" type="checkbox" id="polling_enable" value="yes" <?php if ($pconfig['polling_enable']) echo "checked=\"checked\""; ?> />
257
									<strong><?=gettext("Enable device polling"); ?></strong><br />
258
									<?php printf(gettext("Device polling is a technique that lets the system periodically poll network devices for new data instead of relying on interrupts. This prevents your webConfigurator, SSH, etc. from being inaccessible due to interrupt floods when under extreme load. Generally this is not recommended. Not all NICs support polling; see the %s homepage for a list of supported cards."), $g['product_name']); ?>
259
								</td>
260
							</tr>
261
							<tr>
262
								<td width="22%" valign="top" class="vncell"><?=gettext("Hardware Checksum Offloading"); ?></td>
263
								<td width="78%" class="vtable">
264
									<input name="disablechecksumoffloading" type="checkbox" id="disablechecksumoffloading" value="yes" <?php if (isset($config['system']['disablechecksumoffloading'])) echo "checked=\"checked\""; ?> />
265
									<strong><?=gettext("Disable hardware checksum offload"); ?></strong><br />
266
									<?=gettext("Checking this option will disable hardware checksum offloading. Checksum offloading is broken in some hardware, particularly some Realtek cards. Rarely, drivers may have problems with checksum offloading and some specific NICs."); ?>
267
									<br />
268
									<span class="red"><strong><?=gettext("Note:");?>&nbsp;</strong></span>
269
									<?=gettext("This will take effect after you reboot the machine or re-configure each interface.");?>
270
								</td>
271
							</tr>
272
							<tr>
273
								<td width="22%" valign="top" class="vncell"><?=gettext("Hardware TCP Segmentation Offloading"); ?></td>
274
								<td width="78%" class="vtable">
275
									<input name="disablesegmentationoffloading" type="checkbox" id="disablesegmentationoffloading" value="yes" <?php if (isset($config['system']['disablesegmentationoffloading'])) echo "checked=\"checked\""; ?> />
276
									<strong><?=gettext("Disable hardware TCP segmentation offload"); ?></strong><br />
277
									<?=gettext("Checking this option will disable hardware TCP segmentation offloading (TSO, TSO4, TSO6). This offloading is broken in some hardware drivers, and may impact performance with some specific NICs."); ?>
278
									<br />
279
									<span class="red"><strong><?=gettext("Note:");?>&nbsp;</strong></span>
280
									<?=gettext("This will take effect after you reboot the machine or re-configure each interface.");?>
281
								</td>
282
							</tr>
283
							<tr>
284
								<td width="22%" valign="top" class="vncell"><?=gettext("Hardware Large Receive Offloading"); ?></td>
285
								<td width="78%" class="vtable">
286
									<input name="disablelargereceiveoffloading" type="checkbox" id="disablelargereceiveoffloading" value="yes" <?php if (isset($config['system']['disablelargereceiveoffloading'])) echo "checked=\"checked\""; ?> />
287
									<strong><?=gettext("Disable hardware large receive offload"); ?></strong><br />
288
									<?=gettext("Checking this option will disable hardware large receive offloading (LRO). This offloading is broken in some hardware drivers, and may impact performance with some specific NICs."); ?>
289
									<br />
290
									<span class="red"><strong><?=gettext("Note:");?>&nbsp;</strong></span>
291
									<?=gettext("This will take effect after you reboot the machine or re-configure each interface.");?>
292
								</td>
293
							</tr>
294
							<tr>
295
								<td width="22%" valign="top" class="vncell"><?=gettext("ARP Handling"); ?></td>
296
								<td width="78%" class="vtable">
297
									<input name="sharednet" type="checkbox" id="sharednet" value="yes" <?php if (isset($pconfig['sharednet'])) echo "checked=\"checked\""; ?> />
298
									<strong><?=gettext("Suppress ARP messages"); ?></strong><br />
299
									<?=gettext("This option will suppress ARP log messages when multiple interfaces reside on the same broadcast domain"); ?>
300
								</td>
301
							</tr>
302
<?php
303
/*
304
	$version = get_freebsd_version();
305
	if($version == "8"):
306

    
307
							<tr>
308
								<td colspan="2" class="list" height="12">&nbsp;</td>
309
							</tr>
310
							<tr>
311
								<td colspan="2" valign="top" class="listtopic">Flowtable support</td>
312
							</tr>
313
							<tr>
314
								<td width="22%" valign="top" class="vncell">Enable Flowtable</td>
315
								<td width="78%" class="vtable">
316
									<input name="flowtable" type="checkbox" id="polling_enable" value="yes" <?php if ($pconfig['flowtable']) echo "checked=\"checked\""; ?> />
317
									<strong>Enable flowtable support</strong><br />
318
									Enables infrastructure for caching flows as a means of accelerating L3 and L2 lookups
319
									as well as providing stateful load balancing when used with RADIX_MPATH.<br />
320
								</td>
321
							</tr>
322
<?php endif; ?>
323
*/
324
?>
325
							<tr>
326
								<td colspan="2" class="list" height="12">&nbsp;</td>
327
							</tr>
328
							<tr>
329
								<td width="22%" valign="top">&nbsp;</td>
330
								<td width="78%"><input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /></td>
331
							</tr>
332
						</table>
333
					</div>
334
				</td>
335
			</tr>
336
		</table>
337
	</form>
338
	<script type="text/javascript">
339
	//<![CDATA[
340
		enable_change(false);
341
	//]]>
342
	</script>
343

    
344
<?php include("fend.inc"); ?>
345
</body>
346
</html>
(208-208/256)