Project

General

Profile

Download (17.4 KB) Statistics
| Branch: | Tag: | Revision:
1 03b92764 Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4
	interfaces_opt.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6 03b92764 Scott Ullrich
7 5b237745 Scott Ullrich
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
	All rights reserved.
9 03b92764 Scott Ullrich
10 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12 03b92764 Scott Ullrich
13 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15 03b92764 Scott Ullrich
16 5b237745 Scott Ullrich
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19 03b92764 Scott Ullrich
20 5b237745 Scott Ullrich
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31
32
require("guiconfig.inc");
33
34
unset($index);
35
if ($_GET['index'])
36
	$index = $_GET['index'];
37
else if ($_POST['index'])
38
	$index = $_POST['index'];
39 03b92764 Scott Ullrich
40 5b237745 Scott Ullrich
if (!$index)
41
	exit;
42
43 6cec4795 Scott Ullrich
function remove_bad_chars($string) {
44 ab72b53b Scott Ullrich
	return preg_replace('/[^a-z|_|0-9]/i','',$string);
45 6cec4795 Scott Ullrich
}
46
47 5b237745 Scott Ullrich
$optcfg = &$config['interfaces']['opt' . $index];
48 6cec4795 Scott Ullrich
$optcfg['descr'] = remove_bad_chars($optcfg['descr']);
49 fc959b55 Scott Ullrich
50 9d55fcde Chris Buechler
if(is_array($config['aliases']['alias']))
51
	foreach($config['aliases']['alias'] as $alias) 
52
		if($alias['name'] == $optcfg['descr']) 
53
			$input_errors[] = gettext("Sorry, an alias with the name {$optcfg['descr']} already exists.");
