Project

General

Profile

Download (19.9 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	interfaces_assign.php
4
*/
5
/* ====================================================================
6
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
7
 *	Written by Jim McBeath based on existing m0n0wall files
8
 *
9
 *  Some or all of this file is based on the m0n0wall project which is
10
 *  Copyright (c)  2004 Manuel Kasper (BSD 2 clause)
11
 *
12
 *	Redistribution and use in source and binary forms, with or without modification,
13
 *	are permitted provided that the following conditions are met:
14
 *
15
 *	1. Redistributions of source code must retain the above copyright notice,
16
 *		this list of conditions and the following disclaimer.
17
 *
18
 *	2. Redistributions in binary form must reproduce the above copyright
19
 *		notice, this list of conditions and the following disclaimer in
20
 *		the documentation and/or other materials provided with the
21
 *		distribution.
22
 *
23
 *	3. All advertising materials mentioning features or use of this software
24
 *		must display the following acknowledgment:
25
 *		"This product includes software developed by the pfSense Project
26
 *		 for use in the pfSense software distribution. (http://www.pfsense.org/).
27
 *
28
 *	4. The names "pfSense" and "pfSense Project" must not be used to
29
 *		 endorse or promote products derived from this software without
30
 *		 prior written permission. For written permission, please contact
31
 *		 coreteam@pfsense.org.
32
 *
33
 *	5. Products derived from this software may not be called "pfSense"
34
 *		nor may "pfSense" appear in their names without prior written
35
 *		permission of the Electric Sheep Fencing, LLC.
36
 *
37
 *	6. Redistributions of any form whatsoever must retain the following
38
 *		acknowledgment:
39
 *
40
 *	"This product includes software developed by the pfSense Project
41
 *	for use in the pfSense software distribution (http://www.pfsense.org/).
42
 *
43
 *	THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
44
 *	EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45
 *	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
46
 *	PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
47
 *	ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48
 *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
49
 *	NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
50
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
51
 *	HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
52
 *	STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
53
 *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
54
 *	OF THE POSSIBILITY OF SUCH DAMAGE.
55
 *
56
 *	====================================================================
57
 *
58
 */
59

    
60
##|+PRIV
61
##|*IDENT=page-interfaces-assignnetworkports
62
##|*NAME=Interfaces: Interface Assignments
63
##|*DESCR=Allow access to the 'Interfaces: Interface Assignments' page.
64
##|*MATCH=interfaces_assign.php*
65
##|-PRIV
66

    
67
$pgtitle = array(gettext("Interfaces"), gettext("Interface Assignments"));
68
$shortcut_section = "interfaces";
69

    
70
require("guiconfig.inc");
71
require("functions.inc");
72
require_once("filter.inc");
73
require("shaper.inc");
74
require("ipsec.inc");
75
require("vpn.inc");
76
require("captiveportal.inc");
77
require_once("rrd.inc");
78

    
79
function interface_assign_description($portinfo, $portname) {
80
	global $ovpn_descrs;
81
	if ($portinfo['isvlan']) {
82
		$descr = sprintf(gettext('VLAN %1$s on %2$s'), $portinfo['tag'], $portinfo['if']);
83
		$iface = convert_real_interface_to_friendly_interface_name($portinfo['if']);
84
		if (isset($iface) && strlen($iface) > 0) {
85
			$descr .= " - $iface";
86
		}
87
		if ($portinfo['descr']) {
88
			$descr .= " (" . $portinfo['descr'] . ")";
89
		}
90
	} elseif ($portinfo['iswlclone']) {
91
		$descr = $portinfo['cloneif'];
92
		if ($portinfo['descr']) {
93
			$descr .= " (" . $portinfo['descr'] . ")";
94
		}
95
	} elseif ($portinfo['isppp']) {
96
		$descr = $portinfo['descr'];
97
	} elseif ($portinfo['isbridge']) {
98
		$descr = strtoupper($portinfo['bridgeif']);
99
		if ($portinfo['descr']) {
100
			$descr .= " (" . $portinfo['descr'] . ")";
101
		}
102
	} elseif ($portinfo['isgre']) {
103
		$descr = "GRE {$portinfo['remote-addr']}";
104
		if ($portinfo['descr']) {
105
			$descr .= " (" . $portinfo['descr'] . ")";
106
		}
107
	} elseif ($portinfo['isgif']) {
108
		$descr = "GIF {$portinfo['remote-addr']}";
109
		if ($portinfo['descr']) {
110
			$descr .= " (" . $portinfo['descr'] . ")";
111
		}
112
	} elseif ($portinfo['islagg']) {
113
		$descr = strtoupper($portinfo['laggif']);
114
		if ($portinfo['descr']) {
115
			$descr .= " (" . $portinfo['descr'] . ")";
116
		}
117
	} elseif ($portinfo['isqinq']) {
118
		$descr = $portinfo['descr'];
119
	} elseif (substr($portname, 0, 4) == 'ovpn') {
120
		$descr = $portname . " (" . $ovpn_descrs[substr($portname, 5)] . ")";
121
	} else {
122
		$descr = $portname . " (" . $portinfo['mac'] . ")";
123
	}
124

    
125
	return htmlspecialchars($descr);
126
}
127

    
128
/*
129
	In this file, "port" refers to the physical port name,
130
	while "interface" refers to LAN, WAN, or OPTn.
131
*/
132

    
133
/* get list without VLAN interfaces */
134
$portlist = get_interface_list();
135

    
136
/* add wireless clone interfaces */
137
if (is_array($config['wireless']['clone']) && count($config['wireless']['clone'])) {
138
	foreach ($config['wireless']['clone'] as $clone) {
139
		$portlist[$clone['cloneif']] = $clone;
140
		$portlist[$clone['cloneif']]['iswlclone'] = true;
141
	}
142
}
143

    
144
/* add VLAN interfaces */
145
if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
146
	foreach ($config['vlans']['vlan'] as $vlan) {
147
		$portlist[$vlan['vlanif']] = $vlan;
148
		$portlist[$vlan['vlanif']]['isvlan'] = true;
149
	}
150
}
151

    
152
/* add Bridge interfaces */
153
if (is_array($config['bridges']['bridged']) && count($config['bridges']['bridged'])) {
154
	foreach ($config['bridges']['bridged'] as $bridge) {
155
		$portlist[$bridge['bridgeif']] = $bridge;
156
		$portlist[$bridge['bridgeif']]['isbridge'] = true;
157
	}
158
}
159

    
160
/* add GIF interfaces */
161
if (is_array($config['gifs']['gif']) && count($config['gifs']['gif'])) {
162
	foreach ($config['gifs']['gif'] as $gif) {
163
		$portlist[$gif['gifif']] = $gif;
164
		$portlist[$gif['gifif']]['isgif'] = true;
165
	}
166
}
167

    
168
/* add GRE interfaces */
169
if (is_array($config['gres']['gre']) && count($config['gres']['gre'])) {
170
	foreach ($config['gres']['gre'] as $gre) {
171
		$portlist[$gre['greif']] = $gre;
172
		$portlist[$gre['greif']]['isgre'] = true;
173
	}
174
}
175

    
176
/* add LAGG interfaces */
177
if (is_array($config['laggs']['lagg']) && count($config['laggs']['lagg'])) {
178
	foreach ($config['laggs']['lagg'] as $lagg) {
179
		$portlist[$lagg['laggif']] = $lagg;
180
		$portlist[$lagg['laggif']]['islagg'] = true;
181
		/* LAGG members cannot be assigned */
182
		$lagifs = explode(',', $lagg['members']);
183
		foreach ($lagifs as $lagif) {
184
			if (isset($portlist[$lagif])) {
185
				unset($portlist[$lagif]);
186
			}
187
		}
188
	}
189
}
190

    
191
/* add QinQ interfaces */
192
if (is_array($config['qinqs']['qinqentry']) && count($config['qinqs']['qinqentry'])) {
193
	foreach ($config['qinqs']['qinqentry'] as $qinq) {
194
		$portlist["vlan{$qinq['tag']}"]['descr'] = "VLAN {$qinq['tag']}";
195
		$portlist["vlan{$qinq['tag']}"]['isqinq'] = true;
196
		/* QinQ members */
197
		$qinqifs = explode(' ', $qinq['members']);
198
		foreach ($qinqifs as $qinqif) {
199
			$portlist["vlan{$qinq['tag']}_{$qinqif}"]['descr'] = "QinQ {$qinqif}";
200
			$portlist["vlan{$qinq['tag']}_{$qinqif}"]['isqinq'] = true;
201
		}
202
	}
203
}
204

    
205
/* add PPP interfaces */
206
if (is_array($config['ppps']['ppp']) && count($config['ppps']['ppp'])) {
207
	foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
208
		$portname = $ppp['if'];
209
		$portlist[$portname] = $ppp;
210
		$portlist[$portname]['isppp'] = true;
211
		$ports_base = basename($ppp['ports']);
212
		if (isset($ppp['descr'])) {
213
			$portlist[$portname]['descr'] = strtoupper($ppp['if']). "({$ports_base}) - {$ppp['descr']}";
214
		} else if (isset($ppp['username'])) {
215
			$portlist[$portname]['descr'] = strtoupper($ppp['if']). "({$ports_base}) - {$ppp['username']}";
216
		} else {
217
			$portlist[$portname]['descr'] = strtoupper($ppp['if']). "({$ports_base})";
218
		}
219
	}
