bridge: Fix flushing of dynamic FDB entries
Subsystems (3)
Ido Schimmel
maintainerPATCH 1/1 bridge: Fix flushing of dynamic FDB entries
The following commands should result in all the dynamic FDB entries being flushed, but instead all the non-local (non-permanent) entries are flushed:
# bridge fdb add 00:aa:bb:cc:dd:ee dev dummy1 master static # bridge fdb add 00:11:22:33:44:55 dev dummy1 master dynamic # ip link set dev br0 type bridge fdb_flush # bridge fdb show brport dummy1 00:00:00:00:00:01 master br0 permanent 33:33:00:00:00:01 self permanent 01:00:5e:00:00:01 self permanent
This is because br_fdb_flush() works with FDB flags and not the corresponding enumerator values. Fix by passing the FDB flag instead.
After the fix:
# bridge fdb add 00:aa:bb:cc:dd:ee dev dummy1 master static # bridge fdb add 00:11:22:33:44:55 dev dummy1 master dynamic # ip link set dev br0 type bridge fdb_flush # bridge fdb show brport dummy1 00:aa:bb:cc:dd:ee master br0 static 00:00:00:00:00:01 master br0 permanent 33:33:00:00:00:01 self permanent 01:00:5e:00:00:01 self permanent
--- net/bridge/br_netlink.c | 2 +- net/bridge/br_sysfs_br.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/bridge/br_netlink.c +1 -1
@@ -1332,7 +1332,7 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[],if (data[IFLA_BR_FDB_FLUSH ]) {struct net_bridge_fdb_flush_desc desc = { - .flags_mask =BR_FDB_STATIC + .flags_mask =BIT (BR_FDB_STATIC ) };br_fdb_flush (br, &desc);
net/bridge/br_sysfs_br.c +1 -1
@@ -345,7 +345,7 @@ static int set_flush(struct net_bridge *br, unsigned long val, struct netlink_ext_ack *extack) {struct net_bridge_fdb_flush_desc desc = { - .flags_mask =BR_FDB_STATIC + .flags_mask =BIT (BR_FDB_STATIC ) };br_fdb_flush (br, &desc);
Signature · 1 line
2.37.3
Quoted 51 lines · Ido Schimmel
The following commands should result in all the dynamic FDB entries being flushed, but instead all the non-local (non-permanent) entries are flushed:
# bridge fdb add 00:aa:bb:cc:dd:ee dev dummy1 master static # bridge fdb add 00:11:22:33:44:55 dev dummy1 master dynamic # ip link set dev br0 type bridge fdb_flush # bridge fdb show brport dummy1 00:00:00:00:00:01 master br0 permanent 33:33:00:00:00:01 self permanent 01:00:5e:00:00:01 self permanentThis is because
br_fdb_flush()works with FDB flags and not the corresponding enumerator values. Fix by passing the FDB flag instead.After the fix:
# bridge fdb add 00:aa:bb:cc:dd:ee dev dummy1 master static # bridge fdb add 00:11:22:33:44:55 dev dummy1 master dynamic # ip link set dev br0 type bridge fdb_flush # bridge fdb show brport dummy1 00:aa:bb:cc:dd:ee master br0 static 00:00:00:00:00:01 master br0 permanent 33:33:00:00:00:01 self permanent 01:00:5e:00:00:01 self permanentFixes 1f78ee14eeac ("net: bridge: fdb: add support for fine-grained flushing")Signed-off-by Ido Schimmel <[email protected]>---
net/bridge/br_netlink.c| 2 +-net/bridge/br_sysfs_br.c| 2 +-2 files changed, 2 insertions(+), 2 deletions(-)net/bridge/br_netlink.c +1
-1@@ -1332,7 +1332,7 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[],if (data[IFLA_BR_FDB_FLUSH ]) {struct net_bridge_fdb_flush_desc desc = { - .flags_mask =BR_FDB_STATIC + .flags_mask =BIT (BR_FDB_STATIC ) };br_fdb_flush (br, &desc);net/bridge/br_sysfs_br.c +0
-0
net/bridge/br_sysfs_br.c static int set_flush(struct net_bridge *br, unsigned long val, · line 351
Quoted 8 lines
net/bridge/br_sysfs_br.c +1
-1@@ -345,7 +345,7 @@ static int set_flush(struct net_bridge *br, unsigned long val, struct netlink_ext_ack *extack) {struct net_bridge_fdb_flush_desc desc = { - .flags_mask =BR_FDB_STATIC + .flags_mask =BIT (BR_FDB_STATIC ) };br_fdb_flush (br, &desc);
Oops. :)
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:
Quoted 12 lines · On Tue, 1 Nov 2022 20:57:53 +0200 you wrote:
The following commands should result in all the dynamic FDB entries being flushed, but instead all the non-local (non-permanent) entries are flushed:
# bridge fdb add 00:aa:bb:cc:dd:ee dev dummy1 master static # bridge fdb add 00:11:22:33:44:55 dev dummy1 master dynamic # ip link set dev br0 type bridge fdb_flush # bridge fdb show brport dummy1 00:00:00:00:00:01 master br0 permanent 33:33:00:00:00:01 self permanent 01:00:5e:00:00:01 self permanent
Quoted 1 line
[...]
Here is the summary with links:
- [net] bridge: Fix flushing of dynamic FDB entries
https://git.kernel.org/netdev/net/c/628ac04a75ed
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html