Skip to content

lantiq: xrx200net-legacy: remove auto-enable routine in set_vlan_ports() #3245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

sch-m
Copy link
Contributor

@sch-m sch-m commented Jul 24, 2020

This auto-enabling leads to problems when you try to set up some vlan
config and do set the ports before setting the vid of the vlan table
entries.

example:

swconfig dev switch0 vlan 2 set ports "2t 6t"
swconfig dev switch0 vlan 2 set vid 3

swconfig dev switch0 vlan 3 set ports "3t 6t"
-> Error, because the auto-enable routine in xrx200sw_set_vlan_ports()
will then try to implicitly set vid to "3" (the table index) which is
already used by vlan 2 and therefore results in an error.

As the swconfig load command also reads the options line by line from
/etc/config/network, this problem could also occur when the order of the
options of a switch_vlan section is ports before vid.

Also, I can't imagine any reason why we would need this auto-enable
"feature".

Signed-off-by: Martin Schiller ms@dev.tdt.de

This auto-enabling leads to problems when you try to set up some vlan
config and do set the ports before setting the vid of the vlan table
entries.

example:

swconfig dev switch0 vlan 2 set ports "2t 6t"
swconfig dev switch0 vlan 2 set vid 3

swconfig dev switch0 vlan 3 set ports "3t 6t"
-> Error, because the auto-enable routine in xrx200sw_set_vlan_ports()
will then try to implicitly set vid to "3" (the table index) which is
already used by vlan 2 and therefore results in an error.

As the swconfig load command also reads the options line by line from
/etc/config/network, this problem could also occur when the order of the
options of a switch_vlan section is ports before vid.

Also, I can't imagine any reason why we would need this auto-enable
"feature".

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
@adschm adschm added the target/lantiq pull request/issue for lantiq target label Jul 24, 2020
@ynezz ynezz added target/lantiq pull request/issue for lantiq target and removed target/lantiq pull request/issue for lantiq target labels Jul 24, 2020
@ahmar20
Copy link

ahmar20 commented Aug 28, 2020

If I apply your patch, I am not able to access my AP, which is connected through LAN and assigned a static IP at 192.168.1.254. Have you tested it?

Edit: It definitely produces a crash and bootloop at startup if your patch is not applied. Should there not be a different implementation for it, rather removing it altogether? If it is removed then how can the device be accessed? My understanding is that the associated VLANs will not work unless you specifically enable them??

(Edit: Clarification)

@sch-m
Copy link
Contributor Author

sch-m commented Aug 31, 2020

@ahmar20 Yes, I've tested it and it's working for me.

I do not understand exactly what the problem is. So you have problems with and without my patch, right?
Can you please post the content of your /etc/config/network and the output of swconfig dev switch0 show?

@ahmar20
Copy link

ahmar20 commented Aug 31, 2020

First I had some patches enabled from and so I removed those patches and recompiled the firmware, only including your patch.

This is the result now:

root@OpenWrt:/# swconfig dev switch0 show
Global attributes:
        enable_vlan: 1
Port 0:
        uvr: 0
        vsr: 0
        vinr: 0
        tvm: 0
        pvid: 0
        link: port:0 link:up speed:1000baseT full-duplex auto
Port 1:
        uvr: 0
        vsr: 0
        vinr: 0
        tvm: 0
        pvid: 0
        link: port:1 link:down
Port 2:
        uvr: 0
        vsr: 0
        vinr: 0
        tvm: 0
        pvid: 0
        link: port:2 link:down
Port 3:
        uvr: 0
        vsr: 0
        vinr: 0
        tvm: 0
        pvid: 0
        link: port:3 link:down
Port 4:
        uvr: 0
        vsr: 0
        vinr: 0
        tvm: 0
        pvid: 0
        link: port:4 link:down
Port 5:
        uvr: 0
        vsr: 0
        vinr: 0
        tvm: 0
        pvid: 0
        link: port:5 link:down
Port 6:
        uvr: 0
        vsr: 0
        vinr: 0
        tvm: 0
        pvid: 0
        link: port:6 link:up speed:1000baseT full-duplex auto
VLAN 1:
        vid: 0
        enable: 0
        ports: 0 1 2 4 6t 
VLAN 2:
        vid: 0
        enable: 0
        ports: 5 6t 
root@OpenWrt:/# swconfig dev switch0 vlan 1 enable 1
swconfig list
swconfig dev <dev> [port <port>|vlan <vlan>] (help|set <key> <value>|get <key>|load <config>|show)
root@OpenWrt:/# swconfig dev switch0 vlan 1 set enable 1
Failed to set attribute: Invalid input data or parameter

The issue is with your patch, without your patch I am able to use the router normally. Your patch fixes a crashing issue on boot but it also creates this non-accessible router issue.

root@OpenWrt:/# cat /etc/config/network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fdcf:b952:f1f5::/48'

config atm-bridge 'atm'
        option vpi '1'
        option vci '32'
        option encaps 'llc'
        option payload 'bridged'
        option nameprefix 'dsl'

config dsl 'dsl'
        option annex 'a'
        option tone 'av'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0.1'
        option proto 'static'
        option ipaddr '192.168.1.254'
        option netmask '255.255.255.0'
        option gateway '192.168.1.1'
        option dns '192.168.1.1'
        option ip6assign '60'

config device 'lan_eth0_1_dev'
        option name 'eth0.1'
        option macaddr '18:62:2c:2a:d0:2a'

config interface 'wan'
        option ifname 'dsl0'
        option proto 'pppoe'
        option username 'username'
        option password 'password'
        option ipv6 '1'

config device 'wan_dsl0_dev'
        option name 'dsl0'
        option macaddr '18:62:2c:2a:d0:2b'

config interface 'wan6'
        option ifname '@wan'
        option proto 'dhcpv6'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 4 6t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '5 6t'


@sch-m
Copy link
Contributor Author

sch-m commented Sep 1, 2020

@ahmar20 Your config is missing the option vid '<x>'.

Example:

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option vid '1'
        option ports '0 1 2 4 6t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option vid '2'
        option ports '5 6t'

option vlan is the index in the vlan table.
option vid is the vlan id.

@ahmar20
Copy link

ahmar20 commented Sep 1, 2020

Your config is missing the option vid '<x>'.

Now it makes sense because the code that is being removed adds the vid during runtime so in the config there is no actual need of putting vid for now but this will change once this is merged. Right now, a reset omits the vid value altogether though but anyway putting the vid in there works well.

@hauke
Copy link
Member

hauke commented Jun 26, 2021

The patch switching the lantiq xrx200 target to DSA in #3085 was just applied to master, this is not needed any more.

@hauke hauke closed this Jun 26, 2021
@sch-m sch-m deleted the pr/20200724-xr200net-auto-enable branch June 26, 2021 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs reviewer target/lantiq pull request/issue for lantiq target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants