Project

General

Profile

« Previous | Next » 

Revision e34c96a3

Added by Steve Beaver over 7 years ago

Revert "Merge pull request #3868 from loonylion/master"
Caused issues reported in https://redmine.pfsense.org/issues/8223
This reverts commit 74c55258b21ada7a542965c2470fbaa45ce19689, reversing
changes made to 2acb4025ee7fef074a67d1021a5e62a0aff9fd37.

View differences:

src/etc/inc/interfaces_fast.inc
1
<?php
2
/*
3
 * interfaces_fast.inc
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate) (pfSense)
7
 * Copyright (c) 2017 Peter Schofield (parts of this file)
8
 * All rights reserved.
9
 *
10
 * originally based on m0n0wall (http://m0n0.ch/wall)
11
 * Copyright (c) 2004 Manuel Kasper <mk@neon1.net>.
12
 * All rights reserved.
13
 *
14
 * Licensed under the Apache License, Version 2.0 (the "License");
15
 * you may not use this file except in compliance with the License.
16
 * You may obtain a copy of the License at
17
 *
18
 * http://www.apache.org/licenses/LICENSE-2.0
19
 *
20
 * Unless required by applicable law or agreed to in writing, software
21
 * distributed under the License is distributed on an "AS IS" BASIS,
22
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
 * See the License for the specific language governing permissions and
24
 * limitations under the License.
25
 *
26
 *
27
 * This file contains rewrites of several functions, from both interfaces.inc
28
 * and interfaces_assign.php. The general purpose of these rewrites is not
29
 * necessarily to be faster in and of themselves, though they may be, but to
30
 * replace functions called multiple times with a function that's called only
31
 * once. This results in a significant speedup because there are far fewer
32
 * function calls, fewer loops and suchlike. It does, however, increase memory
33
 * usage somewhat, but it shouldn't be significant in the grand scheme of things.
34
 *
35
 *
36
 * Functions in this file may not require/use parameters when called, however 
37
 * in most cases they will accept parameters as per their original forms, for 
38
 * consistency.
39
 
40
 */
41
require_once('interfaces.inc');
42
/*
43
* does_interface_exist_fast
44
Returns an array of interfaces which exist on the system.
45
The $interface parameter is not used, but is accepted for
46
consistency with the function it replaces.
47
*/
48
function does_interface_exist_fast($interface='', $flush = true) {
49
	global $config;
50

  
51
	$ints = get_interface_arr($flush);
52
	return array_flip($ints);
53
}
54

  
55
/*
56
 * convert_real_interface_to_friendly_interface_name_fast($interface): convert fxp0 -> wan, etc.
57
 Returns an array of interfaces and friendly names.
58
 */
59
function convert_real_interface_to_friendly_interface_name_fast() {
60
	global $config;
61

  
62
	$out = array();
63
	/* XXX: For speed reasons reference directly the interface array */
64
	$ifdescrs = &$config['interfaces'];
65
	$iffriendlynames = array_keys($ifdescrs);
66
	$out = array_flip(get_real_interface_fast($iffriendlynames));
67
	return $out;
68
}
69

  
70
/* 
71
 * get_real_interface_fast($interfaces, ...)
72
 * Exactly the same as it's namesake, except it takes an array of interfaces and returns an array
73
 *
74
 */
