Message ID | 20230619071444.14625-2-jnixdorf-oss@avm.de (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | bridge: Add a limit on learned FDB entries | expand |
On Mon, Jun 19, 2023 at 09:14:41AM +0200, Johannes Nixdorf wrote: > This allows the called fdb_create to detect that the entry was added by > the user early in the process. This is in preparation to adding limits > in fdb_create that should not apply to user created fdb entries. Use imperative mood: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes > > Signed-off-by: Johannes Nixdorf <jnixdorf-oss@avm.de> > Remove the blank line > --- > > Changes since v1: > - Added this change to ensure user added entries are not limited. > > net/bridge/br_fdb.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c > index e69a872bfc1d..ac1dc8723b9c 100644 > --- a/net/bridge/br_fdb.c > +++ b/net/bridge/br_fdb.c > @@ -1056,7 +1056,7 @@ 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, BR_FDB_ADDED_BY_USER); BIT(BR_FDB_ADDED_BY_USER) > if (!fdb) > return -ENOMEM; > > @@ -1069,6 +1069,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) { > @@ -1100,8 +1102,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) > -- > 2.40.1 >
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index e69a872bfc1d..ac1dc8723b9c 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -1056,7 +1056,7 @@ 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, BR_FDB_ADDED_BY_USER); if (!fdb) return -ENOMEM; @@ -1069,6 +1069,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) { @@ -1100,8 +1102,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)
This allows the called fdb_create to detect that the entry was added by the user early in the process. This is in preparation to adding limits in fdb_create that should not apply to user created fdb entries. Signed-off-by: Johannes Nixdorf <jnixdorf-oss@avm.de> --- Changes since v1: - Added this change to ensure user added entries are not limited. net/bridge/br_fdb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)