220
}
221

    
222
$ovpn_descrs = array();
223
if (is_array($config['openvpn'])) {
224
	if (is_array($config['openvpn']['openvpn-server'])) {
225
		foreach ($config['openvpn']['openvpn-server'] as $s) {
226
			$portname = "ovpns{$s['vpnid']}";
227
			$portlist[$portname] = $s;
228
			$ovpn_descrs[$s['vpnid']] = $s['description'];
229
		}
230
	}
231
	if (is_array($config['openvpn']['openvpn-client'])) {
232
		foreach ($config['openvpn']['openvpn-client'] as $c) {
233
			$portname = "ovpnc{$c['vpnid']}";
234
			$portlist[$portname] = $c;
235
			$ovpn_descrs[$c['vpnid']] = $c['description'];
236
		}
237
	}
238
}
239

    
240
if (isset($_POST['add']) && isset($_POST['if_add'])) {
241
	/* Be sure this port is not being used */
242
	$portused = false;
243
	foreach ($config['interfaces'] as $ifname => $ifdata) {
244
		if ($ifdata['if'] == $_POST['if_add']) {
245
			$portused = true;
246
			break;
247
		}
248
	}
249

    
250
	if ($portused === false) {
251
		/* find next free optional interface number */
252
		if (!$config['interfaces']['lan']) {
253
			$newifname = gettext("lan");
254
			$descr = gettext("LAN");
255
		} else {
256
			for ($i = 1; $i <= count($config['interfaces']); $i++) {
257
				if (!$config['interfaces']["opt{$i}"]) {
258
					break;
259
				}
260
			}
261
			$newifname = 'opt' . $i;
262
			$descr = "OPT" . $i;
263
		}
264

    
265
		$config['interfaces'][$newifname] = array();
266
		$config['interfaces'][$newifname]['descr'] = $descr;
267
		$config['interfaces'][$newifname]['if'] = $_POST['if_add'];
268
		if (preg_match($g['wireless_regex'], $_POST['if_add'])) {
269
			$config['interfaces'][$newifname]['wireless'] = array();
270
			interface_sync_wireless_clones($config['interfaces'][$newifname], false);
271
		}
272

    
273
		uksort($config['interfaces'], "compare_interface_friendly_names");
274

    
275
		/* XXX: Do not remove this. */
276
		unlink_if_exists("{$g['tmp_path']}/config.cache");
277

    
278
		write_config();
279

    
280
		$savemsg = gettext("Interface has been added.");
281
		$class = "success";
282
	}
283

    
284
} else if (isset($_POST['apply'])) {
285
	if (file_exists("/var/run/interface_mismatch_reboot_needed")) {
286
		system_reboot();
287
		$rebootingnow = true;
288
	} else {
289
		write_config();
290

    
291
		$retval = filter_configure();
292

    
293
		if (stristr($retval, "error") <> true) {
294
			$savemsg = get_std_save_message($retval);
295
			$class = "success";
296
		} else {
297
			$savemsg = $retval;
298
			$class = "danger";
299
		}
300
	}
301

    
302
} else if (isset($_POST['Submit'])) {
303

    
304
	unset($input_errors);
305

    
306
	/* input validation */
307

    
308
	/* Build a list of the port names so we can see how the interfaces map */
309
	$portifmap = array();
310
	foreach ($portlist as $portname => $portinfo) {
311
		$portifmap[$portname] = array();
312
	}
313

    
314
	/* Go through the list of ports selected by the user,
315
	build a list of port-to-interface mappings in portifmap */
316
	foreach ($_POST as $ifname => $ifport) {
317
		if (($ifname == 'lan') || ($ifname == 'wan') || (substr($ifname, 0, 3) == 'opt')) {
318
			$portifmap[$ifport][] = strtoupper($ifname);
319
		}
320
	}
321

    
322
	/* Deliver error message for any port with more than one assignment */
323
	foreach ($portifmap as $portname => $ifnames) {
324
		if (count($ifnames) > 1) {
325
			$errstr = sprintf(gettext('Port %1$s '.
326
				' was assigned to %2$s' .
327
				' interfaces:'), $portname, count($ifnames));
328

    
329
			foreach ($portifmap[$portname] as $ifn) {
330
				$errstr .= " " . convert_friendly_interface_to_friendly_descr(strtolower($ifn)) . " (" . $ifn . ")";
331
			}
332

    
333
			$input_errors[] = $errstr;
334
		} else if (count($ifnames) == 1 && preg_match('/^bridge[0-9]/', $portname) && is_array($config['bridges']['bridged']) && count($config['bridges']['bridged'])) {
335
			foreach ($config['bridges']['bridged'] as $bridge) {
336
				if ($bridge['bridgeif'] != $portname) {
337
					continue;
338
				}
339

    
340
				$members = explode(",", strtoupper($bridge['members']));
341
				foreach ($members as $member) {
342
					if ($member == $ifnames[0]) {
343
						$input_errors[] = sprintf(gettext('Cannot set port %1$s to interface %2$s because this interface is a member of %3$s.'), $portname, $member, $portname);
344
						break;
345
					}
346
				}
347
			}
348
		}
349
	}
350

    
351
	if (is_array($config['vlans']['vlan'])) {
352
		foreach ($config['vlans']['vlan'] as $vlan) {
353
			if (does_interface_exist($vlan['if']) == false) {
354
				$input_errors[] = sprintf(gettext('Vlan parent interface %1$s does not exist anymore so vlan id %2$s cannot be created please fix the issue before continuing.'), $vlan['if'], $vlan['tag']);
355
			}
356
		}
357
	}
358

    
359
	if (!$input_errors) {
360
		/* No errors detected, so update the config */
361
		foreach ($_POST as $ifname => $ifport) {
362

    
363
			if (($ifname == 'lan') || ($ifname == 'wan') || (substr($ifname, 0, 3) == 'opt')) {
364

    
365
				if (!is_array($ifport)) {
366
					$reloadif = false;
367
					if (!empty($config['interfaces'][$ifname]['if']) && $config['interfaces'][$ifname]['if'] <> $ifport) {
368
						interface_bring_down($ifname);
369
						/* Mark this to be reconfigured in any case. */
370
						$reloadif = true;
371
					}
372
					$config['interfaces'][$ifname]['if'] = $ifport;
373
					if (isset($portlist[$ifport]['isppp'])) {
374
						$config['interfaces'][$ifname]['ipaddr'] = $portlist[$ifport]['type'];
375
					}
376

    
377
					if (substr($ifport, 0, 3) == 'gre' || substr($ifport, 0, 3) == 'gif') {
378
						unset($config['interfaces'][$ifname]['ipaddr']);
379
						unset($config['interfaces'][$ifname]['subnet']);
380
						unset($config['interfaces'][$ifname]['ipaddrv6']);
381
						unset($config['interfaces'][$ifname]['subnetv6']);
382
					}
383

    
384
					/* check for wireless interfaces, set or clear ['wireless'] */
385
					if (preg_match($g['wireless_regex'], $ifport)) {
386
						if (!is_array($config['interfaces'][$ifname]['wireless'])) {
387
							$config['interfaces'][$ifname]['wireless'] = array();
388
						}
389
					} else {
390
						unset($config['interfaces'][$ifname]['wireless']);
391
					}
392

    
393
					/* make sure there is a descr for all interfaces */
394
					if (!isset($config['interfaces'][$ifname]['descr'])) {
395
						$config['interfaces'][$ifname]['descr'] = strtoupper($ifname);
396
					}
397

    
398
					if ($reloadif == true) {
399
						if (preg_match($g['wireless_regex'], $ifport)) {
400
							interface_sync_wireless_clones($config['interfaces'][$ifname], false);
401
						}
402
						/* Reload all for the interface. */
403
						interface_configure($ifname, true);
404
					}
405
				}
406
			}
407
		}
408

    
409
		write_config();
410

    
411
		enable_rrd_graphing();
412
	}
413
} else {
414
	unset($delbtn);
415
	if (!empty($_POST['del'])) {
416
		$delbtn = key($_POST['del']);
417
	}
418

    
419
	if (isset($delbtn)) {
420
		$id = $delbtn;
421

    
422
		if (link_interface_to_group($id)) {
423
			$input_errors[] = gettext("The interface is part of a group. Please remove it from the group to continue");
424
		} else if (link_interface_to_bridge($id)) {
425
			$input_errors[] = gettext("The interface is part of a bridge. Please remove it from the bridge to continue");
426
		} else if (link_interface_to_gre($id)) {
427
			$input_errors[] = gettext("The interface is part of a gre tunnel. Please delete the tunnel to continue");
428
		} else if (link_interface_to_gif($id)) {
429
			$input_errors[] = gettext("The interface is part of a gif tunnel. Please delete the tunnel to continue");
430
		} else {
431
			unset($config['interfaces'][$id]['enable']);
432
			$realid = get_real_interface($id);
433
			interface_bring_down($id);   /* down the interface */
434

    
435
			unset($config['interfaces'][$id]);	/* delete the specified OPTn or LAN*/
436

    
437
			if (is_array($config['dhcpd']) && is_array($config['dhcpd'][$id])) {
438
				unset($config['dhcpd'][$id]);
439
				services_dhcpd_configure();
440
			}
441

    
442
			if (is_array($config['dhcpdv6']) && is_array($config['dhcpdv6'][$id])) {
443
				unset($config['dhcpdv6'][$id]);
444
				services_dhcpdv6_configure();
445
			}
446

    
447
			if (count($config['filter']['rule']) > 0) {
448
				foreach ($config['filter']['rule'] as $x => $rule) {
449
					if ($rule['interface'] == $id) {
450
						unset($config['filter']['rule'][$x]);
451
					}
452
				}
453
			}
454
			if (is_array($config['nat']['rule']) && count($config['nat']['rule']) > 0) {
455
				foreach ($config['nat']['rule'] as $x => $rule) {
456
					if ($rule['interface'] == $id) {
457
						unset($config['nat']['rule'][$x]['interface']);
458
					}
459
				}
460
			}
461

    
462
			write_config();
463

    
464
			/* If we are in firewall/routing mode (not single interface)
465
			 * then ensure that we are not running DHCP on the wan which
466
			 * will make a lot of ISP's unhappy.
467
			 */
468
			if ($config['interfaces']['lan'] && $config['dhcpd']['wan']) {
469
				unset($config['dhcpd']['wan']);
470
			}
471

    
472
			link_interface_to_vlans($realid, "update");
473

    
474
			$savemsg = gettext("Interface has been deleted.");
475
			$class = "success";
476
		}
477
	}
478
}
479

    
480
/* Create a list of unused ports */
481
$unused_portlist = array();
482
foreach ($portlist as $portname => $portinfo) {
483
	$portused = false;
484
	foreach ($config['interfaces'] as $ifname => $ifdata) {
485
		if ($ifdata['if'] == $portname) {
486
			$portused = true;
487
			break;
488
		}
489
	}
490
	if ($portused === false) {
491
		$unused_portlist[$portname] = $portinfo;
492
	}
493
}
494

    
495
include("head.inc");
496

    
497
if (file_exists("/var/run/interface_mismatch_reboot_needed")) {
498
	if ($_POST) {
499
		if ($rebootingnow) {
500
			$savemsg = gettext("The system is now rebooting. Please wait.");
501
			$class = "success";
502
		} else {
503
			$savemsg = gettext("Reboot is needed. Please apply the settings in order to reboot.");
504
			$class = "warning";
505
		}
506
	} else {
507
		$savemsg = gettext("Interface mismatch detected. Please resolve the mismatch and click 'Apply Changes'. The firewall will reboot afterwards.");
508
		$class = "warning";
509
	}
510
}
511

    
512
if (file_exists("/tmp/reload_interfaces")) {
513
	echo "<p>\n";
514
	print_apply_box(gettext("The interface configuration has been changed.") . "<br />" . gettext("The changes must be applied for them to take effect."));
515
	echo "<br /></p>\n";
516
} elseif ($savemsg) {
517
	print_info_box($savemsg, $class);
518
}
519

    
520
pfSense_handle_custom_code("/usr/local/pkg/interfaces_assign/pre_input_errors");
521

    
522
if ($input_errors) {
523
	print_input_errors($input_errors);
524
}
525

    
526
$tab_array = array();
527
$tab_array[] = array(gettext("Interface Assignments"), true, "interfaces_assign.php");
528
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
529
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
530
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
531
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
532
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
533
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
534
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
535
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
536
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
537
display_top_tabs($tab_array);
538
?>
539
<form action="interfaces_assign.php" method="post">
540
	<div class="table-responsive">