75

  
76
function get_real_interface_fast($interfaces = array(), $family = "all", $realv6iface = false, $flush = true) {
77
	global $config, $g;
78

  
79
	$existing_ifs = does_interface_exist_fast();
80

  
81
	$out = array();
82
	foreach ($interfaces as $interface) {
83
		$wanif = NULL;
84

  
85
		switch ($interface) {
86
			case "l2tp":
87
				$wanif = "l2tp";
88
				break;
89
			case "pptp":
90
				$wanif = "pptp";
91
				break;
92
			case "pppoe":
93
				$wanif = "pppoe";
94
				break;
95
			case "openvpn":
96
				$wanif = "openvpn";
97
				break;
98
			case "IPsec":
99
			case "ipsec":
100
			case "enc0":
101
				$wanif = "enc0";
102
				break;
103
			case "ppp":
104
				$wanif = "ppp";
105
				break;
106
			default:
107
				if (substr($interface, 0, 4) == '_vip') {
108
					$wanif = get_configured_vip_interface($interface);
109
					if (!empty($wanif)) {
110
						$wanif = get_real_interface($wanif);
111
					}
112
					break;
113
				} else if (substr($interface, 0, 5) == '_lloc') {
114
					$interface = substr($interface, 5);
115
				} else if (strstr($interface, "_vlan") || isset($existing_ifs[$interface])) {
116
					/*
117
					 * If a real interface was already passed simply
118
					 * pass the real interface back.  This encourages
119
					 * the usage of this function in more cases so that
120
					 * we can combine logic for more flexibility.
121
					 */
122
					$wanif = $interface;
123
					break;
124
				}
125

  
126
				if (empty($config['interfaces'][$interface])) {
127
					break;
128
				}
129

  
130
				$cfg = &$config['interfaces'][$interface];
131

  
132
				if ($family == "inet6") {
133
					switch ($cfg['ipaddrv6']) {
134
						case "6rd":
135
						case "6to4":
136
							$wanif = "{$interface}_stf";
137
							break;
138
						case 'pppoe':
139
						case 'ppp':
140
						case 'l2tp':
141
						case 'pptp':
142
							if (is_array($cfg['wireless']) || preg_match($g['wireless_regex'], $cfg['if'])) {
143
								$wanif = interface_get_wireless_clone($cfg['if']);
144
							} else {
145
								$wanif = $cfg['if'];
146
							}
147
							break;
148
						default:
149
							switch ($cfg['ipaddr']) {
150
								case 'pppoe':
151
								case 'ppp':
152
								case 'l2tp':
153
								case 'pptp':
154
									if (isset($cfg['dhcp6usev4iface']) && $realv6iface === false) {
155
										$wanif = $cfg['if'];
156
									} else {
157
										$parents = get_parent_interface($interface);
158
										if (!empty($parents[0])) {
159
											$wanif = $parents[0];
160
										} else {
161
											$wanif = $cfg['if'];
162
										}
163
									}
164
									break;
165
								default:
166
									if (is_array($cfg['wireless']) || preg_match($g['wireless_regex'], $cfg['if'])) {
167
										$wanif = interface_get_wireless_clone($cfg['if']);
168
									} else {
169
										$wanif = $cfg['if'];
170
									}
171
									break;
172
							}
173
							break;
174
					}
175
				} else {
176
					// Wireless cloned NIC support (FreeBSD 8+)
177
					// interface name format: $parentnic_wlanparentnic#
178
					// example: ath0_wlan0
179
					if (is_array($cfg['wireless']) || preg_match($g['wireless_regex'], $cfg['if'])) {
180
						$wanif = interface_get_wireless_clone($cfg['if']);
181
					} else {
182
						$wanif = $cfg['if'];
183
					}
184
				}
185
				break;
186
		}
187
		$out[$interface] = $wanif;
188
	}
189

  
190
	return $out;
191
}
192
/*
193
 * interface_assign_description_fast($portlist, $friendlyifnames)
194
 *
195
 * This function replaces the function defined in interfaces_assign.php
196
 *
197
 * I created this version of the function because in interfaces_assign.php
198
 * the interface_assign_description() function is used twice, in both cases
199
 * being called for every iteration through the array of interfaces, and 
200
 * was seemingly dragging the performance of the HTML generation code down 
201
 * when faced with a large number of VLAN interfaces.
202
 *
203
 * Although this function internally recreates the loop that its namesake was
204
 * called in; the fact it's only called once rather than once per interface * 2
205
 * has resulted in a significant speed gain with a large number of optional 
206
 * interfaces configured.
207
 *
208
 * $portlist is the same $portlist as defined in interfaces_assign.php, call this
209
 * function after all the optional interfaces are added to $portlist.
210
 *
211
 * $friendlyifnames is a global variable of my own making, created by calling
212
 * convert_real_interface_to_friendly_interface_name_fast() on the keys of $portlist.
213
 *
214
 * Return value of this function is an associative array of interface descriptions
215
 * indexed by the unique name of the interface.
216
 *
217
 */