54 18f351c8 Scott Ullrich
55 6cec4795 Scott Ullrich
$pconfig['descr'] = $optcfg['descr'];
56 5b237745 Scott Ullrich
$pconfig['bridge'] = $optcfg['bridge'];
57 03b92764 Scott Ullrich
58 5b237745 Scott Ullrich
$pconfig['enable'] = isset($optcfg['enable']);
59
60 0311dbd5 Scott Ullrich
$pconfig['blockpriv'] = isset($optcfg['blockpriv']);
61
$pconfig['blockbogons'] = isset($optcfg['blockbogons']);
62
$pconfig['spoofmac'] = $optcfg['spoofmac'];
63
$pconfig['mtu'] = $optcfg['mtu'];
64
65 c1ec2c2f Scott Ullrich
$pconfig['disableftpproxy'] = isset($optcfg['disableftpproxy']);
66 99586fca Scott Ullrich
67 5b237745 Scott Ullrich
/* Wireless interface? */
68
if (isset($optcfg['wireless'])) {
69
	require("interfaces_wlan.inc");
70
	wireless_config_init();
71
}
72
73 0311dbd5 Scott Ullrich
if ($optcfg['ipaddr'] == "dhcp") {
74
	$pconfig['type'] = "DHCP";
75 99586fca Scott Ullrich
	$pconfig['dhcphostname'] = $optcfg['dhcphostname'];
76 0311dbd5 Scott Ullrich
} else {
77
	$pconfig['type'] = "Static";
78
	$pconfig['ipaddr'] = $optcfg['ipaddr'];
79
	$pconfig['subnet'] = $optcfg['subnet'];
80
	$pconfig['gateway'] = $optcfg['gateway'];
81
	$pconfig['pointtopoint'] = $optcfg['pointtopoint'];
82
}
83
84 5b237745 Scott Ullrich
if ($_POST) {
85
86
	unset($input_errors);
87
88 8698218d Scott Ullrich
	/* filter out spaces from descriptions  */
89 6cec4795 Scott Ullrich
	$POST['descr'] = remove_bad_chars($POST['descr']);
90 8698218d Scott Ullrich
91 ee968e4f Scott Ullrich
	if($_POST['gateway'] and $pconfig['gateway'] <> $_POST['gateway']) {
92 6fc5bf35 Scott Ullrich
		/* enumerate slbd gateways and make sure we are not creating a route loop */
93
		if(is_array($config['load_balancer']['lbpool'])) {
94
			foreach($config['load_balancer']['lbpool'] as $lbpool) {
95
				if($lbpool['type'] == "gateway") {
96
				    foreach ((array) $lbpool['servers'] as $server) {
97
			            $svr = split("\|", $server);
98 8bddc5b7 Scott Ullrich
			            if($svr[1] == $pconfig['gateway'])  {
99
			            		$_POST['gateway']  = $pconfig['gateway'];
100 de42a08e Scott Ullrich
			            		$input_errors[] = "Cannot change {$svr[1]} gateway.  It is currently referenced by the load balancer pools.";
101 3955baf1 Scott Ullrich
			            		break;
102 8bddc5b7 Scott Ullrich
			            }
103 6fc5bf35 Scott Ullrich
					}
104
				}
105 8bddc5b7 Scott Ullrich
			}
106
			foreach($config['filter']['rule'] as $rule) {
107 423cd2f4 Scott Ullrich
				if($rule['gateway'] == $_POST['gateway']) {
108 3955baf1 Scott Ullrich
	            		$input_errors[] = "Cannot change {$_POST['gateway']} gateway.  It is currently referenced by the filter rules via policy based routing.";
109
	            		break;
110 8bddc5b7 Scott Ullrich
				}
111
			}
112 6fc5bf35 Scott Ullrich
		}
113
	}
114
115 ee968e4f Scott Ullrich
	$pconfig = $_POST;
116
117 5b237745 Scott Ullrich
	/* input validation */
118
	if ($_POST['enable']) {
119 03b92764 Scott Ullrich
120 5b237745 Scott Ullrich
		/* description unique? */
121
		for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
122
			if ($i != $index) {
123
				if ($config['interfaces']['opt' . $i]['descr'] == $_POST['descr']) {
124
					$input_errors[] = "An interface with the specified description already exists.";
125
				}
126
			}
127
		}
128 03b92764 Scott Ullrich
129 5b237745 Scott Ullrich
		if ($_POST['bridge']) {
130
			/* double bridging? */
131
			for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
132
				if ($i != $index) {
133
					if ($config['interfaces']['opt' . $i]['bridge'] == $_POST['bridge']) {
134 62ce3b9a Scott Ullrich
						//$input_errors[] = "Optional interface {$i} " .
135
						//	"({$config['interfaces']['opt' . $i]['descr']}) is already bridged to " .
136
						//	"the specified interface.";
137 5b237745 Scott Ullrich
					} else if ($config['interfaces']['opt' . $i]['bridge'] == "opt{$index}") {
138 62ce3b9a Scott Ullrich
						//$input_errors[] = "Optional interface {$i} " .
139
						//	"({$config['interfaces']['opt' . $i]['descr']}) is already bridged to " .
140
						//	"this interface.";
141 5b237745 Scott Ullrich
					}
142
				}
143
			}
144
			if ($config['interfaces'][$_POST['bridge']]['bridge']) {
145 62ce3b9a Scott Ullrich
				//$input_errors[] = "The specified interface is already bridged to " .
146
				//	"another interface.";
147 5b237745 Scott Ullrich
			}
148
			/* captive portal on? */
149
			if (isset($config['captiveportal']['enable'])) {
150 c2c399a4 Scott Ullrich
				//$input_errors[] = "Interfaces cannot be bridged while the captive portal is enabled.";
151 5b237745 Scott Ullrich
			}
152
		} else {
153 e4065f5b Scott Ullrich
			if ($_POST['type'] <> "DHCP") {
154
				$reqdfields = explode(" ", "descr ipaddr subnet");
155
				$reqdfieldsn = explode(",", "Description,IP address,Subnet bit count");
156
				do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
157
				if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
158
					$input_errors[] = "A valid IP address must be specified.";
159
				}
160
				if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
161
					$input_errors[] = "A valid subnet bit count must be specified.";
162
				}
163
				if($_POST['gateway'] <> "" && !is_ipaddr($_POST['gateway'])) {
164
					$input_errors[] = "A valid gateway must be specified.";
165
				}
166 92b17aed Scott Ullrich
			}
167 5b237745 Scott Ullrich
		}