541
	<table class="table table-striped table-hover">
542
	<thead>
543
		<tr>
544
			<th><?=gettext("Interface")?></th>
545
			<th><?=gettext("Network port")?></th>
546
			<th>&nbsp;</th>
547
		</tr>
548
	</thead>
549
	<tbody>
550
<?php
551
	foreach ($config['interfaces'] as $ifname => $iface):
552
		if ($iface['descr']) {
553
			$ifdescr = $iface['descr'];
554
		} else {
555
			$ifdescr = strtoupper($ifname);
556
		}
557
?>
558
		<tr>
559
			<td><a href="/interfaces.php?if=<?=$ifname?>"><?=$ifdescr?></a></td>
560
			<td>
561
				<select name="<?=$ifname?>" id="<?=$ifname?>" class="form-control">
562
<?php foreach ($portlist as $portname => $portinfo):?>
563
					<option value="<?=$portname?>" <?=($portname == $iface['if']) ? ' selected': ''?>>
564
						<?=interface_assign_description($portinfo, $portname)?>
565
					</option>
566
<?php endforeach;?>
567
				</select>
568
			</td>
569
			<td>
570
<?php if ($ifname != 'wan'):?>
571
				<button type="submit" name="del[<?=$ifname?>]" class="btn btn-danger btn-sm" title="<?=gettext("Delete interface")?>">