218
function interface_assign_description_fast($portlist, $friendlyifnames) {
219
	global $ovpn_descrs;
220
	$out = array();
221
	$gettext = gettext('on');
222
	foreach($portlist as $portname => $portinfo) {
223
		if ($portinfo['isvlan']) {
224
			$descr = sprintf('VLAN %1$s '.$gettext.' %2$s', $portinfo['tag'], $portinfo['if']);
225
			$iface = $friendlyifnames[$portinfo['if']];
226
			if (isset($iface) && strlen($iface) > 0) {
227
				$descr .= " - $iface";
228
			}
229
			if ($portinfo['descr']) {
230
				$descr .= " (" . $portinfo['descr'] . ")";
231
			}
232
		} elseif ($portinfo['iswlclone']) {
233
			$descr = $portinfo['cloneif'];
234
			if ($portinfo['descr']) {
235
				$descr .= " (" . $portinfo['descr'] . ")";
236
			}
237
		} elseif ($portinfo['isppp']) {
238
			$descr = $portinfo['descr'];
239
		} elseif ($portinfo['isbridge']) {
240
			$descr = strtoupper($portinfo['bridgeif']);
241
			if ($portinfo['descr']) {
242
				$descr .= " (" . $portinfo['descr'] . ")";
243
			}
244
		} elseif ($portinfo['isgre']) {
245
			$descr = "GRE {$portinfo['remote-addr']}";
246
			if ($portinfo['descr']) {
247
				$descr .= " (" . $portinfo['descr'] . ")";
248
			}
249
		} elseif ($portinfo['isgif']) {
250
			$descr = "GIF {$portinfo['remote-addr']}";
251
			if ($portinfo['descr']) {
252
				$descr .= " (" . $portinfo['descr'] . ")";
253
			}
254
		} elseif ($portinfo['islagg']) {
255
			$descr = strtoupper($portinfo['laggif']);
256
			if ($portinfo['descr']) {
257
				$descr .= " (" . $portinfo['descr'] . ")";
258
			}
259
		} elseif ($portinfo['isqinq']) {
260
			$descr = $portinfo['descr'];
261
		} elseif (substr($portname, 0, 4) == 'ovpn') {
262
			$descr = $portname . " (" . $ovpn_descrs[substr($portname, 5)] . ")";
263
		} else {
264
			$descr = $portname . " (" . $portinfo['mac'] . ")";
265
		}
266
		$out[$portname] = htmlspecialchars($descr);
267
	}
268
	return $out;
269
}
270
?>
src/usr/local/www/interfaces_assign.php
31 31
##|*MATCH=interfaces_assign.php*
32 32
##|-PRIV
33 33

  
34
//$timealla = microtime(true);
35

  
36 34
$pgtitle = array(gettext("Interfaces"), gettext("Interface Assignments"));
37 35
$shortcut_section = "interfaces";
38 36

  
......
44 42
require_once("vpn.inc");
45 43
require_once("captiveportal.inc");
46 44
require_once("rrd.inc");
47
require_once("interfaces_fast.inc");
48 45

  
49
global $friendlyifnames;
46
function interface_assign_description($portinfo, $portname) {
47
	global $ovpn_descrs;
48
	if ($portinfo['isvlan']) {
49
		$descr = sprintf(gettext('VLAN %1$s on %2$s'), $portinfo['tag'], $portinfo['if']);
50
		$iface = convert_real_interface_to_friendly_interface_name($portinfo['if']);
51
		if (isset($iface) && strlen($iface) > 0) {
52
			$descr .= " - $iface";
53
		}
54
		if ($portinfo['descr']) {
55
			$descr .= " (" . $portinfo['descr'] . ")";
56
		}
57
	} elseif ($portinfo['iswlclone']) {
58
		$descr = $portinfo['cloneif'];
59
		if ($portinfo['descr']) {
60
			$descr .= " (" . $portinfo['descr'] . ")";
61
		}
62
	} elseif ($portinfo['isppp']) {
63
		$descr = $portinfo['descr'];
64
	} elseif ($portinfo['isbridge']) {
65
		$descr = strtoupper($portinfo['bridgeif']);
66
		if ($portinfo['descr']) {
67
			$descr .= " (" . $portinfo['descr'] . ")";
68
		}
69
	} elseif ($portinfo['isgre']) {
70
		$descr = "GRE {$portinfo['remote-addr']}";
71
		if ($portinfo['descr']) {
72
			$descr .= " (" . $portinfo['descr'] . ")";
73
		}
74
	} elseif ($portinfo['isgif']) {
75
		$descr = "GIF {$portinfo['remote-addr']}";
76
		if ($portinfo['descr']) {
77
			$descr .= " (" . $portinfo['descr'] . ")";
78
		}
79
	} elseif ($portinfo['islagg']) {
80
		$descr = strtoupper($portinfo['laggif']);
81
		$descr .= " (" . $portinfo['mac'] . ")";
82
		if ($portinfo['descr']) {
83
			$descr .= " - " . $portinfo['descr'];
84
		}
85
	} elseif ($portinfo['isqinq']) {
86
		$descr = $portinfo['descr'];
87
	} elseif (substr($portname, 0, 4) == 'ovpn') {
88
		$descr = $portname . " (" . $ovpn_descrs[substr($portname, 5)] . ")";
89
	} else {
90
		$descr = $portname . " (" . $portinfo['mac'] . ")";
91
	}
50 92

  
51
/*moved most gettext calls to here, we really don't want to be repeatedly calling gettext() within loops if it can be avoided.*/
52
$gettextArray = array('add'=>gettext('Add'),'addif'=>gettext('Add interface'),'delete'=>gettext('Delete'),'deleteif'=>gettext('Delete interface'),'edit'=>gettext('Edit'),'on'=>gettext('on'));
93
	return htmlspecialchars($descr);
94
}
53 95

  
54 96
/*
55 97
	In this file, "port" refers to the physical port name,
......
59 101
/* get list without VLAN interfaces */
60 102
$portlist = get_interface_list();
61 103

  
62
/*another *_fast function from interfaces_fast.inc. These functions are basically the same as the 
63
ones they're named after, except they (usually) take an array and (always) return an array. This means that they only
64
need to be called once per script run, the returned array contains all the data necessary for repeated use */
65
$friendlyifnames = convert_real_interface_to_friendly_interface_name_fast();
66

  
67 104
/* add wireless clone interfaces */
68 105
if (is_array($config['wireless']['clone']) && count($config['wireless']['clone'])) {
69 106
	foreach ($config['wireless']['clone'] as $clone) {
......
74 111

  
75 112
/* add VLAN interfaces */
76 113
if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
77
	//$timea = microtime(true);
78 114
	foreach ($config['vlans']['vlan'] as $vlan) {
79 115
		$portlist[$vlan['vlanif']] = $vlan;
80 116
		$portlist[$vlan['vlanif']]['isvlan'] = true;
......
106 142
}
107 143

  
108 144
/* add LAGG interfaces */
109
if (is_array($config['laggs']['lagg']) && count($config['laggs']['lagg'])) {
110
	foreach ($config['laggs']['lagg'] as $lagg) {
111
		$portlist[$lagg['laggif']] = $lagg;
112
		$portlist[$lagg['laggif']]['islagg'] = true;
113
		/* LAGG members cannot be assigned */
114
		$lagifs = explode(',', $lagg['members']);
115
		foreach ($lagifs as $lagif) {
116
			if (isset($portlist[$lagif])) {
117
				unset($portlist[$lagif]);
118
			}
145
$lagglist = get_lagg_interface_list();
146
$portlist = array_merge($portlist, $lagglist);
147
foreach ($lagglist as $laggif => $lagg) {
148
	/* LAGG members cannot be assigned */
149
	$laggmembers = explode(',', $lagg['members']);
150
	foreach ($laggmembers as $lagm) {
151
		if (isset($portlist[$lagm])) {
152
			unset($portlist[$lagm]);
119 153
		}
120 154
	}
121 155
}
......
128 162
		/* QinQ members */
129 163
		$qinqifs = explode(' ', $qinq['members']);
130 164
		foreach ($qinqifs as $qinqif) {
131
			$portlist["{$qinq['vlanif']}_{$qinqif}"]['descr'] = "QinQ {$qinqif} on VLAN {$qinq['tag']} on {$qinq['if']}";
132
			$portlist["{$qinq['vlanif']}_{$qinqif}"]['isqinq'] = true;
165
			$portlist["{$qinq['vlanif']}.{$qinqif}"]['descr'] = "QinQ {$qinqif} on VLAN {$qinq['tag']} on {$qinq['if']}";
166
			$portlist["{$qinq['vlanif']}.{$qinqif}"]['isqinq'] = true;
133 167
		}
134 168
	}
135 169
}
......
169 203
	}
170 204
}
171 205

  
172

  
173
$ifdescrs = interface_assign_description_fast($portlist,$friendlyifnames);
174

  
175 206
if (isset($_REQUEST['add']) && isset($_REQUEST['if_add'])) {
176 207
	/* Be sure this port is not being used */
177 208
	$portused = false;
......
188 219
			$newifname = gettext("lan");
189 220
			$descr = gettext("LAN");
190 221
		} else {
191
			/*get first available OPT interface number. This code scales better than the foreach it replaces. 
192
			* might not work if theres ifs other than 'wan','lan' and 'optx';
193
			* The performance increase isn't substantial over the foreach; however as the number of OPT interfaces
194
			* increases, so does the performance gain; from ~0.0003s improvement with 100 VLANs to ~0.0009s with 400.
195
			* It is, however, marginally slower (~0.000036s at 50 VLANS) than the foreach with less than 100 VLANs, and 
196
			* therefore may not be worth the loss of code readability or performance for the majority of use cases. */
197
			$step1 = array_keys($config['interfaces']);
198
			unset($step1['lan'],$step1['wan']);
199
			$step2 = str_replace("opt","",$step1);
200
			$step3 = array_fill(0,end($step2),'x');
201
			$step4 = array_flip($step2);
202
			$step5 = array_replace($step3,$step2);
203
			$step6 = array_unique($step5);
204
			$step7 = array_flip($step6);
205
			if (isset($step7['x']))
206
				$i = $step7['x'];
207
			else
208
				$i = count($config['interfaces'])-1;
209

  
222
			for ($i = 1; $i <= count($config['interfaces']); $i++) {
223
				if (!$config['interfaces']["opt{$i}"]) {
224
					break;
225
				}
226
			}
210 227
			$newifname = 'opt' . $i;
211 228
			$descr = "OPT" . $i;
212 229
		}
213
		
230

  
214 231
		$config['interfaces'][$newifname] = array();
215 232
		$config['interfaces'][$newifname]['descr'] = $descr;
216 233
		$config['interfaces'][$newifname]['if'] = $_POST['if_add'];
......
219 236
			interface_sync_wireless_clones($config['interfaces'][$newifname], false);
220 237
		}