168 3cb6ab88 Bill Marquette
	        if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
169
			$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
170 0138d492 Scott Ullrich
		}		
171 3a843b96 Scott Ullrich
		if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) {
172
			$input_errors[] = "A valid MAC address must be specified.";
173
		}		
174 5b237745 Scott Ullrich
	}
175 03b92764 Scott Ullrich
176 f691bc2f Scott Ullrich
	if($_POST['mtu']) {
177
		if($_POST['mtu'] < 24 or $_POST['mtu'] > 1501)
178
			$input_errors[] = "A valid MTU is required 24-1500.";
179
	}
180
	
181 5b237745 Scott Ullrich
	/* Wireless interface? */
182
	if (isset($optcfg['wireless'])) {
183
		$wi_input_errors = wireless_config_post();
184
		if ($wi_input_errors) {
185
			$input_errors = array_merge($input_errors, $wi_input_errors);
186
		}
187
	}
188 03b92764 Scott Ullrich
189 5b237745 Scott Ullrich
	if (!$input_errors) {
190 0311dbd5 Scott Ullrich
191 9a6757a1 Scott Ullrich
		$bridge = discover_bridge($optcfg['if'], filter_translate_type_to_real_interface($optcfg['bridge']));
192 0d429e43 Scott Ullrich
		if($bridge <> "-1") {
193 1665e79c Scott Ullrich
			destroy_bridge($bridge);
194 1dd452d6 Chris Buechler
                        setup_bridge();
195 91e8aab2 Scott Ullrich
		}
196
197 99586fca Scott Ullrich
		unset($optcfg['dhcphostname']);
198 c1ec2c2f Scott Ullrich
		unset($optcfg['disableftpproxy']);
199
		
200
		/* per interface pftpx helper */
201
		if($_POST['disableftpproxy'] == "yes") {
202
			$optcfg['disableftpproxy'] = true;
203
			system_start_ftp_helpers();
204
		} else {			
205
			system_start_ftp_helpers();
206
		}		
207 99586fca Scott Ullrich
208 6cec4795 Scott Ullrich
		$optcfg['descr'] = remove_bad_chars($_POST['descr']);
209 5b237745 Scott Ullrich
		$optcfg['bridge'] = $_POST['bridge'];
210
		$optcfg['enable'] = $_POST['enable'] ? true : false;
211 0311dbd5 Scott Ullrich
212
		if ($_POST['type'] == "Static") {
213
			$optcfg['ipaddr'] = $_POST['ipaddr'];
214
			$optcfg['subnet'] = $_POST['subnet'];
215
			$optcfg['gateway'] = $_POST['gateway'];
216
			if (isset($optcfg['ispointtopoint']))
217
				$optcfg['pointtopoint'] = $_POST['pointtopoint'];
218
		} else if ($_POST['type'] == "DHCP") {
219
			$optcfg['ipaddr'] = "dhcp";
220
			$optcfg['dhcphostname'] = $_POST['dhcphostname'];
221
		}
222 a12d2145 Scott Ullrich
223 2dfb79a4 Scott Ullrich
		$optcfg['blockpriv'] = $_POST['blockpriv'] ? true : false;
224
		$optcfg['blockbogons'] = $_POST['blockbogons'] ? true : false;
225
		$optcfg['spoofmac'] = $_POST['spoofmac'];
226
		$optcfg['mtu'] = $_POST['mtu'];
227
228 5b237745 Scott Ullrich
		write_config();
229 1f8caa36 Scott Ullrich
		
230 824edb6c Scott Ullrich
		$savemsg = get_std_save_message($retval);
231 5b237745 Scott Ullrich
	}