572
					<i class="fa fa-trash icon-embed-btn"></i>
573
					<?=gettext("Delete")?>
574
				</button>
575
<?php endif;?>
576
			</td>
577
		</tr>
578
<?php endforeach;
579
	if (count($config['interfaces']) < count($portlist)):
580
?>
581
		<tr>
582
			<th>
583
				<?=gettext("Available network ports:")?>
584
			</th>
585
			<td>
586
				<select name="if_add" id="if_add" class="form-control">
587
<?php foreach ($unused_portlist as $portname => $portinfo):?>
588
					<option value="<?=$portname?>" <?=($portname == $iface['if']) ? ' selected': ''?>>
589
						<?=interface_assign_description($portinfo, $portname)?>
590
					</option>
591
<?php endforeach;?>
592
				</select>
593
			</td>
594
			<td>
595
				<button type="submit" name="add" title="<?=gettext("Add selected interface")?>" value="add interface" class="btn btn-success btn-sm" >
596
					<i class="fa fa-plus icon-embed-btn"></i>
597
					<?=gettext("Add")?>
598
				</button>
599
			</td>
600
		</tr>
601
<?php endif;?>
602
		</tbody>
603
	</table>
604
	</div>
605

    
606
	<button name="Submit" type="submit" class="btn btn-primary" value="<?=gettext('Save')?>"><i class="fa fa-save icon-embed-btn"></i><?=gettext('Save')?></button>
607
</form>
608
<br />
609

    
610
<?php
611
print_info_box(gettext("Interfaces that are configured as members of a lagg(4) interface will not be shown."), 'info', false);
612
?>
613

    
614
<?php include("foot.inc")?>
(70-70/225)