bisdn / basebox

A tiny OpenFlow controller for OF-DPA switches.
Mozilla Public License 2.0
45 stars 9 forks source link

vlan tagging: change to untagged is not reflected in the ASIC #266

Closed rubensfig closed 3 years ago

rubensfig commented 4 years ago

Expected Behavior

When updating an access ports (port only with PVID) we must be able to configure the untagged parameter on the ASIC.

When checking the grouptables, we expect

groupId = 0x00020002 (L2 Interface, VLAN ID = 2, Port ID = 2): duration: 10, refCount:2
        bucketIndex = 0: outputPort = 2 (Physical) *popVlanTag = 1* allowVlanTranslation = 0 

Even if the interface was not initially configured with the popVlanTag/untagged.

Actual Behavior

If the interface is initially set without untagged, we cannot change this behaviour without deleting the port from the bridge and reconfiguring it.

Steps to Reproduce the Problem

Error script:

#!/bin/bash

ip link add name swbridge type bridge vlan_filtering 1 vlan_default_pvid 0
ip link set swbridge up

ip link set port2 master swbridge 
ip link set port2 up

bridge vlan add vid 2 dev port2 pvid
bridge vlan add vid 2 dev swbridge self

Good script:

#!/bin/bash

ip link add name swbridge type bridge vlan_filtering 1 vlan_default_pvid 0
ip link set swbridge up

ip link set port2 master swbridge 
ip link set port2 up

bridge vlan add vid 2 dev port2 pvid untagged
bridge vlan add vid 2 dev swbridge self

## Specifications
  - Version: BISDN Linux v3.3.0
  - Platform: accton-as4610
jklare commented 4 years ago

Initial systemd-networkd configuration:

/etc/systemd/network/10-swbridge.netdev

[NetDev]
Name=swbridge
Kind=bridge
[Bridge]
DefaultPVID=none
VLANFiltering=1

/etc/systemd/network/10-swbridge.network

[Match]
Name=swbridge
[BridgeVLAN]
VLAN=2

/etc/systemd/network/20-port7.network

[Match]
Name=port7
[Network]
Bridge=swbridge
[BridgeVLAN]
VLAN=2
PVID=2

-> will create this grouptable: groupId = 0x00020007 (L2 Interface, VLAN ID = 2, Port ID = 7): duration: 5, refCount:1 bucketIndex = 0: outputPort = 7 (Physical) popVlanTag = 0 allowVlanTranslation = 0

When updating the /etc/systemd/network/20-port7.network file

[Match]
Name=port7
[Network]
Bridge=swbridge
[BridgeVLAN]
VLAN=2
PVID=2
EgressUntagged=2

by adding EgressUntagged=2 we expect the grouptable entry mentioned before to change from popVlanTag = 0 to popVlanTag = 1, but currently nothing changes until the configured port is detached and reattached to the bridge (either manually or by rebooting). The configuration change is however correctly reflected in the kernel, just not forwarded to the grouptables.

KanjiMonster commented 4 years ago

until the configured port is detached and reattached to the bridge

I think I stumbled over it earlier today as well and deleting and readding the vlan worked, too. I did not need to reattach the port to the bridge.

So (starting with no vlan assigned to port7):

bridge vlan add vid 2 dev port7
bridge vlan add vid 2 dev port7 pvid untagged

didn't work, but

bridge vlan add vid 2 dev port7
bridge vlan del vid 2 dev port7
bridge vlan add vid 2 dev port7 pvid untagged

worked (for me).

So maybe we miss vlan update/change notifications, if these exist, or don't properly handle them.