221 238

  
222
		
223 239
		uksort($config['interfaces'], "compare_interface_friendly_names");
224 240

  
225 241
		/* XXX: Do not remove this. */
......
349 365
				}
350 366
			}
351 367
		}
368

  
352 369
		write_config();
353 370

  
354 371
		enable_rrd_graphing();
......
424 441

  
425 442
/* Create a list of unused ports */
426 443
$unused_portlist = array();
427
$portArray = array_keys($portlist);
428

  
429
$ifaceArray = array_column($config['interfaces'],'if');
430
$unused = array_diff($portArray,$ifaceArray);
431
$unused = array_flip($unused);
432
$unused_portlist = array_intersect_key($portlist,$unused);//*/
433
unset($unused,$portArray,$ifaceArray);
444
foreach ($portlist as $portname => $portinfo) {
445
	$portused = false;
446
	foreach ($config['interfaces'] as $ifname => $ifdata) {
447
		if ($ifdata['if'] == $portname) {
448
			$portused = true;
449
			break;
450
		}
451
	}
452
	if ($portused === false) {
453
		$unused_portlist[$portname] = $portinfo;
454
	}
455
}
434 456

  
435 457
include("head.inc");
436 458

  
......
479 501
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
480 502
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
481 503
display_top_tabs($tab_array);
482

  
483
/*generate the port select box only once. 
484
Not indenting the HTML to produce smaller code
485
and faster load times */
486

  
487
$portselect='';
488
foreach ($portlist as $portname => $portinfo) {
489
	$portselect.='<option value="'.$portname.'"'; 
490
	$portselect.=">".$ifdescrs[$portname]."</option>\n";
491
}
492

  
493 504
?>
494 505
<form action="interfaces_assign.php" method="post">
495 506
	<div class="table-responsive">
