Skip to content

Commit bee2ef9

Browse files
KanjiMonsterkuba-moo
authored andcommitted
net: bridge: br_fdb_external_learn_add(): always set EXT_LEARN
When userspace wants to take over a fdb entry by setting it as EXTERN_LEARNED, we set both flags BR_FDB_ADDED_BY_EXT_LEARN and BR_FDB_ADDED_BY_USER in br_fdb_external_learn_add(). If the bridge updates the entry later because its port changed, we clear the BR_FDB_ADDED_BY_EXT_LEARN flag, but leave the BR_FDB_ADDED_BY_USER flag set. If userspace then wants to take over the entry again, br_fdb_external_learn_add() sees that BR_FDB_ADDED_BY_USER and skips setting the BR_FDB_ADDED_BY_EXT_LEARN flags, thus silently ignores the update. Fix this by always allowing to set BR_FDB_ADDED_BY_EXT_LEARN regardless if this was a user fdb entry or not. Fixes: 710ae72 ("net: bridge: Mark FDB entries that were added by user as such") Signed-off-by: Jonas Gorski <[email protected]> Acked-by: Nikolay Aleksandrov <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8487b4a commit bee2ef9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

net/bridge/br_fdb.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,12 +1469,10 @@ int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p,
14691469
modified = true;
14701470
}
14711471

1472-
if (test_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags)) {
1472+
if (test_and_set_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags)) {
14731473
/* Refresh entry */
14741474
fdb->used = jiffies;
1475-
} else if (!test_bit(BR_FDB_ADDED_BY_USER, &fdb->flags)) {
1476-
/* Take over SW learned entry */
1477-
set_bit(BR_FDB_ADDED_BY_EXT_LEARN, &fdb->flags);
1475+
} else {
14781476
modified = true;
14791477
}
14801478

0 commit comments

Comments
 (0)