Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@KanjiMonster
Copy link
Contributor

@KanjiMonster KanjiMonster commented Jun 21, 2024

Add support for updating the ageing time following the configured ageing time of the bridge.

Depends on libnl 3.11 and additional fixes on top (bisdn/meta-bisdn-linux#335).

Tested via the 802.1q-bridge setup:

  1. No entries:
accton-as4610-54:/sys/class/net/swbridge/bridge# echo 30000 > ageing_time 
accton-as4610-54:/sys/class/net/swbridge/bridge# client_flowtable_dump 50
Table ID 50 (Bridging):   Retrieving all entries. Max entries = 24575, Current entries = 2.
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 0000.0000.0000:0000.0000.0000 | GoTo = 60 (ACL Policy) groupId = 0x40020002 outPort = 0 (Physical)  | priority = 2 hard_time = 0 idle_time = 0 cookie = 36
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 3333.ff9c.27d1:ffff.ffff.ffff | GoTo = 60 (ACL Policy) groupId = 0x30020001 outPort = 0 (Physical)  | priority = 3 hard_time = 0 idle_time = 300 cookie = 41
  1. After ping from server 1 to server 2:
accton-as4610-54:/sys/class/net/swbridge/bridge# client_flowtable_dump 50
Table ID 50 (Bridging):   Retrieving all entries. Max entries = 24575, Current entries = 4.
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 0000.0000.0000:0000.0000.0000 | GoTo = 60 (ACL Policy) groupId = 0x40020002 outPort = 0 (Physical)  | priority = 2 hard_time = 0 idle_time = 0 cookie = 36
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 0cc4.7a9c.27d1:ffff.ffff.ffff | GoTo = 60 (ACL Policy) groupId = 0x00020002 outPort = 0 (Physical)  | priority = 3 hard_time = 0 idle_time = 300 cookie = 47
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 0cc4.7a9c.29f9:ffff.ffff.ffff | GoTo = 60 (ACL Policy) groupId = 0x00020036 outPort = 0 (Physical)  | priority = 3 hard_time = 0 idle_time = 300 cookie = 48
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 3333.ff9c.27d1:ffff.ffff.ffff | GoTo = 60 (ACL Policy) groupId = 0x30020001 outPort = 0 (Physical)  | priority = 3 hard_time = 0 idle_time = 300 cookie = 41
  1. Changed ageing time to 10 seconds, then waited 10 seconds:
accton-as4610-54:/sys/class/net/swbridge/bridge# echo 1000 > ageing_time 
accton-as4610-54:/sys/class/net/swbridge/bridge# client_flowtable_dump 50
Table ID 50 (Bridging):   Retrieving all entries. Max entries = 24575, Current entries = 4.
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 0000.0000.0000:0000.0000.0000 | GoTo = 60 (ACL Policy) groupId = 0x40020002 outPort = 0 (Physical)  | priority = 2 hard_time = 0 idle_time = 0 cookie = 36
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 0cc4.7a9c.27d1:ffff.ffff.ffff | GoTo = 60 (ACL Policy) groupId = 0x00020002 outPort = 0 (Physical)  | priority = 3 hard_time = 0 idle_time = 10 cookie = 49
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 0cc4.7a9c.29f9:ffff.ffff.ffff | GoTo = 60 (ACL Policy) groupId = 0x00020036 outPort = 0 (Physical)  | priority = 3 hard_time = 0 idle_time = 10 cookie = 50
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 3333.ff9c.27d1:ffff.ffff.ffff | GoTo = 60 (ACL Policy) groupId = 0x30020001 outPort = 0 (Physical)  | priority = 3 hard_time = 0 idle_time = 300 cookie = 41

accton-as4610-54:/sys/class/net/swbridge/bridge# sleep 10
accton-as4610-54:/sys/class/net/swbridge/bridge# client_flowtable_dump 50
Table ID 50 (Bridging):   Retrieving all entries. Max entries = 24575, Current entries = 2.
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 0000.0000.0000:0000.0000.0000 | GoTo = 60 (ACL Policy) groupId = 0x40020002 outPort = 0 (Physical)  | priority = 2 hard_time = 0 idle_time = 0 cookie = 36
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 3333.ff9c.27d1:ffff.ffff.ffff | GoTo = 60 (ACL Policy) groupId = 0x30020001 outPort = 0 (Physical)  | priority = 3 hard_time = 0 idle_time = 300 cookie = 41
  1. Pinged again from server 1 to server 2:
accton-as4610-54:/sys/class/net/swbridge/bridge# client_flowtable_dump 50
Table ID 50 (Bridging):   Retrieving all entries. Max entries = 24575, Current entries = 4.
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 0000.0000.0000:0000.0000.0000 | GoTo = 60 (ACL Policy) groupId = 0x40020002 outPort = 0 (Physical)  | priority = 2 hard_time = 0 idle_time = 0 cookie = 36
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 0cc4.7a9c.27d1:ffff.ffff.ffff | GoTo = 60 (ACL Policy) groupId = 0x00020002 outPort = 0 (Physical)  | priority = 3 hard_time = 0 idle_time = 10 cookie = 52
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 0cc4.7a9c.29f9:ffff.ffff.ffff | GoTo = 60 (ACL Policy) groupId = 0x00020036 outPort = 0 (Physical)  | priority = 3 hard_time = 0 idle_time = 10 cookie = 51
--  vlanId:mask = 0x1002:0x1fff (VLAN 2) destMac:mask = 3333.ff9c.27d1:ffff.ffff.ffff | GoTo = 60 (ACL Policy) groupId = 0x30020001 outPort = 0 (Physical)  | priority = 3 hard_time = 0 idle_time = 300 cookie = 41

@KanjiMonster KanjiMonster linked an issue Jun 21, 2024 that may be closed by this pull request
@KanjiMonster
Copy link
Contributor Author

KanjiMonster commented Jul 12, 2024

Doesn't work, as the kernel does not send updates about changes in ageing time *sigh*

@KanjiMonster KanjiMonster reopened this Jun 3, 2025
@KanjiMonster KanjiMonster force-pushed the jogo_bridge_ageing_time branch from 2c88268 to 9c64ecc Compare June 3, 2025 14:31
@KanjiMonster
Copy link
Contributor Author

KanjiMonster commented Jun 3, 2025

Doesn't work, as the kernel does not send updates about changes in ageing time sigh

Actually not true, the issues were/are:

  • kernel only sends updates about devices that are up
  • libnl currently doesn't notify about bridge_info changes (missing io_compare())

When fixing the latter, and having the device up, notifications actually work.

Replace all license headers in source files with machine readable SPDX
license and copyright headers.

Year is based on initial check in of a file, according to git log
--follow (to catch renames).

Signed-off-by: Jonas Gorski <[email protected]>
@KanjiMonster KanjiMonster force-pushed the jogo_bridge_ageing_time branch from 5a2ec69 to 2de39ce Compare October 16, 2025 09:37
Instead of setting, then unsetting the global idle timeout setting in
rofl-ofdpa, set the idle timeout directly in the generated flowmod.

This also means we need to enable flow removal notifications ourselves.

This avoids that the idle timeout setting remains set at the non-default
value if for any reason sending the flow mod creates an exception.

Signed-off-by: Jonas Gorski <[email protected]>
Default ageing time according to 802.1Q is 300 seconds [1], so set the
default accordingly, and use default_idle_timeout instead of a hardcoded
value 300 for controller::l2_{overlay_,}addr_add().

[1] Table 8-9 of IEEE Std 802.1Q-2022

Signed-off-by: Jonas Gorski <[email protected]>
Allow configuring the default idle timeout for l2 neighbour flows, to
allow applying configured ageing time of the bridge.

Signed-off-by: Jonas Gorski <[email protected]>
Add support for updating the ageing time by updating all table 50 flows
with a new soft idle timeout.

This works by setting a new default idle timeout value, then triggering
an update for all tracked fdb entries.

This will cause a reset of the entry's age to 0, but it's the closest we
can do within the OpenFlow framework.

Signed-off-by: Jonas Gorski <[email protected]>
Apply the configured ageing time on creation of the bridge.

Signed-off-by: Jonas Gorski <[email protected]>
Check the ageing time and notify the bridge module if the ageing time
changed.

Signed-off-by: Jonas Gorski <[email protected]>
Signed-off-by: Jonas Gorski <[email protected]>
Linux supports the special ageing time value 0 which means ageing is
disabled (effectively all learned entries become permanent).

So allow setting the idle_timeout to 0, and skip setting idle_timeout
for flows if so.

Signed-off-by: Jonas Gorski <[email protected]>
Allow ageing time of 0 and properly it by only rounding up to 1 if the
configured ageing time is non 0.

Signed-off-by: Jonas Gorski <[email protected]>
@KanjiMonster KanjiMonster force-pushed the jogo_bridge_ageing_time branch from 2de39ce to 88d3b74 Compare October 17, 2025 14:34
@KanjiMonster KanjiMonster marked this pull request as ready for review October 20, 2025 12:07
@rubensfig rubensfig merged commit e1613eb into main Oct 21, 2025
6 checks passed
@rubensfig rubensfig deleted the jogo_bridge_ageing_time branch October 21, 2025 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bridge Ageing Time Configuration

3 participants