Project

General

Profile

Actions

Bug #16309

open

status_interfaces.php includes VLAN switchport information even when no physical switch is present on the platform (the config.xml was imported from platform with switch)

Added by Patrik Stahlman 2 months ago. Updated about 2 months ago.

Status:
Confirmed
Priority:
Very Low
Assignee:
-
Category:
Web Interface
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Release Notes:
Default
Affected Plus Version:
25.07
Affected Architecture:

Description

I just noticed a very minor display issue in 25.07.b.20250707.2346. On the Interface Status page every VLAN interface shows a switchport configuration, which is unexpected as my current platform doesn't have a switch. But as the current configuration was imported from a Netgate 2100 it gives the issue some context, and a resonable explaination.

With this small patch, the VLAN information is displayed correctly:


--- /usr/local/www/status_interfaces.php        2025-07-04 16:32:50.000000000 +0200
+++ /usr/local/www/status_interfaces.php.new    2025-07-12 16:40:51.111525000 +0200
@@ -117,6 +117,13 @@
 $shortcut_section = "interfaces";
 include("head.inc");

+/* Check that a switch exists, not just in the configuration */
+$have_switch = true;
+$swdevices = switch_get_devices();
+$swinfo = pfSense_etherswitch_getinfo($swdevice);
+if ($swinfo == NULL) {
+       $have_switch = false;
+}
 $ifdescrs = get_configured_interface_with_descr(true);
 $ifinterrupts = interfaces_interrupts();
 $switch_config = config_get_path('switches/switch/0/vlangroups/vlangroup', []);
@@ -133,7 +140,7 @@

        $ifhwinfo = $ifinfo['hwif'];
        $vlan = interface_is_vlan($ifinfo['hwif']);
-       if ($vlan) {
+       if ($vlan && $have_switch) {
                foreach ($switch_config as $vlangroup) {
                        if ($vlangroup['vlanid'] == $vlan['tag']) {
                                $ifhwinfo .= ', switchports: ' . $vlangroup['members'];

Fix applied:


Files

clipboard-202507121653-wh1wy.png (11.3 KB) clipboard-202507121653-wh1wy.png Patrik Stahlman, 07/12/2025 02:53 PM
clipboard-202507121654-8ltlv.png (7.91 KB) clipboard-202507121654-8ltlv.png Patrik Stahlman, 07/12/2025 02:54 PM
Actions

Also available in: Atom PDF