232
}
233 7f43ca88 Scott Ullrich
234
235 931066a8 Bill Marquette
$pgtitle = "Interfaces: Optional {$index} (" . htmlspecialchars($optcfg['descr']) . ")";
236 7f43ca88 Scott Ullrich
include("head.inc");
237
238 5b237745 Scott Ullrich
?>
239 b9e255dd Bill Marquette
240 5b237745 Scott Ullrich
<script language="JavaScript">
241
<!--
242
function enable_change(enable_over) {
243 a23d7248 Scott Ullrich
	var endis;
244
	endis = !((document.iform.bridge.selectedIndex == 0) || enable_over);
245
	document.iform.ipaddr.disabled = endis;
246
	document.iform.subnet.disabled = endis;
247 5b237745 Scott Ullrich
}
248
function ipaddr_change() {
249 6846116e Scott Ullrich
	document.iform.subnet.selectedIndex = gen_bits_opt(document.iform.ipaddr.value);
250 5b237745 Scott Ullrich
}
251 0311dbd5 Scott Ullrich
function type_change(enable_change,enable_change_pptp) {
252
	switch (document.iform.type.selectedIndex) {
253
		case 0:
254 57e97d71 Scott Ullrich
			document.iform.ipaddr.type.disabled = 0;
255 0311dbd5 Scott Ullrich
			document.iform.ipaddr.disabled = 0;
256
			document.iform.subnet.disabled = 0;
257
			document.iform.gateway.disabled = 0;
258
			break;
259
		case 1:
260 57e97d71 Scott Ullrich
			document.iform.ipaddr.type.disabled = 1;
261 0311dbd5 Scott Ullrich
			document.iform.ipaddr.disabled = 1;
262
			document.iform.subnet.disabled = 1;
263
			document.iform.gateway.disabled = 1;
264
			break;
265
	}
266
}
267 5b237745 Scott Ullrich
//-->
268
</script>
269 b9e255dd Bill Marquette
270 5b237745 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
271
<?php include("fbegin.inc"); ?>
272 931066a8 Bill Marquette
<p class="pgtitle"><?=$pgtitle?></p>
273 5b237745 Scott Ullrich
<?php if ($input_errors) print_input_errors($input_errors); ?>
274
<?php if ($savemsg) print_info_box($savemsg); ?>
275
<?php if ($optcfg['if']): ?>
276
            <form action="interfaces_opt.php" method="post" name="iform" id="iform">
277
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
278 7e45fdf4 Scott Ullrich
                <tr>
279 386e9c57 Seth Mos
                  <td colspan="2" valign="top" class="listtopic">Optional Interface Configuration</td>
280 7e45fdf4 Scott Ullrich
                </tr>	      
281 03b92764 Scott Ullrich
                <tr>
282 5b237745 Scott Ullrich
                  <td width="22%" valign="top" class="vtable">&nbsp;</td>
283
                  <td width="78%" class="vtable">
284 007be4f3 Scott Ullrich
			<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
285 5b237745 Scott Ullrich
                    <strong>Enable Optional <?=$index;?> interface</strong></td>
286 0311dbd5 Scott Ullrich
		</tr>
287 03b92764 Scott Ullrich
                <tr>
288 5b237745 Scott Ullrich
                  <td width="22%" valign="top" class="vncell">Description</td>
289 03b92764 Scott Ullrich
                  <td width="78%" class="vtable">
290 5b237745 Scott Ullrich
                    <input name="descr" type="text" class="formfld" id="descr" size="30" value="<?=htmlspecialchars($pconfig['descr']);?>">
291
					<br> <span class="vexpl">Enter a description (name) for the interface here.</span>
292 0311dbd5 Scott Ullrich
		  </td>
293
		</tr>
294
295
                <tr>
296
                  <td colspan="2" valign="top" height="16"></td>
297
                </tr>
298
                <tr>
299
                  <td colspan="2" valign="top" class="listtopic">General configuration</td>
300
                </tr>
301
                <tr>
302
                  <td valign="middle" class="vncell"><strong>Type</strong></td>
303
                  <td class="vtable"> <select name="type" class="formfld" id="type" onchange="type_change()">
304
                      <?php $opts = split(" ", "Static DHCP");
305
				foreach ($opts as $opt): ?>
306
                      <option <?php if ($opt == $pconfig['type']) echo "selected";?>>
307
                      <?=htmlspecialchars($opt);?>
308
                      </option>
309
                      <?php endforeach; ?>
310
                    </select></td>
311
                </tr>
312
                <tr>
313
                  <td valign="top" class="vncell">MAC address</td>
314
                  <td class="vtable"> <input name="spoofmac" type="text" class="formfld" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