......
503 514
	</thead>
504 515
	<tbody>
505 516
<?php
506
	$i=0;
507 517
	foreach ($config['interfaces'] as $ifname => $iface):
508 518
		if ($iface['descr']) {
509 519
			$ifdescr = $iface['descr'];
......
515 525
			<td><a href="/interfaces.php?if=<?=$ifname?>"><?=$ifdescr?></a></td>
516 526
			<td>
517 527
				<select name="<?=$ifname?>" id="<?=$ifname?>" class="form-control">
518
<?php 
519
/*port select menu generation loop replaced with pre-prepared select menu to reduce page generation time */
520
echo str_replace('value="'.$iface['if'].'">','value="'.$iface['if'].'" selected>',$portselect);
521
?>
528
<?php foreach ($portlist as $portname => $portinfo):?>
529
					<option value="<?=$portname?>" <?=($portname == $iface['if']) ? ' selected': ''?>>
530
						<?=interface_assign_description($portinfo, $portname)?>
531
					</option>
532
<?php endforeach;?>
522 533
				</select>
523 534
			</td>
524 535
			<td>
525 536
<?php if ($ifname != 'wan'):?>
526
				<button type="submit" name="del[<?=$ifname?>]" class="btn btn-danger btn-sm" title="<?=$gettextArray['deleteif']?>">
537
				<button type="submit" name="del[<?=$ifname?>]" class="btn btn-danger btn-sm" title="<?=gettext("Delete interface")?>">
527 538
					<i class="fa fa-trash icon-embed-btn"></i>
528
					<?=$gettextArray["delete"]?>
539
					<?=gettext("Delete")?>
529 540
				</button>
530 541
<?php endif;?>
531 542
			</td>
532 543
		</tr>
533
<?php $i++; 
534
endforeach;
544
<?php endforeach;
535 545
	if (count($config['interfaces']) < count($portlist)):
536 546
?>
537 547
		<tr>
......
540 550
			</th>
541 551
			<td>
542 552
				<select name="if_add" id="if_add" class="form-control">
543
<?php
544
/* HTML not indented to save on transmission/render time */
545
foreach ($unused_portlist as $portname => $portinfo):?>
546
<option value="<?=$portname?>" <?=($portname == $iface['if']) ? ' selected': ''?>><?=$ifdescrs[$portname]?></option>
547
<?php endforeach;
548
?>
553
<?php foreach ($unused_portlist as $portname => $portinfo):?>
554
					<option value="<?=$portname?>" <?=($portname == $iface['if']) ? ' selected': ''?>>
555
						<?=interface_assign_description($portinfo, $portname)?>
556
					</option>
557
<?php endforeach;?>
549 558
				</select>
550 559
			</td>
551 560
			<td>
552 561
				<button type="submit" name="add" title="<?=gettext("Add selected interface")?>" value="add interface" class="btn btn-success btn-sm" >
553 562
					<i class="fa fa-plus icon-embed-btn"></i>
554
					<?=$gettextArray["add"]?>
563
					<?=gettext("Add")?>
555 564
				</button>
556 565
			</td>
557 566
		</tr>
src/usr/local/www/interfaces_vlan.php
27 27
##|*IDENT=page-interfaces-vlan
28 28
##|*NAME=Interfaces: VLAN
29 29
##|*DESCR=Allow access to the 'Interfaces: VLAN' page.
30
##|*MATCH=interfaces_vlan_new_prof.php*
30
##|*MATCH=interfaces_vlan.php*
31 31
##|-PRIV
32 32

  
33 33
require_once("guiconfig.inc");
34
require_once("interfaces_fast.inc");
35

  
36
global $profile;
37
//$timealla = microtime(true);
38 34

  
39 35
if (!is_array($config['vlans']['vlan'])) {
40 36
	$config['vlans']['vlan'] = array();
41 37
}
42 38

  
43
$a_vlans = &$config['vlans']['vlan'] ;
39
$a_vlans = &$config['vlans']['vlan'];
44 40

  
45 41
if ($_POST['act'] == "del") {
46 42
	if (!isset($_POST['id'])) {
......
84 80
display_top_tabs($tab_array);
85 81

  
86 82
?>
87
<form action="interfaces_vlan_new_prof.php" method="post">
83
<form action="interfaces_vlan.php" method="post">
88 84
	<input id="act" type="hidden" name="act" value="" />
89 85
	<input id="id" type="hidden" name="id" value=""/>
90 86

  
......
105 101
					<tbody>
106 102
<?php
107 103
	$i = 0;
108
	//$timea = microtime(true);
109
	$gettext_array = array('edit'=>gettext('Edit VLAN'),'del'=>gettext('Delete VLAN'));
110
	$ifaces = convert_real_interface_to_friendly_interface_name_fast(array());
111 104
	foreach ($a_vlans as $vlan) {
112 105
?>
113 106
						<tr>
114 107
							<td>
115 108
<?php
116 109
	printf("%s", htmlspecialchars($vlan['if']));
117
	//$iface = convert_real_interface_to_friendly_interface_name($vlan['if']);
118
	//if (isset($iface) && strlen($iface) > 0)
119
	//	printf(" (%s)", htmlspecialchars($iface));
120
	if (isset($ifaces[$vlan['if']]) && strlen($ifaces[$vlan['if']]) > 0)
121
		printf(" (%s)", htmlspecialchars($ifaces[$vlan['if']]));
110
	$iface = convert_real_interface_to_friendly_interface_name($vlan['if']);
111
	if (isset($iface) && strlen($iface) > 0)
112
		printf(" (%s)", htmlspecialchars($iface));
122 113
?>
123 114
							</td>
124 115
							<td><?=htmlspecialchars($vlan['tag']);?></td>
125 116
							<td><?=htmlspecialchars($vlan['pcp']);?></td>
126 117
							<td><?=htmlspecialchars($vlan['descr']);?></td>
127 118
							<td>
128
								<a class="fa fa-pencil"	title="<?=$gettext_array['edit']?>"	role="button" href="interfaces_vlan_edit.php?id=<?=$i?>" ></a>
129
								<a class="fa fa-trash no-confirm"	title="<?=$gettext_array['del']?>"	role="button" id="del-<?=$i?>"></a>
119
								<a class="fa fa-pencil"	title="<?=gettext('Edit VLAN')?>"	role="button" href="interfaces_vlan_edit.php?id=<?=$i?>" ></a>
120
								<a class="fa fa-trash no-confirm"	title="<?=gettext('Delete VLAN')?>"	role="button" id="del-<?=$i?>"></a>
130 121
							</td>
131 122
						</tr>
132 123
<?php
133 124
			$i++;
134 125
	}
135
	/*$timeb = microtime(true);
136
	$profile['vlan_list'] = $timeb - $tima;*/
137 126
?>
138 127
					</tbody>
139 128
				</table>
......
177 166
//]]>
178 167
</script>
179 168
<?php
180
/*$timeallb = microtime(true);
181
$profile['total'] = $timeallb - $timealla;
182
print_r($profile);*/
183 169
include("foot.inc");

Also available in: Unified diff