From patchwork Mon Jun 19 07:14:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Nixdorf X-Patchwork-Id: 13284039 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DE0F5387 for ; Mon, 19 Jun 2023 07:15:26 +0000 (UTC) Received: from mail.avm.de (mail.avm.de [IPv6:2001:bf0:244:244::120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE9E9E4 for ; Mon, 19 Jun 2023 00:15:24 -0700 (PDT) Received: from mail-auth.avm.de (unknown [IPv6:2001:bf0:244:244::71]) by mail.avm.de (Postfix) with ESMTPS; Mon, 19 Jun 2023 09:15:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=avm.de; s=mail; t=1687158915; bh=BNp1+DjjLSKZLoGkP0KT3SOsCB2azAY047syYb/kWxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R7jRjnsXhMjv1X2vrOSJOMJZ/V/dfuxQV5Tyg5kgXwC4Cmn8+TjQwZ1awcblvbRkQ ZMDZzCSHODo3gnm2eNkcf3wI5AmDDf5HxkcjaJV47j/BYNB+qwZODDYUcPD+ZVuKzN 1cyvbnXF70dM2l5PcRQ/1Zpro++e0ySRNCLykQgA= Received: from u-jnixdorf.avm.de (unknown [172.17.88.63]) by mail-auth.avm.de (Postfix) with ESMTPA id 156CC81ED2; Mon, 19 Jun 2023 09:15:16 +0200 (CEST) From: Johannes Nixdorf To: bridge@lists.linux-foundation.org Cc: netdev@vger.kernel.org, David Ahern , Nikolay Aleksandrov , Vladimir Oltean , Andrew Lunn , Florian Fainelli , Oleksij Rempel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Roopa Prabhu , Ido Schimmel , Johannes Nixdorf Subject: [PATCH net-next v2 1/3] bridge: Set BR_FDB_ADDED_BY_USER early in fdb_add_entry Date: Mon, 19 Jun 2023 09:14:41 +0200 Message-Id: <20230619071444.14625-2-jnixdorf-oss@avm.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230619071444.14625-1-jnixdorf-oss@avm.de> References: <20230619071444.14625-1-jnixdorf-oss@avm.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-purgate-ID: 149429::1687158915-957D8D8A-6847E6D0/0/0 X-purgate-type: clean X-purgate-size: 1470 X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org 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 --- 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); 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)