315
		    <?php
316
			$ip = getenv('REMOTE_ADDR');
317
			$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
318
			$mac = str_replace("\n","",$mac);
319
		    ?>
320
		    <a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#">Copy my MAC address</a>   
321
		    <br>
322
                    This field can be used to modify (&quot;spoof&quot;) the MAC
323
                    address of the WAN interface<br>
324
                    (may be required with some cable connections)<br>
325
                    Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
326
                    or leave blank</td>
327
                </tr>
328
                <tr>
329
                  <td valign="top" class="vncell">MTU</td>
330
                  <td class="vtable"> <input name="mtu" type="text" class="formfld" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
331
                    <br>
332
                    If you enter a value in this field, then MSS clamping for
333
                    TCP connections to the value entered above minus 40 (TCP/IP
334
                    header size) will be in effect. If you leave this field blank,
335
                    an MTU of 1492 bytes for PPPoE and 1500 bytes for all other
336
                    connection types will be assumed.</td>
337
                </tr>
338
		
339 03b92764 Scott Ullrich
                <tr>
340 5b237745 Scott Ullrich
                  <td colspan="2" valign="top" height="16"></td>
341 5b80d869 Scott Ullrich
		</tr>
342
		<tr>
343 a23d7248 Scott Ullrich
                  <td colspan="2" valign="top" class="listtopic">IP configuration</td>
344 5b80d869 Scott Ullrich
		</tr>
345 6d6d0f14 Scott Ullrich
		<tr>
346 5b237745 Scott Ullrich
                  <td width="22%" valign="top" class="vncellreq">Bridge with</td>
347
                  <td width="78%" class="vtable">
348 007be4f3 Scott Ullrich
			<select name="bridge" class="formfld" id="bridge" onChange="enable_change(false)">
349 5b237745 Scott Ullrich
				  	<option <?php if (!$pconfig['bridge']) echo "selected";?> value="">none</option>
350
                      <?php $opts = array('lan' => "LAN", 'wan' => "WAN");
351
					  	for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
352
							if ($i != $index)
353
								$opts['opt' . $i] = "Optional " . $i . " (" .
354
									$config['interfaces']['opt' . $i]['descr'] . ")";
355
						}
356
					foreach ($opts as $opt => $optname): ?>
357 03b92764 Scott Ullrich
                      <option <?php if ($opt == $pconfig['bridge']) echo "selected";?> value="<?=htmlspecialchars($opt);?>">
358 5b237745 Scott Ullrich
                      <?=htmlspecialchars($optname);?>
359
                      </option>
360
                      <?php endforeach; ?>
361
                    </select> </td>
362 6d6d0f14 Scott Ullrich
		</tr>
363 03b92764 Scott Ullrich
                <tr>
364 5b237745 Scott Ullrich
                  <td width="22%" valign="top" class="vncellreq">IP address</td>
365 03b92764 Scott Ullrich
                  <td width="78%" class="vtable">
366 8d8c6030 Scott Ullrich
                    <input name="ipaddr" type="text" class="formfld" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
367 5b237745 Scott Ullrich
                    /
368
                	<select name="subnet" class="formfld" id="subnet">
369 21ab1cde Scott Ullrich
					<?php
370
					for ($i = 32; $i > 0; $i--) {
371
						if($i <> 31) {
372
							echo "<option value=\"{$i}\" ";
373
							if ($i == $pconfig['subnet']) echo "selected";
374
							echo ">" . $i . "</option>";
375
						}
376
					}
377
					?>                    </select>
378 5b237745 Scott Ullrich
				 </td>
379
				</tr>
380 007be4f3 Scott Ullrich
		<tr>
381 1aaa2a5f Scott Ullrich
                  <td width="22%" valign="top" class="vncell">Gateway</td>
382 007be4f3 Scott Ullrich
                  <td width="78%" class="vtable">
383
			<input name="gateway" value="<?php echo $pconfig['gateway']; ?>">
384 a12d2145 Scott Ullrich
			<br>
385 f8b389d2 Chris Buechler
			If this interface is an Internet connection, enter its next hop gateway (router) IP address here.  Otherwise, leave this option blank.
386 007be4f3 Scott Ullrich
		  </td>
387
		</tr>
388 3c393400 Scott Ullrich
                <tr>
389
                  <td colspan="2" valign="top" height="16"></td>
390
                </tr>
391
                <tr>
392
                  <td colspan="2" valign="top" class="listtopic">FTP Helper</td>
393
                </tr>		
394
		<tr>
395
			<td width="22%" valign="top" class="vncell">FTP Helper</td>
396
			<td width="78%" class="vtable">
397 0135299b Scott Ullrich
				<input name="disableftpproxy" type="checkbox" id="disableftpproxy" value="yes" <?php if ($pconfig['disableftpproxy']) echo "checked"; ?> onclick="enable_change(false)" />
398 3c393400 Scott Ullrich
				<strong>Disable the userland FTP-Proxy application</strong>
399
				<br />
400
			</td>
401
		</tr>			
402 c435798f Scott Ullrich
				<?php /* Wireless interface? */
403
				if (isset($optcfg['wireless']))
404
					wireless_config_print();
405
				?>		
406 af539d78 Scott Ullrich
                <tr>
407
                  <td colspan="2" valign="top" height="16"></td>
408
                </tr>
409 99586fca Scott Ullrich
                <tr>
410
                  <td colspan="2" valign="top" class="listtopic">DHCP client configuration</td>
411
                </tr>
412
                <tr>
413
                  <td valign="top" class="vncell">Hostname</td>
414
                  <td class="vtable"> <input name="dhcphostname" type="text" class="formfld" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
415
                    <br>
416
                    The value in this field is sent as the DHCP client identifier
417
                    and hostname when requesting a DHCP lease. Some ISPs may require
418
                    this (for client identification).</td>
419
                </tr>
420
                <tr>
421
                  <td colspan="2" valign="top" height="16"></td>
422
                </tr>		
423 c1ec2c2f Scott Ullrich
		<tr>
424 5b237745 Scott Ullrich
                  <td width="22%" valign="top">&nbsp;</td>
425 03b92764 Scott Ullrich
                  <td width="78%">
426
                    <input name="index" type="hidden" value="<?=$index;?>">
427
				  <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
428 5b237745 Scott Ullrich
                  </td>
429
                </tr>
430 03b92764 Scott Ullrich
                <tr>
431 5b237745 Scott Ullrich
                  <td width="22%" valign="top">&nbsp;</td>
432
                  <td width="78%"><span class="vexpl"><span class="red"><strong>Note:<br>
433 c55a8ab9 Holger Bauer
                    </strong></span>be sure to add <a href="firewall_rules.php">firewall rules</a> to permit traffic
434
                    through the interface. You also need firewall rules for an interface in
435
                    bridged mode as the firewall acts as a filtering bridge.</span></td>
436 5b237745 Scott Ullrich
                </tr>
437
              </table>
438
</form>
439
<script language="JavaScript">
440
<!--
441
enable_change(false);
442
//-->
443
</script>
444
<?php else: ?>
445
<p><strong>Optional <?=$index;?> has been disabled because there is no OPT<?=$index;?> interface.</strong></p>
446
<?php endif; ?>
447
<?php include("fend.inc"); ?>
448
</body>
449
</html>
450 e4e8c30f Scott Ullrich
451
<?php
452
if ($_POST) {
453
454
	if (!$input_errors) {
455 2e70a096 Scott Ullrich
		
456
		ob_flush();
457
		flush();
458
		sleep(1);		
459
		
460 e4e8c30f Scott Ullrich
		interfaces_optional_configure_if($index);
461 fd4ce0e0 Scott Ullrich
		
462 610b1136 Scott Ullrich
		reset_carp();
463 f8a059cb Scott Ullrich
464
		/* load graphing functions */
465
		enable_rrd_graphing();	
466 e4e8c30f Scott Ullrich
		
467
		/* sync filter configuration */
468
		filter_configure();
469 276a350f Scott Ullrich
470
 		/* set up static routes */
471
		system_routing_configure();
472
473 e4e8c30f Scott Ullrich
	}
474
}
475
?>