From patchwork Thu Dec 8 15:28:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13068539 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85CD4C3A5A7 for ; Thu, 8 Dec 2022 15:30:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230390AbiLHPaJ (ORCPT ); Thu, 8 Dec 2022 10:30:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230310AbiLHP3t (ORCPT ); Thu, 8 Dec 2022 10:29:49 -0500 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2071.outbound.protection.outlook.com [40.107.101.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A91B786B0 for ; Thu, 8 Dec 2022 07:29:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mYrqpPs0UASbxKBCwD7wNeXPh8uoFRGmUEOdtQhbPKQ89G5xf0s6NafLwX/qGcUJDUI06k9BloTGODypuAQ28E0LRYxSyrqmTxQ0FtsMjnCJQb8cZ6FtJBm3Dy2x1lEqwn+Bgzfl/wt5dI17yQh/9rcStJNbtxVA0l7arTGf3EEAfv00uQ4Fb+hpA2ID5oM+TVyw2Lc5jgfmPzl0zSIp4D2mcSuPpOTgaKE2eHhcGIaDp4dbFeOTCnPU8hldcxTQJNl7pvk3eJpwuHmOnTrHIDHsCzNFjj14dHLvcUOdi5IOPDOIJB7/+vPzRF99+sBSMs9ocIvQoTXztKcMDLT01w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Io+ImuS3b07MnnII6pXyXtb80xF9L+WnhTul4DWibg4=; b=El72bOtt5hyB8Y+i0pX9+wLdSHq1tWpwmyIVqWDd6/2jSptfGb2z/oNigJluZjpYmceFbr2CiP44T4MVLn7jbB/EY/IuP591xkwWVL8Ev7ulHOnLTOS5393OfgUD+GpPvvxmCb29M9ET/nFkgzn7btbCKCIh75ru+pOlSbfKOMcHBm/Zw5I8zJ4uZJJudohOa+79fZCQBgUWFo1oCkIyF49P1T5LcJDOo0w+rVRTgmnTQQab+3VFErl4mi2AMC4MTJyPnwfxFWqR8a6WIJdjv4PR8R8O2Ssqbjii/tF6Yyqh++vBI8c4kDpTSC+JFFvePmq0B97UFBFj5CFZ0FgjcA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Io+ImuS3b07MnnII6pXyXtb80xF9L+WnhTul4DWibg4=; b=tDgHJ9ZxdmPZjT9l6ris9R6nbmAI6vr/FqcCe4O/7OKW31Fes2gT8YfhP8qM3v6chF4qmdreZvsVsgKWk9NovTgbp/+EK6QxRdeHTIgZv5WnwV7dbZZGb/8A3l4uOCZUZq7pXoDcnZYykfqK6W6kHW+KkHvKpQmsp8Njn1Wm5dm/bJqTfIcfPGcHgS8L9ju4RJnABljdMYd6sAFZoQvTD69DWGId7KS8NShqmuZuEj/wGRXwWJZF7Jj54cTI3s3seLV9bAaySgp93KQ9e3JCv39szco3lGHFm49V6FdVMOpCl5hyi/ebtY2VmtbwogJlT9w3oTW+SZ+sFp9H0S9/hA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by IA0PR12MB8207.namprd12.prod.outlook.com (2603:10b6:208:401::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.13; Thu, 8 Dec 2022 15:29:44 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a%3]) with mapi id 15.20.5880.014; Thu, 8 Dec 2022 15:29:44 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, roopa@nvidia.com, razor@blackwall.org, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 07/14] bridge: mcast: Add a flag for user installed source entries Date: Thu, 8 Dec 2022 17:28:32 +0200 Message-Id: <20221208152839.1016350-8-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221208152839.1016350-1-idosch@nvidia.com> References: <20221208152839.1016350-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR07CA0248.eurprd07.prod.outlook.com (2603:10a6:803:b4::15) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|IA0PR12MB8207:EE_ X-MS-Office365-Filtering-Correlation-Id: faaa67d7-aa87-436e-627f-08dad9310804 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TFtDCHjPCIuaH4bGMOZu6utbMvtsSCRzsr8ZdgD0yk3OihEHnzZuk0KrRQhMKcJT5vQTA0dI43iIFl1JFmZ9YUcDYxBi367PXcDz7EHkyaRUElRob8uEli4PURdvHbJ2uhLkhLteZZpbl87F0rFVsZKUjBJ4DSF/5ZvjN+rSEOdPUwsztZvx3gSQVDfqjnUpQp+QaJmjKQE+tl5jPPdbwi7w7wyU3UibYEuOtEewHcaLr0mHT2XCikRIGHBtSf5FCZCgHofoFsi8iYls8QX+RG+yCw/SgUU0xj3QSDHuXpLZT6dD79M++2dQ0rp7Vhh33uAoI1epZwUf1Ywh6ERuW5swe/7PL2tMhIKmav/aPvVZs9g8nRG3XkmYIiOyC47rfzZ40ir5fSRj/hVNtQnEFW59K7cW1Cvr8X7KZmpVYYmp4d813mIeQdSuimJpxTupYi260Vx//mLceCEVwkQGmMxobVzOU5n3UgxeGNKwWOWuFlEaKMF1Gjt6QexJIqp7jruzYjV2MPfpdp23vcS7+fq5MsI/oqDeZdxILv+eJAql0PMXMeUux0egYH+Hxp/JV+SRRggo9pfr5cMwAk0icECQeGVUQgEtKoEIPXC4Iywa3nwyziVDaGsO1elQwUeAXtNtAa7LXX16KiZvjb3oZg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(136003)(396003)(366004)(39860400002)(376002)(346002)(451199015)(2906002)(83380400001)(41300700001)(36756003)(1076003)(186003)(86362001)(5660300002)(38100700002)(8936002)(6666004)(316002)(6486002)(6512007)(478600001)(26005)(66476007)(2616005)(6506007)(107886003)(4326008)(66946007)(66556008)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rn4MCVa+jWL8n/OzTxrvsthQSVRB/svEutQBJ8u4o2cfy7Mbe01ypcKjzacD1G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dkzyJLjsgSpln99wWlMjb6UXVjjyZHrrjIeGV7TWRvOjif3py+gfnWVUa2pVELLF+J5JdveGz2u+OecLa63eMiW+vCheg0EGFoeT8G5y0xs4vyz+rnqfX/6kgnNVWoElJ23lZsBl6FceLUlasCgC1Zh69Kz2FVtPooNFr7XJiRShDHkC2iQdbtiKzxBvZvtrTGD1jkSCar+N2NcqLljVvTDX4P1Ihy7NlOsq0qYNQ+m5cgqx6jY0+EhJyZD5ehA6h1hcUTbiphhswcVIfkSInJKzQFPZvH9uBIQX9ZVEEZxKn5MTEWagCP/TfCoEHXnn+fKznECy97dwINp8ZJpDRCyONUJqDZV/rAp+ODTiGpvvD1Vtlp0bJwOKlBdQNOM6MF66WQA953fByWTw708ifi9HNZ5nbsXBPvmInoajeA364ref+HhoetIfdNuphjcc X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: faaa67d7-aa87-436e-627f-08dad9310804 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2022 15:29:43.9351 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pbUbDFAw+l54spojQf6OcMqTdaez55/7OjLD6VxKk5IgrGJD5k9W2o7L8qBSe+/q5OpMtD/OJIfrCwtq94IdVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8207 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org There are a few places where the bridge driver differentiates between (S, G) entries installed by the kernel (in response to Membership Reports) and those installed by user space. One of them is when deleting an (S, G) entry corresponding to a source entry that is being deleted. While user space cannot currently add a source entry to a (*, G), it can add an (S, G) entry that later corresponds to a source entry created by the reception of a Membership Report. If this source entry is later deleted because its source timer expired or because the (*, G) entry is being deleted, the bridge driver will not delete the corresponding (S, G) entry if it was added by user space as permanent. This is going to be a problem when the ability to install a (*, G) with a source list is exposed to user space. In this case, when user space installs the (*, G) as permanent, then all the (S, G) entries corresponding to its source list will also be installed as permanent. When user space deletes the (*, G), all the source entries will be deleted and the expectation is that the corresponding (S, G) entries will be deleted as well. Solve this by introducing a new source entry flag denoting that the entry was installed by user space. When the entry is deleted, delete the corresponding (S, G) entry even if it was installed by user space as permanent, as the flag tells us that it was installed in response to the source entry being created. The flag will be set in a subsequent patch where source entries are created in response to user requests. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_multicast.c | 3 ++- net/bridge/br_private.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 8432b4ea7f28..48170bd3785e 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -552,7 +552,8 @@ static void br_multicast_fwd_src_remove(struct net_bridge_group_src *src, continue; if (p->rt_protocol != RTPROT_KERNEL && - (p->flags & MDB_PG_FLAGS_PERMANENT)) + (p->flags & MDB_PG_FLAGS_PERMANENT) && + !(src->flags & BR_SGRP_F_USER_ADDED)) break; if (fastleave) diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index a3db99d79a3d..74f17b56c9eb 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -300,6 +300,7 @@ struct net_bridge_fdb_flush_desc { #define BR_SGRP_F_DELETE BIT(0) #define BR_SGRP_F_SEND BIT(1) #define BR_SGRP_F_INSTALLED BIT(2) +#define BR_SGRP_F_USER_ADDED BIT(3) struct net_bridge_mcast_gc { struct hlist_node gc_node;