From a26b45977bacd75be4203a9300aaea56563e9607 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 19 Jan 2022 12:18:17 +0100 Subject: [PATCH] console: strangely enough the code doesn't work as intended --- src/etc/inc/console.inc | 14 ++++++++------ src/etc/inc/util.inc | 7 ++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/etc/inc/console.inc b/src/etc/inc/console.inc index f1ffaf675..6626aaef9 100644 --- a/src/etc/inc/console.inc +++ b/src/etc/inc/console.inc @@ -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 { diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index d297a976a..844f10cb4 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -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; }