diff options
author | Johannes Nixdorf <jnixdorf-oss@avm.de> | 2023-10-16 16:27:20 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-10-18 03:39:01 +0300 |
commit | cbf51acbc5d50341290c79c97bda8cf46f5c4f22 (patch) | |
tree | 28f009fb899c8d89d52964ce0ed91ca515d5b0e5 /net/bridge | |
parent | 56a7bb12c78ffa1b02e154b1d779ed2a1555fa3c (diff) | |
download | linux-cbf51acbc5d50341290c79c97bda8cf46f5c4f22.tar.xz |
net: bridge: Set BR_FDB_ADDED_BY_USER early in fdb_add_entry
In preparation of the following fdb limit for dynamically learned entries,
allow fdb_create to detect that the entry was added by the user. This
way it can skip applying the limit in this case.
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: Johannes Nixdorf <jnixdorf-oss@avm.de>
Link: https://lore.kernel.org/r/20231016-fdb_limit-v5-1-32cddff87758@avm.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/br_fdb.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index a98ad763b368..7738e1b56452 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -1075,7 +1075,8 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source, if (!(flags & NLM_F_CREATE)) return -ENOENT; - fdb = fdb_create(br, source, addr, vid, 0); + fdb = fdb_create(br, source, addr, vid, + BIT(BR_FDB_ADDED_BY_USER)); if (!fdb) return -ENOMEM; @@ -1088,6 +1089,8 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source, WRITE_ONCE(fdb->dst, source); modified = true; } + + set_bit(BR_FDB_ADDED_BY_USER, &fdb->flags); } if (fdb_to_nud(br, fdb) != state) { @@ -1119,8 +1122,6 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source, if (fdb_handle_notify(fdb, notify)) modified = true; - set_bit(BR_FDB_ADDED_BY_USER, &fdb->flags); - fdb->used = jiffies; if (modified) { if (refresh) |