Opened 7 years ago

Closed 5 years ago

Last modified 4 years ago

#8501 closed defect (fixed)

rtl8366 changeset 22856 broke the same port in untagged and tagged VLANs

Reported by: Tim Miller Dyck <tim@…> Owned by: developers
Priority: normal Milestone: Barrier Breaker 14.07
Component: kernel Version: Backfire 10.03.1 RC4
Keywords: rtl8366 vlan pvid Cc:



In testing Backfire 10.03.1 RC4 with a TP-LINK TL-WR1043ND, I noticed that the PVID of any given port is set to the ID of the last VLAN in which the port is a member as defined in /etc/config/network (last being in top-to-bottom order in the file).

This is true whether or not the membership is tagged or untagged. However, my understanding of how VLANs work is that the PVID should be set to the VLAN ID of the VLAN where the port is an untagged member. Every physical port can only (and should) be an untagged member of a single VLAN. If the port is only a _tagged_ member of one or more VLANs, I believe the PVID behaviour is undefined -- all ports must have a single PVID and that PVID should be the single VLAN ID where they are untagged members.

Steps to reproduce:

  • By default, ports 1-4 are untagged members of VLAN 1. Create a new additional VLAN3 containing port 3 as a tagged member.

config 'switch_vlan'

option 'device' 'rtl8366rb'
option 'vlan' '3'
option 'ports' '3t 5t'

The PVID of port three in RC4 will be listed as 3, making it inaccessible to the default VLAN1, not as expected.

If the VLAN1 default definition lines are moved to the bottom of /etc/config/network, after the VLAN3 stanza, the PVID of port 3 is restored to be 1, and the tagged and untagged behavior of port 3 is as expected.

This looks like the changeset most related: /changeset/22856.html, which is in relation to this ticket: /ticket/7696.html. In ticket #7696, the poster had an example where a port was only a tagged member of a VLAN and had no untagged membership at all. It looks like the code should only set the PVID to the (one) VLAN where the port is an untagged member, and set all other ports to PVID 1, the default VLAN ID, and not change the PVID for tagged VLAN membership.

Tim Miller Dyck

Attachments (0)

Change History (13)

comment:1 Changed 7 years ago by anonymous

Also note #8458

comment:2 Changed 7 years ago by Tim Miller Dyck <tim@…>

I think I should have used Backfire as the milestone but don't see how to check it now. This would be great to have fixed for Backfire 10.03.1 final.


comment:3 Changed 7 years ago by Tim Miller Dyck <tim@…>

Hi, I tested this out again with Backfire 10.03.1-RC5 on a TP-LINK TL-WR1043ND. Unfortunately, the same behaviour exists, where ports are assigned the PVID of the last VLAN to be parsed in /etc/config/network, regardless of whether their membership is tagged or untagged in that VLAN (the PVID should be set on the basis of untagged VLAN membership only).

A workaround that does fix the problem regardless of VLAN definition order is to manually set the PVID of the ports affected to the correct (untagged) VLAN. This can be done through a 'switch_port' setting in /etc/config/network.

e.g. override the automatic PVID assignment and force port 0 to have PVID 1

config 'switch_port'
        option 'pvid' '1'
        option 'port' '0'

-Tim Miller Dyck

comment:4 Changed 7 years ago by tom

I have a MR3420 router, and im trying to get working untagged and tagged interface on port 2.
My configuration is:

config  'interface' 'lan'
        option 'ifname' 'eth0.1'
        option 'type'  'bridge'
config  'interface'   'vlan2'
        option 'ifname' 'eth0.2'
        option 'proto' 'static'
config 'switch'
        option 'name' 'eth0'
        option 'reset' '1'
        option  'enable_vlan' '1'

config 'switch_vlan'
        option 'device'  'eth0'
        option 'vlan' '1'
        option 'ports' '0t 2 3 4 5'

config  'switch_vlan'
        option 'device' 'eth0'
        option 'vlan' '2'
        option 'ports' '1t 2t 0t'
        option 'pvid' '1'

config 'switch_port'
        option 'port' '1'
        option 'pvid' '1'

And the swconfig is:

Global attributes:
        enable_vlan: 1
Port 0:
        pvid: 0
Port 1:
        pvid: 1
Port 2:
        pvid: 1
Port 3:
        pvid: 1
Port 4:
        pvid: 1
Port 5:
        pvid: 1
        vid: 0
        ports: 0t 1t
        vid: 1
        ports: 0t 2t 3 4 5
        vid: 2
        ports: 0t 1t 2t

When i connect a windows laptop to port2 i get a ip address from router. But on linux i cant resolve ip from untagged eth0, but tagged vlan2 works fine.
I'm using the trunk image from 30 July. Is some could give me some clues i would be grateful


comment:5 Changed 7 years ago by nbd

untagged + tagged is not supported. by the way, why are you posting this in a ticket that has nothing to do with the hardware that you're using?

comment:6 Changed 7 years ago by tom

I couldn't find a ticket, which describes the issue more accurately than this one.
On the other hand, i could open a new ticket but i haven't known since now, if it is a bug or not implemented feature.
If i have done something wrong, i apologize.

comment:7 Changed 6 years ago by Tim Miller Dyck <tim@…>

A comment that on the TP-LINK TL-WR1043ND (rtl8366rb switch chipset), putting a port both in an untagged VLAN and a tagged VLAN works (tested with -rc3 and -rc5). I don't know about the MR3420 hardware. -Tim

comment:8 Changed 6 years ago by Tim Miller Dyck <tim@…>

Tested on -RC6.

The same /etc/config/network parsing behaviour occurs where the PVID of each port is set to the VLAN number of the last VLAN it belongs to (tagged or untagged) as parsed in top-down order of /etc/config/network, rather than to the VLAN number of the single untagged VLAN to which it belongs.

As a workaround, manually configure the PVID of the port to be the untagged VLAN of which it is a member using LuCI or direct editing of /etc/config/network.

Tim Miller Dyck

comment:9 Changed 6 years ago by Tim Miller Dyck <tim@…>

Ah, LuCI in -RC6 does not expose PVID editing anymore (at least on openwrt-ar71xx-tl-wr1043nd-v1), so the PVID settings need to be put into /etc/config/network using SSH and vi.

comment:10 Changed 5 years ago by Tim Miller Dyck <tim@…>

FYI, there is a fix in /ticket/8867.html

comment:11 Changed 5 years ago by jogo

  • Resolution set to fixed
  • Status changed from new to closed

This have been fixed in r35227 (AA: r35228) by changing the workaround for #7795 to only assign a PVID if the current PVID is 0.

No need to manually assign any PVIDs through uci, as swconfig and the switch driver should now always do the correct thing.

comment:12 Changed 5 years ago by Tim Miller Dyck <tim@…>

Thanks for this fix, jogo!

comment:13 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.