1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
interfaces_opt.php
|
5
|
Copyright (C) 2007 Scott Ullrich
|
6
|
All rights reserved.
|
7
|
|
8
|
interfaces_opt.php
|
9
|
part of m0n0wall (http://m0n0.ch/wall)
|
10
|
|
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
|
require("guiconfig.inc");
|
37
|
|
38
|
unset($index);
|
39
|
if ($_GET['index'])
|
40
|
$index = $_GET['index'];
|
41
|
else if ($_POST['index'])
|
42
|
$index = $_POST['index'];
|
43
|
|
44
|
if (!$index)
|
45
|
exit;
|
46
|
|
47
|
function remove_bad_chars($string) {
|
48
|
return preg_replace('/[^a-z|_|0-9]/i','',$string);
|
49
|
}
|
50
|
|
51
|
if (!is_array($config['gateways']['gateway_item']))
|
52
|
$config['gateways']['gateway_item'] = array();
|
53
|
$a_gateways = &$config['gateways']['gateway_item'];
|
54
|
|
55
|
$optcfg = &$config['interfaces']['opt' . $index];
|
56
|
$optcfg['descr'] = remove_bad_chars($optcfg['descr']);
|
57
|
|
58
|
$pconfig['descr'] = $optcfg['descr'];
|
59
|
$pconfig['bridge'] = $optcfg['bridge'];
|
60
|
|
61
|
$pconfig['enable'] = isset($optcfg['enable']);
|
62
|
|
63
|
$pconfig['blockpriv'] = isset($optcfg['blockpriv']);
|
64
|
$pconfig['blockbogons'] = isset($optcfg['blockbogons']);
|
65
|
$pconfig['spoofmac'] = $optcfg['spoofmac'];
|
66
|
$pconfig['mtu'] = $optcfg['mtu'];
|
67
|
|
68
|
$pconfig['disableftpproxy'] = isset($optcfg['disableftpproxy']);
|
69
|
|
70
|
/* Wireless interface? */
|
71
|
if (isset($optcfg['wireless'])) {
|
72
|
require("interfaces_wlan.inc");
|
73
|
wireless_config_init();
|
74
|
}
|
75
|
|
76
|
if ($optcfg['ipaddr'] == "dhcp") {
|
77
|
$pconfig['type'] = "DHCP";
|
78
|
$pconfig['dhcphostname'] = $optcfg['dhcphostname'];
|
79
|
$pconfig['alias-address'] = $optcfg['alias-address'];
|
80
|
$pconfig['alias-subnet'] = $optcfg['alias-subnet'];
|
81
|
} else {
|
82
|
$pconfig['type'] = "Static";
|
83
|
$pconfig['ipaddr'] = $optcfg['ipaddr'];
|
84
|
$pconfig['subnet'] = $optcfg['subnet'];
|
85
|
$pconfig['gateway'] = $optcfg['gateway'];
|
86
|
$pconfig['pointtopoint'] = $optcfg['pointtopoint'];
|
87
|
$pconfig['ap'] = $optcfg['ap'];
|
88
|
$pconfig['phone'] = $optcfg['phone'];
|
89
|
}
|
90
|
|
91
|
if ($_POST) {
|
92
|
|
93
|
unset($input_errors);
|
94
|
|
95
|
/* filter out spaces from descriptions */
|
96
|
$POST['descr'] = remove_bad_chars($POST['descr']);
|
97
|
|
98
|
if($_POST['gateway'] and $pconfig['gateway'] <> $_POST['gateway']) {
|
99
|
/* enumerate slbd gateways and make sure we are not creating a route loop */
|
100
|
if(is_array($config['load_balancer']['lbpool'])) {
|
101
|
foreach($config['load_balancer']['lbpool'] as $lbpool) {
|
102
|
if($lbpool['type'] == "gateway") {
|
103
|
foreach ((array) $lbpool['servers'] as $server) {
|
104
|
$svr = split("\|", $server);
|
105
|
if($svr[1] == $pconfig['gateway']) {
|
106
|
$_POST['gateway'] = $pconfig['gateway'];
|
107
|
$input_errors[] = "Cannot change {$svr[1]} gateway. It is currently referenced by the load balancer pools.";
|
108
|
break;
|
109
|
}
|
110
|
}
|
111
|
}
|
112
|
}
|
113
|
foreach($config['filter']['rule'] as $rule) {
|
114
|
if($rule['gateway'] == $_POST['gateway']) {
|
115
|
$input_errors[] = "Cannot change {$_POST['gateway']} gateway. It is currently referenced by the filter rules via policy based routing.";
|
116
|
break;
|
117
|
}
|
118
|
}
|
119
|
}
|
120
|
}
|
121
|
|
122
|
$pconfig = $_POST;
|
123
|
|
124
|
/* input validation */
|
125
|
if ($_POST['enable']) {
|
126
|
|
127
|
/* description unique? */
|
128
|
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
|
129
|
if ($i != $index) {
|
130
|
if ($config['interfaces']['opt' . $i]['descr'] == $_POST['descr']) {
|
131
|
$input_errors[] = "An interface with the specified description already exists.";
|
132
|
}
|
133
|
}
|
134
|
}
|
135
|
|
136
|
if ($_POST['bridge']) {
|
137
|
/* double bridging? */
|
138
|
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
|
139
|
if ($i != $index) {
|
140
|
if ($config['interfaces']['opt' . $i]['bridge'] == $_POST['bridge']) {
|
141
|
//$input_errors[] = "Optional interface {$i} " .
|
142
|
// "({$config['interfaces']['opt' . $i]['descr']}) is already bridged to " .
|
143
|
// "the specified interface.";
|
144
|
} else if ($config['interfaces']['opt' . $i]['bridge'] == "opt{$index}") {
|
145
|
//$input_errors[] = "Optional interface {$i} " .
|
146
|
// "({$config['interfaces']['opt' . $i]['descr']}) is already bridged to " .
|
147
|
// "this interface.";
|
148
|
}
|
149
|
}
|
150
|
}
|
151
|
if ($config['interfaces'][$_POST['bridge']]['bridge']) {
|
152
|
//$input_errors[] = "The specified interface is already bridged to " .
|
153
|
// "another interface.";
|
154
|
}
|
155
|
/* captive portal on? */
|
156
|
if (isset($config['captiveportal']['enable'])) {
|
157
|
//$input_errors[] = "Interfaces cannot be bridged while the captive portal is enabled.";
|
158
|
}
|
159
|
} else {
|
160
|
if ($_POST['type'] <> "DHCP") {
|
161
|
$reqdfields = explode(" ", "descr ipaddr subnet");
|
162
|
$reqdfieldsn = explode(",", "Description,IP address,Subnet bit count");
|
163
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
164
|
if (($_POST['ipaddr'] && !is_ipaddr($_POST['ipaddr']))) {
|
165
|
$input_errors[] = "A valid IP address must be specified.";
|
166
|
}
|
167
|
if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) {
|
168
|
$input_errors[] = "A valid subnet bit count must be specified.";
|
169
|
}
|
170
|
if ($_POST['gateway']) {
|
171
|
$match = false;
|
172
|
foreach($a_gateways as $gateway) {
|
173
|
if(in_array($_POST['gateway'], $gateway)) {
|
174
|
$match = true;
|
175
|
}
|
176
|
}
|
177
|
if(!$match)
|
178
|
$input_errors[] = "A valid gateway must be specified.";
|
179
|
}
|
180
|
}
|
181
|
}
|
182
|
if (($_POST['alias-address'] && !is_ipaddr($_POST['alias-address']))) {
|
183
|
$input_errors[] = "A valid alias IP address must be specified.";
|
184
|
}
|
185
|
if (($_POST['alias-subnet'] && !is_numeric($_POST['alias-subnet']))) {
|
186
|
$input_errors[] = "A valid alias subnet bit count must be specified.";
|
187
|
}
|
188
|
|
189
|
if ($_POST['mtu'] && (($_POST['mtu'] < 576) || ($_POST['mtu'] > 1500))) {
|
190
|
$input_errors[] = "The MTU must be between 576 and 1500 bytes.";
|
191
|
}
|
192
|
if (($_POST['spoofmac'] && !is_macaddr($_POST['spoofmac']))) {
|
193
|
$input_errors[] = "A valid MAC address must be specified.";
|
194
|
}
|
195
|
}
|
196
|
|
197
|
if($_POST['mtu']) {
|
198
|
if($_POST['mtu'] < 24 or $_POST['mtu'] > 1501)
|
199
|
$input_errors[] = "A valid MTU is required 24-1500.";
|
200
|
}
|
201
|
|
202
|
/* Wireless interface? */
|
203
|
if (isset($optcfg['wireless'])) {
|
204
|
$wi_input_errors = wireless_config_post();
|
205
|
if ($wi_input_errors) {
|
206
|
$input_errors = array_merge($input_errors, $wi_input_errors);
|
207
|
}
|
208
|
}
|
209
|
|
210
|
if (!$input_errors) {
|
211
|
|
212
|
$bridge = discover_bridge($optcfg['if'], filter_translate_type_to_real_interface($optcfg['bridge']));
|
213
|
if($bridge <> "-1") {
|
214
|
destroy_bridge($bridge);
|
215
|
}
|
216
|
|
217
|
unset($optcfg['dhcphostname']);
|
218
|
unset($optcfg['disableftpproxy']);
|
219
|
|
220
|
/* per interface pftpx helper */
|
221
|
if($_POST['disableftpproxy'] == "yes") {
|
222
|
$optcfg['disableftpproxy'] = true;
|
223
|
system_start_ftp_helpers();
|
224
|
} else {
|
225
|
system_start_ftp_helpers();
|
226
|
}
|
227
|
|
228
|
$optcfg['descr'] = remove_bad_chars($_POST['descr']);
|
229
|
$optcfg['bridge'] = $_POST['bridge'];
|
230
|
$optcfg['enable'] = $_POST['enable'] ? true : false;
|
231
|
|
232
|
if ($_POST['type'] == "Static") {
|
233
|
$optcfg['ipaddr'] = $_POST['ipaddr'];
|
234
|
$optcfg['subnet'] = $_POST['subnet'];
|
235
|
$optcfg['gateway'] = $_POST['gateway'];
|
236
|
if (isset($optcfg['ispointtopoint'])) {
|
237
|
$optcfg['pointtopoint'] = $_POST['pointtopoint'];
|
238
|
$optcfg['ap'] = $_POST['ap'];
|
239
|
$optcfg['phone'] = $_POST['phone'];
|
240
|
}
|
241
|
} else if ($_POST['type'] == "DHCP") {
|
242
|
$optcfg['ipaddr'] = "dhcp";
|
243
|
$optcfg['dhcphostname'] = $_POST['dhcphostname'];
|
244
|
$optcfg['alias-address'] = $_POST['alias-address'];
|
245
|
$optcfg['alias-subnet'] = $_POST['alias-subnet'];
|
246
|
}
|
247
|
|
248
|
$optcfg['blockpriv'] = $_POST['blockpriv'] ? true : false;
|
249
|
$optcfg['blockbogons'] = $_POST['blockbogons'] ? true : false;
|
250
|
$optcfg['spoofmac'] = $_POST['spoofmac'];
|
251
|
$optcfg['mtu'] = $_POST['mtu'];
|
252
|
|
253
|
write_config();
|
254
|
|
255
|
$savemsg = get_std_save_message($retval);
|
256
|
}
|
257
|
}
|
258
|
|
259
|
|
260
|
$pgtitle = array("Interfaces","Optional {$index} (" . htmlspecialchars($optcfg['descr']) . ")");
|
261
|
include("head.inc");
|
262
|
|
263
|
?>
|
264
|
|
265
|
<script language="JavaScript">
|
266
|
<!--
|
267
|
function enable_change(enable_over) {
|
268
|
var endis;
|
269
|
endis = !((document.iform.bridge.selectedIndex == 0) || enable_over);
|
270
|
document.iform.ipaddr.disabled = endis;
|
271
|
document.iform.subnet.disabled = endis;
|
272
|
}
|
273
|
function ipaddr_change() {
|
274
|
document.iform.subnet.selectedIndex = gen_bits_opt(document.iform.ipaddr.value);
|
275
|
}
|
276
|
function type_change(enable_change,enable_change_pptp) {
|
277
|
switch (document.iform.type.selectedIndex) {
|
278
|
case 0:
|
279
|
document.iform.ipaddr.type.disabled = 0;
|
280
|
document.iform.ipaddr.disabled = 0;
|
281
|
document.iform.subnet.disabled = 0;
|
282
|
document.iform.gateway.disabled = 0;
|
283
|
break;
|
284
|
case 1:
|
285
|
document.iform.ipaddr.type.disabled = 1;
|
286
|
document.iform.ipaddr.disabled = 1;
|
287
|
document.iform.subnet.disabled = 1;
|
288
|
document.iform.gateway.disabled = 1;
|
289
|
break;
|
290
|
}
|
291
|
}
|
292
|
|
293
|
function show_mon_config() {
|
294
|
document.getElementById("showmonbox").innerHTML='';
|
295
|
aodiv = document.getElementById('showmon');
|
296
|
aodiv.style.display = "block";
|
297
|
}
|
298
|
|
299
|
//-->
|
300
|
</script>
|
301
|
|
302
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
303
|
<?php include("fbegin.inc"); ?>
|
304
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
305
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
306
|
<?php if ($optcfg['if']): ?>
|
307
|
<form action="interfaces_opt.php" method="post" name="iform" id="iform">
|
308
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
309
|
<tr>
|
310
|
<td colspan="2" valign="top" class="listtopic">Optional Interface Configuration</td>
|
311
|
</tr>
|
312
|
<tr>
|
313
|
<td width="22%" valign="top" class="vtable"> </td>
|
314
|
<td width="78%" class="vtable">
|
315
|
<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
|
316
|
<strong>Enable Optional <?=$index;?> interface</strong></td>
|
317
|
</tr>
|
318
|
<tr>
|
319
|
<td width="22%" valign="top" class="vncell">Description</td>
|
320
|
<td width="78%" class="vtable">
|
321
|
<input name="descr" type="text" class="formfld unknown" id="descr" size="30" value="<?=htmlspecialchars($pconfig['descr']);?>">
|
322
|
<br> <span class="vexpl">Enter a description (name) for the interface here.</span>
|
323
|
</td>
|
324
|
</tr>
|
325
|
|
326
|
<tr>
|
327
|
<td colspan="2" valign="top" height="16"></td>
|
328
|
</tr>
|
329
|
<tr>
|
330
|
<td colspan="2" valign="top" class="listtopic">General configuration</td>
|
331
|
</tr>
|
332
|
<?php if (isset($optcfg['pointtopoint'])): ?>
|
333
|
<tr>
|
334
|
<td width="22%" valign="top" class="vncell">AP Hostname</td>
|
335
|
<td width="78%" class="vtable">
|
336
|
<input name="ap" type="text" class="formfld" id="ap" size="40" value="<?=htmlspecialchars($pconfig['ap']);?>">
|
337
|
</td>
|
338
|
</tr>
|
339
|
<tr>
|
340
|
<td width="22%" valign="top" class="vncell">Phone Number</td>
|
341
|
<td width="78%" class="vtable">
|
342
|
<input name="phone" type="text" class="formfld" id="phone" size="40" value="<?=htmlspecialchars($pconfig['phone']);?>">
|
343
|
</td>
|
344
|
</tr>
|
345
|
<tr>
|
346
|
<td width="22%" valign="top" class="vncell">Remote IP</td>
|
347
|
<td width="78%" class="vtable">
|
348
|
<input name="gateway" type="text" class="formfld" id="gateway" size="40" value="<?=htmlspecialchars($pconfig['gateway']);?>">
|
349
|
</td>
|
350
|
</tr>
|
351
|
|
352
|
<input name="type" type="hidden" value="Static">
|
353
|
<input name="ipaddr" type="hidden" value="0.0.0.0">
|
354
|
<input name="subnet" type="hidden" value="32">
|
355
|
<?php else: ?>
|
356
|
<tr>
|
357
|
<td valign="middle" class="vncell"><strong>Type</strong></td>
|
358
|
<td class="vtable"> <select name="type" class="formselect" id="type" onchange="type_change()">
|
359
|
<?php $opts = split(" ", "Static DHCP");
|
360
|
foreach ($opts as $opt): ?>
|
361
|
<option <?php if ($opt == $pconfig['type']) echo "selected";?>>
|
362
|
<?=htmlspecialchars($opt);?>
|
363
|
</option>
|
364
|
<?php endforeach; ?>
|
365
|
</select></td>
|
366
|
</tr>
|
367
|
<tr>
|
368
|
<td valign="top" class="vncell">MAC address</td>
|
369
|
<td class="vtable"> <input name="spoofmac" type="text" class="formfld unknown" id="spoofmac" size="30" value="<?=htmlspecialchars($pconfig['spoofmac']);?>">
|
370
|
<?php
|
371
|
$ip = getenv('REMOTE_ADDR');
|
372
|
$mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`;
|
373
|
$mac = str_replace("\n","",$mac);
|
374
|
?>
|
375
|
<a OnClick="document.forms[0].spoofmac.value='<?=$mac?>';" href="#">Copy my MAC address</a>
|
376
|
<br>
|
377
|
This field can be used to modify ("spoof") the MAC
|
378
|
address of the WAN interface<br>
|
379
|
(may be required with some cable connections)<br>
|
380
|
Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx
|
381
|
or leave blank</td>
|
382
|
</tr>
|
383
|
<tr>
|
384
|
<td valign="top" class="vncell">MTU</td>
|
385
|
<td class="vtable"> <input name="mtu" type="text" class="formfld unknown" id="mtu" size="8" value="<?=htmlspecialchars($pconfig['mtu']);?>">
|
386
|
<br>
|
387
|
If you enter a value in this field, then MSS clamping for
|
388
|
TCP connections to the value entered above minus 40 (TCP/IP
|
389
|
header size) will be in effect. If you leave this field blank,
|
390
|
an MTU of 1492 bytes for PPPoE and 1500 bytes for all other
|
391
|
connection types will be assumed.</td>
|
392
|
</tr>
|
393
|
|
394
|
<tr>
|
395
|
<td colspan="2" valign="top" height="16"></td>
|
396
|
</tr>
|
397
|
<tr>
|
398
|
<td colspan="2" valign="top" class="listtopic">IP configuration</td>
|
399
|
</tr>
|
400
|
<tr>
|
401
|
<td width="22%" valign="top" class="vncellreq">Bridge with</td>
|
402
|
<td width="78%" class="vtable">
|
403
|
<select name="bridge" class="formselect" id="bridge" onChange="enable_change(false)">
|
404
|
<option <?php if (!$pconfig['bridge']) echo "selected";?> value="">none</option>
|
405
|
<?php $opts = array('lan' => "LAN", 'wan' => "WAN");
|
406
|
for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++) {
|
407
|
if ($i != $index)
|
408
|
$opts['opt' . $i] = "Optional " . $i . " (" .
|
409
|
$config['interfaces']['opt' . $i]['descr'] . ")";
|
410
|
}
|
411
|
foreach ($opts as $opt => $optname): ?>
|
412
|
<option <?php if ($opt == $pconfig['bridge']) echo "selected";?> value="<?=htmlspecialchars($opt);?>">
|
413
|
<?=htmlspecialchars($optname);?>
|
414
|
</option>
|
415
|
<?php endforeach; ?>
|
416
|
</select> </td>
|
417
|
</tr>
|
418
|
<tr>
|
419
|
<td width="22%" valign="top" class="vncellreq">IP address</td>
|
420
|
<td width="78%" class="vtable">
|
421
|
<input name="ipaddr" type="text" class="formfld unknown" id="ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipaddr']);?>">
|
422
|
/
|
423
|
<select name="subnet" class="formselect" id="subnet">
|
424
|
<?php
|
425
|
for ($i = 32; $i > 0; $i--) {
|
426
|
if($i <> 31) {
|
427
|
echo "<option value=\"{$i}\" ";
|
428
|
if ($i == $pconfig['subnet']) echo "selected";
|
429
|
echo ">" . $i . "</option>";
|
430
|
}
|
431
|
}
|
432
|
?> </select>
|
433
|
</td>
|
434
|
</tr>
|
435
|
<tr>
|
436
|
<td valign="top" class="vncellreq">Gateway</td>
|
437
|
<td class="vtable"><select name="gateway" class="formselect" id="gateway">
|
438
|
<?php
|
439
|
if(count($a_gateways) > 0) {
|
440
|
foreach ($a_gateways as $gateway) {
|
441
|
if($gateway['interface'] == "opt{$index}") {
|
442
|
?>
|
443
|
<option value="<?=$gateway['name'];?>" <?php if ($gateway['name'] == $pconfig['gateway']) echo "selected"; ?>>
|
444
|
<?=htmlspecialchars($gateway['name']);?>
|
445
|
</option>
|
446
|
<?php
|
447
|
}
|
448
|
}
|
449
|
}
|
450
|
?>
|
451
|
</select>Select a existing Gateway from the list or add one on the <a href="/system_gateways.php">Gateways</a> page<br>
|
452
|
</td>
|
453
|
</tr>
|
454
|
<?php endif;?>
|
455
|
<tr>
|
456
|
<td colspan="2" valign="top" height="16"></td>
|
457
|
</tr>
|
458
|
<tr>
|
459
|
<td colspan="2" valign="top" class="listtopic">Other</td>
|
460
|
</tr>
|
461
|
<tr>
|
462
|
<td width="22%" valign="top" class="vncell">FTP Helper</td>
|
463
|
<td width="78%" class="vtable">
|
464
|
<input name="disableftpproxy" type="checkbox" id="disableftpproxy" value="yes" <?php if ($pconfig['disableftpproxy']) echo "checked"; ?> onclick="enable_change(false)" />
|
465
|
<strong>Disable the userland FTP-Proxy application</strong>
|
466
|
<br />
|
467
|
</td>
|
468
|
</tr>
|
469
|
<?php /* Wireless interface? */
|
470
|
if (isset($optcfg['wireless']))
|
471
|
wireless_config_print();
|
472
|
?>
|
473
|
<tr>
|
474
|
<td colspan="2" valign="top" height="16"></td>
|
475
|
</tr>
|
476
|
<tr>
|
477
|
<td colspan="2" valign="top" class="listtopic">DHCP client configuration</td>
|
478
|
</tr>
|
479
|
<tr>
|
480
|
<td valign="top" class="vncell">Hostname</td>
|
481
|
<td class="vtable"> <input name="dhcphostname" type="text" class="formfld unknown" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>">
|
482
|
<br>
|
483
|
The value in this field is sent as the DHCP client identifier
|
484
|
and hostname when requesting a DHCP lease. Some ISPs may require
|
485
|
this (for client identification).</td>
|
486
|
</tr>
|
487
|
<tr>
|
488
|
<td width="100" valign="top" class="vncellreq">Alias IP address</td>
|
489
|
<td class="vtable"> <input name="alias-address" type="text" class="formfld unknown" id="alias-address" size="20" value="<?=htmlspecialchars($pconfig['alias-address']);?>">
|
490
|
<select name="alias-subnet" class="formselect" id="alias-subnet">
|
491
|
<?php
|
492
|
for ($i = 32; $i > 0; $i--) {
|
493
|
if($i <> 31) {
|
494
|
echo "<option value=\"{$i}\" ";
|
495
|
if ($i == $pconfig['alias-subnet']) echo "selected";
|
496
|
echo ">" . $i . "</option>";
|
497
|
}
|
498
|
}
|
499
|
?>
|
500
|
</select>
|
501
|
The value in this field is used as a fixed alias IP address by the
|
502
|
DHCP client.</td>
|
503
|
</tr>
|
504
|
<tr>
|
505
|
<td colspan="2" valign="top" height="16"></td>
|
506
|
</tr>
|
507
|
<tr>
|
508
|
<td width="22%" valign="top"> </td>
|
509
|
<td width="78%">
|
510
|
<input name="index" type="hidden" value="<?=$index;?>">
|
511
|
<input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
|
512
|
</td>
|
513
|
</tr>
|
514
|
<tr>
|
515
|
<td width="22%" valign="top"> </td>
|
516
|
<td width="78%"><span class="vexpl"><span class="red"><strong>Note:<br>
|
517
|
</strong></span>be sure to add <a href="firewall_rules.php">firewall rules</a> to permit traffic
|
518
|
through the interface. You also need firewall rules for an interface in
|
519
|
bridged mode as the firewall acts as a filtering bridge.</span></td>
|
520
|
</tr>
|
521
|
</table>
|
522
|
</form>
|
523
|
<script language="JavaScript">
|
524
|
<!--
|
525
|
enable_change(false);
|
526
|
//-->
|
527
|
</script>
|
528
|
<?php else: ?>
|
529
|
<p><strong>Optional <?=$index;?> has been disabled because there is no OPT<?=$index;?> interface.</strong></p>
|
530
|
<?php endif; ?>
|
531
|
<?php include("fend.inc"); ?>
|
532
|
</body>
|
533
|
</html>
|
534
|
|
535
|
<?php
|
536
|
if ($_POST) {
|
537
|
|
538
|
if (!$input_errors) {
|
539
|
|
540
|
ob_flush();
|
541
|
flush();
|
542
|
sleep(1);
|
543
|
|
544
|
interfaces_optional_configure_if($index);
|
545
|
|
546
|
reset_carp();
|
547
|
|
548
|
/* load graphing functions */
|
549
|
enable_rrd_graphing();
|
550
|
|
551
|
/* sync filter configuration */
|
552
|
filter_configure();
|
553
|
|
554
|
/* set up static routes */
|
555
|
system_routing_configure();
|
556
|
|
557
|
}
|
558
|
}
|
559
|
?>
|