1
|
<?php
|
2
|
/*
|
3
|
interfaces_assign.php
|
4
|
part of m0n0wall (http://m0n0.ch/wall)
|
5
|
Written by Jim McBeath based on existing m0n0wall files
|
6
|
|
7
|
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
|
8
|
All rights reserved.
|
9
|
|
10
|
Redistribution and use in source and binary forms, with or without
|
11
|
modification, are permitted provided that the following conditions are met:
|
12
|
|
13
|
1. Redistributions of source code must retain the above copyright notice,
|
14
|
this list of conditions and the following disclaimer.
|
15
|
|
16
|
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
|
|
20
|
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
|
pfSense_BUILDER_BINARIES: /bin/rm
|
33
|
pfSense_MODULE: interfaces
|
34
|
*/
|
35
|
|
36
|
##|+PRIV
|
37
|
##|*IDENT=page-interfaces-assignnetworkports
|
38
|
##|*NAME=Interfaces: Assign network ports page
|
39
|
##|*DESCR=Allow access to the 'Interfaces: Assign network ports' page.
|
40
|
##|*MATCH=interfaces_assign.php*
|
41
|
##|-PRIV
|
42
|
|
43
|
$pgtitle = array(gettext("Interfaces"),gettext("Assign network ports"));
|
44
|
$shortcut_section = "interfaces";
|
45
|
|
46
|
require("guiconfig.inc");
|
47
|
require("functions.inc");
|
48
|
require_once("filter.inc");
|
49
|
require("shaper.inc");
|
50
|
require("ipsec.inc");
|
51
|
require("vpn.inc");
|
52
|
require("captiveportal.inc");
|
53
|
require_once("rrd.inc");
|
54
|
|
55
|
function interface_assign_description($portinfo, $portname) {
|
56
|
if ($portinfo['isvlan']) {
|
57
|
$descr = sprintf(gettext('VLAN %1$s on %2$s'),$portinfo['tag'],$portinfo['if']);
|
58
|
if ($portinfo['descr'])
|
59
|
$descr .= " (" . $portinfo['descr'] . ")";
|
60
|
} elseif ($portinfo['iswlclone']) {
|
61
|
$descr = $portinfo['cloneif'];
|
62
|
if ($portinfo['descr'])
|
63
|
$descr .= " (" . $portinfo['descr'] . ")";
|
64
|
} elseif ($portinfo['isppp']) {
|
65
|
$descr = $portinfo['descr'];
|
66
|
} elseif ($portinfo['isbridge']) {
|
67
|
$descr = strtoupper($portinfo['bridgeif']);
|
68
|
if ($portinfo['descr'])
|
69
|
$descr .= " (" . $portinfo['descr'] . ")";
|
70
|
} elseif ($portinfo['isgre']) {
|
71
|
$descr = "GRE {$portinfo['remote-addr']}";
|
72
|
if ($portinfo['descr'])
|
73
|
$descr .= " (" . $portinfo['descr'] . ")";
|
74
|
} elseif ($portinfo['isgif']) {
|
75
|
$descr = "GIF {$portinfo['remote-addr']}";
|
76
|
if ($portinfo['descr'])
|
77
|
$descr .= " (" . $portinfo['descr'] . ")";
|
78
|
} elseif ($portinfo['islagg']) {
|
79
|
$descr = strtoupper($portinfo['laggif']);
|
80
|
if ($portinfo['descr'])
|
81
|
$descr .= " (" . $portinfo['descr'] . ")";
|
82
|
} elseif ($portinfo['isqinq']) {
|
83
|
$descr = $portinfo['descr'];
|
84
|
} elseif (substr($portname, 0, 4) == 'ovpn') {
|
85
|
$descr = $portname . " (" . $ovpn_descrs[substr($portname, 5)] . ")";
|
86
|
} else
|
87
|
$descr = $portname . " (" . $portinfo['mac'] . ")";
|
88
|
|
89
|
return htmlspecialchars($descr);
|
90
|
}
|
91
|
|
92
|
/*
|
93
|
In this file, "port" refers to the physical port name,
|
94
|
while "interface" refers to LAN, WAN, or OPTn.
|
95
|
*/
|
96
|
|
97
|
/* get list without VLAN interfaces */
|
98
|
$portlist = get_interface_list();
|
99
|
|
100
|
/* add wireless clone interfaces */
|
101
|
if (is_array($config['wireless']['clone']) && count($config['wireless']['clone'])) {
|
102
|
foreach ($config['wireless']['clone'] as $clone) {
|
103
|
$portlist[$clone['cloneif']] = $clone;
|
104
|
$portlist[$clone['cloneif']]['iswlclone'] = true;
|
105
|
}
|
106
|
}
|
107
|
|
108
|
/* add VLAN interfaces */
|
109
|
if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
|
110
|
foreach ($config['vlans']['vlan'] as $vlan) {
|
111
|
$portlist[$vlan['vlanif']] = $vlan;
|
112
|
$portlist[$vlan['vlanif']]['isvlan'] = true;
|
113
|
}
|
114
|
}
|
115
|
|
116
|
/* add Bridge interfaces */
|
117
|
if (is_array($config['bridges']['bridged']) && count($config['bridges']['bridged'])) {
|
118
|
foreach ($config['bridges']['bridged'] as $bridge) {
|
119
|
$portlist[$bridge['bridgeif']] = $bridge;
|
120
|
$portlist[$bridge['bridgeif']]['isbridge'] = true;
|
121
|
}
|
122
|
}
|
123
|
|
124
|
/* add GIF interfaces */
|
125
|
if (is_array($config['gifs']['gif']) && count($config['gifs']['gif'])) {
|
126
|
foreach ($config['gifs']['gif'] as $gif) {
|
127
|
$portlist[$gif['gifif']] = $gif;
|
128
|
$portlist[$gif['gifif']]['isgif'] = true;
|
129
|
}
|
130
|
}
|
131
|
|
132
|
/* add GRE interfaces */
|
133
|
if (is_array($config['gres']['gre']) && count($config['gres']['gre'])) {
|
134
|
foreach ($config['gres']['gre'] as $gre) {
|
135
|
$portlist[$gre['greif']] = $gre;
|
136
|
$portlist[$gre['greif']]['isgre'] = true;
|
137
|
}
|
138
|
}
|
139
|
|
140
|
/* add LAGG interfaces */
|
141
|
if (is_array($config['laggs']['lagg']) && count($config['laggs']['lagg'])) {
|
142
|
foreach ($config['laggs']['lagg'] as $lagg) {
|
143
|
$portlist[$lagg['laggif']] = $lagg;
|
144
|
$portlist[$lagg['laggif']]['islagg'] = true;
|
145
|
/* LAGG members cannot be assigned */
|
146
|
$lagifs = explode(',', $lagg['members']);
|
147
|
foreach ($lagifs as $lagif)
|
148
|
if (isset($portlist[$lagif]))
|
149
|
unset($portlist[$lagif]);
|
150
|
}
|
151
|
}
|
152
|
|
153
|
/* add QinQ interfaces */
|
154
|
if (is_array($config['qinqs']['qinqentry']) && count($config['qinqs']['qinqentry'])) {
|
155
|
foreach ($config['qinqs']['qinqentry'] as $qinq) {
|
156
|
$portlist["vlan{$qinq['tag']}"]['descr'] = "VLAN {$qinq['tag']}";
|
157
|
$portlist["vlan{$qinq['tag']}"]['isqinq'] = true;
|
158
|
/* QinQ members */
|
159
|
$qinqifs = explode(' ', $qinq['members']);
|
160
|
foreach ($qinqifs as $qinqif) {
|
161
|
$portlist["vlan{$qinq['tag']}_{$qinqif}"]['descr'] = "QinQ {$qinqif}";
|
162
|
$portlist["vlan{$qinq['tag']}_{$qinqif}"]['isqinq'] = true;
|
163
|
}
|
164
|
}
|
165
|
}
|
166
|
|
167
|
/* add PPP interfaces */
|
168
|
if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
|
169
|
foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
|
170
|
$portname = $ppp['if'];
|
171
|
$portlist[$portname] = $ppp;
|
172
|
$portlist[$portname]['isppp'] = true;
|
173
|
$ports_base = basename($ppp['ports']);
|
174
|
if (isset($ppp['descr']))
|
175
|
$portlist[$portname]['descr'] = strtoupper($ppp['if']). "({$ports_base}) - {$ppp['descr']}";
|
176
|
else if (isset($ppp['username']))
|
177
|
$portlist[$portname]['descr'] = strtoupper($ppp['if']). "({$ports_base}) - {$ppp['username']}";
|
178
|
else
|
179
|
$portlist[$portname]['descr'] = strtoupper($ppp['if']). "({$ports_base})";
|
180
|
}
|
181
|
}
|
182
|
|
183
|
$ovpn_descrs = array();
|
184
|
if (is_array($config['openvpn'])) {
|
185
|
if (is_array($config['openvpn']['openvpn-server']))
|
186
|
foreach ($config['openvpn']['openvpn-server'] as $s)
|
187
|
$ovpn_descrs[$s['vpnid']] = $s['description'];
|
188
|
if (is_array($config['openvpn']['openvpn-client']))
|
189
|
foreach ($config['openvpn']['openvpn-client'] as $c)
|
190
|
$ovpn_descrs[$c['vpnid']] = $c['description'];
|
191
|
}
|
192
|
|
193
|
if (isset($_POST['add_x']) && isset($_POST['if_add'])) {
|
194
|
/* Be sure this port is not being used */
|
195
|
$portused = false;
|
196
|
foreach ($config['interfaces'] as $ifname => $ifdata) {
|
197
|
if ($ifdata['if'] == $_PORT['if_add']) {
|
198
|
$portused = true;
|
199
|
break;
|
200
|
}
|
201
|
}
|
202
|
|
203
|
if ($portused === false) {
|
204
|
/* find next free optional interface number */
|
205
|
if(!$config['interfaces']['lan']) {
|
206
|
$newifname = gettext("lan");
|
207
|
$descr = gettext("LAN");
|
208
|
} else {
|
209
|
for ($i = 1; $i <= count($config['interfaces']); $i++) {
|
210
|
if (!$config['interfaces']["opt{$i}"])
|
211
|
break;
|
212
|
}
|
213
|
$newifname = 'opt' . $i;
|
214
|
$descr = "OPT" . $i;
|
215
|
}
|
216
|
|
217
|
$config['interfaces'][$newifname] = array();
|
218
|
$config['interfaces'][$newifname]['descr'] = $descr;
|
219
|
$config['interfaces'][$newifname]['if'] = $_POST['if_add'];
|
220
|
if (preg_match($g['wireless_regex'], $_POST['if_add'])) {
|
221
|
$config['interfaces'][$newifname]['wireless'] = array();
|
222
|
interface_sync_wireless_clones($config['interfaces'][$newifname], false);
|
223
|
}
|
224
|
|
225
|
uksort($config['interfaces'], "compare_interface_friendly_names");
|
226
|
|
227
|
/* XXX: Do not remove this. */
|
228
|
unlink_if_exists("{$g['tmp_path']}/config.cache");
|
229
|
|
230
|
write_config();
|
231
|
|
232
|
$savemsg = gettext("Interface has been added.");
|
233
|
}
|
234
|
|
235
|
} else if (isset($_POST['apply'])) {
|
236
|
if (file_exists("/var/run/interface_mismatch_reboot_needed")) {
|
237
|
system_reboot();
|
238
|
$rebootingnow = true;
|
239
|
} else {
|
240
|
write_config();
|
241
|
|
242
|
$retval = filter_configure();
|
243
|
$savemsg = get_std_save_message($retval);
|
244
|
|
245
|
if (stristr($retval, "error") <> true)
|
246
|
$savemsg = get_std_save_message($retval);
|
247
|
else
|
248
|
$savemsg = $retval;
|
249
|
}
|
250
|
|
251
|
} else if (isset($_POST['Submit'])) {
|
252
|
|
253
|
unset($input_errors);
|
254
|
|
255
|
/* input validation */
|
256
|
|
257
|
/* Build a list of the port names so we can see how the interfaces map */
|
258
|
$portifmap = array();
|
259
|
foreach ($portlist as $portname => $portinfo)
|
260
|
$portifmap[$portname] = array();
|
261
|
|
262
|
/* Go through the list of ports selected by the user,
|
263
|
build a list of port-to-interface mappings in portifmap */
|
264
|
foreach ($_POST as $ifname => $ifport) {
|
265
|
if (($ifname == 'lan') || ($ifname == 'wan') || (substr($ifname, 0, 3) == 'opt'))
|
266
|
$portifmap[$ifport][] = strtoupper($ifname);
|
267
|
}
|
268
|
|
269
|
/* Deliver error message for any port with more than one assignment */
|
270
|
foreach ($portifmap as $portname => $ifnames) {
|
271
|
if (count($ifnames) > 1) {
|
272
|
$errstr = sprintf(gettext('Port %1$s '.
|
273
|
' was assigned to %2$s' .
|
274
|
' interfaces:'), $portname, count($ifnames));
|
275
|
|
276
|
foreach ($portifmap[$portname] as $ifn)
|
277
|
$errstr .= " " . $ifn;
|
278
|
|
279
|
$input_errors[] = $errstr;
|
280
|
} else if (count($ifnames) == 1 && preg_match('/^bridge[0-9]/', $portname) && is_array($config['bridges']['bridged']) && count($config['bridges']['bridged'])) {
|
281
|
foreach ($config['bridges']['bridged'] as $bridge) {
|
282
|
if ($bridge['bridgeif'] != $portname)
|
283
|
continue;
|
284
|
|
285
|
$members = explode(",", strtoupper($bridge['members']));
|
286
|
foreach ($members as $member) {
|
287
|
if ($member == $ifnames[0]) {
|
288
|
$input_errors[] = sprintf(gettext("You cannot set port %s to interface %s because this interface is a member of %s."), $portname, $member, $portname);
|
289
|
break;
|
290
|
}
|
291
|
}
|
292
|
}
|
293
|
}
|
294
|
}
|
295
|
|
296
|
if (is_array($config['vlans']['vlan'])) {
|
297
|
foreach ($config['vlans']['vlan'] as $vlan) {
|
298
|
if (does_interface_exist($vlan['if']) == false)
|
299
|
$input_errors[] = "Vlan parent interface {$vlan['if']} does not exist anymore so vlan id {$vlan['tag']} cannot be created please fix the issue before continuing.";
|
300
|
}
|
301
|
}
|
302
|
|
303
|
if (!$input_errors) {
|
304
|
/* No errors detected, so update the config */
|
305
|
foreach ($_POST as $ifname => $ifport) {
|
306
|
|
307
|
if (($ifname == 'lan') || ($ifname == 'wan') || (substr($ifname, 0, 3) == 'opt')) {
|
308
|
|
309
|
if (!is_array($ifport)) {
|
310
|
$reloadif = false;
|
311
|
if (!empty($config['interfaces'][$ifname]['if']) && $config['interfaces'][$ifname]['if'] <> $ifport) {
|
312
|
interface_bring_down($ifname);
|
313
|
/* Mark this to be reconfigured in any case. */
|
314
|
$reloadif = true;
|
315
|
}
|
316
|
$config['interfaces'][$ifname]['if'] = $ifport;
|
317
|
if (isset($portlist[$ifport]['isppp']))
|
318
|
$config['interfaces'][$ifname]['ipaddr'] = $portlist[$ifport]['type'];
|
319
|
|
320
|
if (substr($ifport, 0, 3) == 'gre' || substr($ifport, 0, 3) == 'gif') {
|
321
|
unset($config['interfaces'][$ifname]['ipaddr']);
|
322
|
unset($config['interfaces'][$ifname]['subnet']);
|
323
|
unset($config['interfaces'][$ifname]['ipaddrv6']);
|
324
|
unset($config['interfaces'][$ifname]['subnetv6']);
|
325
|
}
|
326
|
|
327
|
/* check for wireless interfaces, set or clear ['wireless'] */
|
328
|
if (preg_match($g['wireless_regex'], $ifport)) {
|
329
|
if (!is_array($config['interfaces'][$ifname]['wireless']))
|
330
|
$config['interfaces'][$ifname]['wireless'] = array();
|
331
|
} else {
|
332
|
unset($config['interfaces'][$ifname]['wireless']);
|
333
|
}
|
334
|
|
335
|
/* make sure there is a descr for all interfaces */
|
336
|
if (!isset($config['interfaces'][$ifname]['descr']))
|
337
|
$config['interfaces'][$ifname]['descr'] = strtoupper($ifname);
|
338
|
|
339
|
if ($reloadif == true) {
|
340
|
if (preg_match($g['wireless_regex'], $ifport))
|
341
|
interface_sync_wireless_clones($config['interfaces'][$ifname], false);
|
342
|
/* Reload all for the interface. */
|
343
|
interface_configure($ifname, true);
|
344
|
}
|
345
|
}
|
346
|
}
|
347
|
}
|
348
|
|
349
|
write_config();
|
350
|
|
351
|
enable_rrd_graphing();
|
352
|
}
|
353
|
} else {
|
354
|
/* yuck - IE won't send value attributes for image buttons, while Mozilla does - so we use .x/.y to find move button clicks instead... */
|
355
|
unset($delbtn);
|
356
|
foreach ($_POST as $pn => $pd) {
|
357
|
if (preg_match("/del_(.+)_x/", $pn, $matches))
|
358
|
$delbtn = $matches[1];
|
359
|
}
|
360
|
|
361
|
if (isset($delbtn)) {
|
362
|
$id = $delbtn;
|
363
|
|
364
|
if (link_interface_to_group($id))
|
365
|
$input_errors[] = gettext("The interface is part of a group. Please remove it from the group to continue");
|
366
|
else if (link_interface_to_bridge($id))
|
367
|
$input_errors[] = gettext("The interface is part of a bridge. Please remove it from the bridge to continue");
|
368
|
else if (link_interface_to_gre($id))
|
369
|
$input_errors[] = gettext("The interface is part of a gre tunnel. Please delete the tunnel to continue");
|
370
|
else if (link_interface_to_gif($id))
|
371
|
$input_errors[] = gettext("The interface is part of a gif tunnel. Please delete the tunnel to continue");
|
372
|
else {
|
373
|
unset($config['interfaces'][$id]['enable']);
|
374
|
$realid = get_real_interface($id);
|
375
|
interface_bring_down($id); /* down the interface */
|
376
|
|
377
|
unset($config['interfaces'][$id]); /* delete the specified OPTn or LAN*/
|
378
|
|
379
|
if (is_array($config['dhcpd']) && is_array($config['dhcpd'][$id])) {
|
380
|
unset($config['dhcpd'][$id]);
|
381
|
services_dhcpd_configure();
|
382
|
}
|
383
|
|
384
|
if (count($config['filter']['rule']) > 0) {
|
385
|
foreach ($config['filter']['rule'] as $x => $rule) {
|
386
|
if($rule['interface'] == $id)
|
387
|
unset($config['filter']['rule'][$x]);
|
388
|
}
|
389
|
}
|
390
|
if (is_array($config['nat']['rule']) && count($config['nat']['rule']) > 0) {
|
391
|
foreach ($config['nat']['rule'] as $x => $rule) {
|
392
|
if($rule['interface'] == $id)
|
393
|
unset($config['nat']['rule'][$x]['interface']);
|
394
|
}
|
395
|
}
|
396
|
|
397
|
write_config();
|
398
|
|
399
|
/* If we are in firewall/routing mode (not single interface)
|
400
|
* then ensure that we are not running DHCP on the wan which
|
401
|
* will make a lot of ISP's unhappy.
|
402
|
*/
|
403
|
if($config['interfaces']['lan'] && $config['dhcpd']['wan']) {
|
404
|
unset($config['dhcpd']['wan']);
|
405
|
}
|
406
|
|
407
|
link_interface_to_vlans($realid, "update");
|
408
|
|
409
|
$savemsg = gettext("Interface has been deleted.");
|
410
|
}
|
411
|
}
|
412
|
}
|
413
|
|
414
|
/* Create a list of unused ports */
|
415
|
$unused_portlist = array();
|
416
|
foreach ($portlist as $portname => $portinfo) {
|
417
|
$portused = false;
|
418
|
foreach ($config['interfaces'] as $ifname => $ifdata) {
|
419
|
if ($ifdata['if'] == $portname) {
|
420
|
$portused = true;
|
421
|
break;
|
422
|
}
|
423
|
}
|
424
|
if ($portused === false)
|
425
|
$unused_portlist[$portname] = $portinfo;
|
426
|
}
|
427
|
|
428
|
include("head.inc");
|
429
|
|
430
|
if(file_exists("/var/run/interface_mismatch_reboot_needed"))
|
431
|
if ($_POST) {
|
432
|
if($rebootingnow)
|
433
|
$savemsg = gettext("The system is now rebooting. Please wait.");
|
434
|
else
|
435
|
$savemsg = gettext("Reboot is needed. Please apply the settings in order to reboot.");
|
436
|
} else {
|
437
|
$savemsg = gettext("Interface mismatch detected. Please resolve the mismatch and click 'Apply changes'. The firewall will reboot afterwards.");
|
438
|
}
|
439
|
?>
|
440
|
|
441
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
442
|
<?php include("fbegin.inc"); ?>
|
443
|
|
444
|
<form action="interfaces_assign.php" method="post" name="iform" id="iform">
|
445
|
|
446
|
<?php
|
447
|
if (file_exists("/tmp/reload_interfaces")) {
|
448
|
echo "<p>\n";
|
449
|
print_info_box_np(gettext("The interface configuration has been changed.<br />You must apply the changes in order for them to take effect."));
|
450
|
echo "<br /></p>\n";
|
451
|
} elseif($savemsg)
|
452
|
print_info_box($savemsg);
|
453
|
|
454
|
pfSense_handle_custom_code("/usr/local/pkg/interfaces_assign/pre_input_errors");
|
455
|
if ($input_errors)
|
456
|
print_input_errors($input_errors);
|
457
|
?>
|
458
|
|
459
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces assign">
|
460
|
<tr><td class="tabnavtbl">
|
461
|
<?php
|
462
|
$tab_array = array();
|
463
|
$tab_array[0] = array(gettext("Interface assignments"), true, "interfaces_assign.php");
|
464
|
$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
|
465
|
$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
|
466
|
$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
|
467
|
$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
|
468
|
$tab_array[5] = array(gettext("PPPs"), false, "interfaces_ppps.php");
|
469
|
$tab_array[7] = array(gettext("GRE"), false, "interfaces_gre.php");
|
470
|
$tab_array[8] = array(gettext("GIF"), false, "interfaces_gif.php");
|
471
|
$tab_array[9] = array(gettext("Bridges"), false, "interfaces_bridge.php");
|
472
|
$tab_array[10] = array(gettext("LAGG"), false, "interfaces_lagg.php");
|
473
|
display_top_tabs($tab_array);
|
474
|
?>
|
475
|
</td></tr>
|
476
|
<tr><td>
|
477
|
<div id="mainarea">
|
478
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
|
479
|
<tr>
|
480
|
<td class="listhdrr"><?=gettext("Interface"); ?></td>
|
481
|
<td class="listhdr"><?=gettext("Network port"); ?></td>
|
482
|
<td class="list"> </td>
|
483
|
</tr>
|
484
|
<?php
|
485
|
foreach ($config['interfaces'] as $ifname => $iface):
|
486
|
if ($iface['descr'])
|
487
|
$ifdescr = $iface['descr'];
|
488
|
else
|
489
|
$ifdescr = strtoupper($ifname);
|
490
|
?>
|
491
|
<tr>
|
492
|
<td class="listlr" valign="middle"><strong><u><span onclick="location.href='/interfaces.php?if=<?=$ifname;?>'" style="cursor: pointer;"><?=$ifdescr;?></span></u></strong></td>
|
493
|
<td valign="middle" class="listr">
|
494
|
<select onchange="javascript:jQuery('#savediv').show();" name="<?=$ifname;?>" id="<?=$ifname;?>">
|
495
|
<?php
|
496
|
foreach ($portlist as $portname => $portinfo):
|
497
|
?>
|
498
|
<option value="<?=$portname;?>" <?php if ($portname == $iface['if']) echo " selected=\"selected\"";?>>
|
499
|
<?=interface_assign_description($portinfo, $portname);?>
|
500
|
</option>
|
501
|
<?php
|
502
|
endforeach;
|
503
|
?>
|
504
|
</select>
|
505
|
</td>
|
506
|
<td valign="middle" class="list">
|
507
|
<?php
|
508
|
if ($ifname != 'wan'):
|
509
|
?>
|
510
|
<input name="del_<?=$ifname;?>" src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif"
|
511
|
title="<?=gettext("delete interface");?>"
|
512
|
type="image" style="height:17;width:17;border:0"
|
513
|
onclick="return confirm('<?=gettext("Do you really want to delete this interface?"); ?>')" />
|
514
|
<?php
|
515
|
endif;
|
516
|
?>
|
517
|
</td>
|
518
|
</tr>
|
519
|
<?php
|
520
|
endforeach;
|
521
|
if (count($config['interfaces']) < count($portlist)):
|
522
|
?>
|
523
|
<tr>
|
524
|
<td class="list">
|
525
|
<strong><?=gettext("Available network ports:");?></strong>
|
526
|
</td>
|
527
|
<td class="list">
|
528
|
<select name="if_add" id="if_add">
|
529
|
<?php
|
530
|
foreach ($unused_portlist as $portname => $portinfo):
|
531
|
?>
|
532
|
<option value="<?=$portname;?>" <?php if ($portname == $iface['if']) echo " selected=\"selected\"";?>>
|
533
|
<?=interface_assign_description($portinfo, $portname);?>
|
534
|
</option>
|
535
|
<?php
|
536
|
endforeach;
|
537
|
?>
|
538
|
</select>
|
539
|
</td>
|
540
|
<td class="list">
|
541
|
<input name="add" type="image" src="/themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" style="width:17;height:17;border:0" title="<?=gettext("add selected interface");?>" />
|
542
|
</td>
|
543
|
</tr>
|
544
|
<?php
|
545
|
endif;
|
546
|
?>
|
547
|
</table>
|
548
|
</div>
|
549
|
<br />
|
550
|
<div id='savediv' style='display:none'>
|
551
|
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" /><br /><br />
|
552
|
</div>
|
553
|
<ul>
|
554
|
<li><span class="vexpl"><?=gettext("Interfaces that are configured as members of a lagg(4) interface will not be shown."); ?></span></li>
|
555
|
</ul>
|
556
|
</td></tr>
|
557
|
</table>
|
558
|
</form>
|
559
|
<?php include("fend.inc"); ?>
|
560
|
</body>
|
561
|
</html>
|