openwrt / luci

LuCI - OpenWrt Configuration Interface
Apache License 2.0
6.27k stars 2.51k forks source link

VLAN filtering checkbox does not reflect config file setting: vlan_filtering='1' shows checkbox empty. #7278

Open vsessink opened 1 week ago

vsessink commented 1 week ago

Steps to reproduce:

  1. got to NetworkInterfaces and click the Devices tab
  2. Click the Configure button for br-lan
  3. Click the Bridge VLAN filtering tab
  4. Click the Enable VLAN filtering box
  5. Click on the [Save] button

Note that the UNSAVED CHANGES field now has 1 change: uci set network.cfg030f15.vlan_filtering='1'. So click Save & Apply in order to apply the setting.

Actual behavior:

  1. Device br-lan will now have option vlan_filtering '1',
  2. The Luci UI does not reflect that. Click the Configure button for br-lan again, note that Enable VLAN filtering is off, i.e. not checked.

Expected behavior:

The Luci UI shows that Enable VLAN filtering is on, i.e. checked if vlan_filtering is 1.

Additional Information:

DISTRIB_ID='OpenWrt' DISTRIB_RELEASE='23.05.3' DISTRIB_REVISION='r23809-234f1a2efa'
DISTRIB_TARGET='mediatek/filogic' DISTRIB_ARCH='aarch64_cortex-a53' 
DISTRIB_DESCRIPTION='OpenWrt 23.05.3 r23809-234f1a2efa'
DISTRIB_TAINTS=''
systemcrash commented 1 week ago

Does the change reflect in your underlying config?

vsessink commented 1 week ago

Yes, it does, as stated under Actual Behavior: _Device br-lan will now have option vlanfiltering '1' So the configuration changes but the filtering checkbox stays empty as if no config change happened.

systemcrash commented 1 week ago

The config... file. Check what it says in /etc/config/network

vsessink commented 1 week ago

Sorry for - apparently - not being clear enough. Yes, the configuration file actually changes, but the checkbox doesn't reflect this change.

So to make it very clear, before the change the br-lan entry in the config file /etc/config/network looks like:

config device
    option name 'br-lan'
    option type 'bridge'
    list ports 'eth0'

Then after checking the checkbox enable vlan filtering in Luci and clicking save and save & apply, the br-lan config in the file /etc/config/network looks like:

config device
    option name 'br-lan'
    option type 'bridge'
    list ports 'eth0'
    option vlan_filtering '1'

But the enable vlan filtering configuration option in Luci still shows an unchecked box.

systemcrash commented 1 week ago

Then I imagine if you add some VLANs to that config, the setting makes sense. The code for this has:

        o.updateDefaultValue = function(section_id) {
            var device = uci.get('network', s.section, 'name'),
                uielem = this.getUIElement(section_id),
                has_vlans = false;

            uci.sections('network', 'bridge-vlan', function(bvs) {
                has_vlans = has_vlans || (bvs.device == device);
            });

            this.default = has_vlans ? this.enabled : this.disabled;

            if (uielem && !uielem.isChanged())
                uielem.setValue(this.default);
        };

Try also adding a VLAN. What happens?

vsessink commented 1 week ago

Yep, it switches on. Doesn't it do anything, besides setting a configuration option?