console: strangely enough the code doesn't work as intended

This commit is contained in:
Franco Fichtner 2022-01-19 12:18:17 +01:00
parent 5a27e1988b
commit a26b45977b
2 changed files with 12 additions and 9 deletions

View File

@ -133,10 +133,9 @@ EOD;
if (isset($config['laggs']['lagg'][0])) {
foreach ($config['laggs']['lagg'] as $lagg) {
$dmesg = "Link aggregation, member interfaces {$lagg['members']}";
$iflist_lagg[$lagg['laggif']] = $iflist_all[$lagg['laggif']] = [
'mac' => 'xx:xx:xx:xx:xx:xx',
'dmesg' => $dmesg,
'dmesg' => "Link aggregation, member interfaces {$lagg['members']}",
'mac' => '00:00:00:00:00:00',
];
}
}
@ -157,10 +156,9 @@ EOD;
if (isset($config['vlans']['vlan'][0])) {
foreach ($config['vlans']['vlan'] as $vlan) {
$dmesg = "VLAN tag {$vlan['tag']}, parent interface {$vlan['if']}";
$iflist_all[$vlan['if'] . '_vlan' . $vlan['tag']] = [
'mac' => $iflist_all[$vlan['if']]['mac'],
'dmesg' => $dmesg,
'dmesg' => "VLAN tag {$vlan['tag']}, parent interface {$vlan['if']}",
'mac' => '00:00:00:00:00:00',
];
}
}
@ -173,6 +171,10 @@ Valid interfaces are:
EOD;
/*
* We are checking $iflist here for physical members only, but
* iterate over $iflist_all when that sanity check succeeded.
*/
if (empty($iflist)) {
echo "No interfaces found!\n";
} else {

View File

@ -846,6 +846,7 @@ function get_interface_list($only_active = false, $include_dmesg = false)
/* list of virtual interface types */
$vfaces = array(
'_vip'
'_vlan',
'_wlan',
'bridge',
@ -860,14 +861,14 @@ function get_interface_list($only_active = false, $include_dmesg = false)
'lo',
'ng',
'pflog',
'pfsync',
'plip',
'ppp',
'pppoe',
'pptp',
'pfsync',
'sl',
'tap',
'tun',
'vip'
);
$ifnames_up = legacy_interface_listget('up');
@ -889,7 +890,7 @@ function get_interface_list($only_active = false, $include_dmesg = false)
foreach ($ifnames as $ifname) {
$tmp_ifnames = preg_split('/\d+/', $ifname);
if (in_array(array_shift($tmp_ifnames), $vfaces)) {
if (count(array_intersect($tmp_ifnames, $vfaces)) {
continue;
}