Projet

Général

Profil

Télécharger (14,4 ko) Statistiques
| Branche: | Tag: | Révision:

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

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
		// Configure flowtable support from filter.inc
144
		flowtable_configure();
145

    
146
		// Set preferred protocol
147
		prefer_ipv4_or_ipv6();
148

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

    
157
$pgtitle = array(gettext("System"),gettext("Advanced: Networking"));
158
include("head.inc");
159

    
160
?>
161

    
162
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
163
<?php include("fbegin.inc"); ?>
164

    
165
<script type="text/javascript">
166
//<![CDATA[
167

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

    
175
//]]>
176
</script>
177

    
178

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

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

    
347
<?php include("fend.inc"); ?>
348
</body>
349
</html>
(207-207/255)