From patchwork Tue Nov 28 14:21:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471233 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2050.outbound.protection.outlook.com [40.107.241.50]) (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 BF5F75ABB7 for ; Tue, 28 Nov 2023 14:22:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="wv16PjBP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BXexXA/yxJw/3x0e54UMqqCc1rLgYTwhlUL5/U0bh+0cK9j8B8md3tiZmzC/RuoME9pb4T6ywuWGmAMH77OWOiTapQfpZ57oHIbvASsrcVUxHkJtYwDaappXpJg9TdIsmLRZrr5kzKWco54Qj+ZM7GRnRz3mavKQp4aS4ClVhs3Z3t7d9KCfkItCOjhKp7u272ckumBpIAG8u0Nhr7a99Ed7tY/Ti1YAQHQ7nTaFeRGGMtZM/+ptHJpPIo4RPiAKpqIpxV4V5b/nh6mAQVH6v3bMvoVDa6gNncZEbdxdi6CnDTUpQQrUhrS2WG64Ibr/ebFzjHAZpMOpHyiFjLN42A== 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=im0w7CtP3iX8S7SAEQ/Bujr0mMzfVUiEcCrdAu32FXs=; b=P6SGF5SlLt4ZMPpUtfMdeCYog3U18xoiGxoG9w6bUNfBCjkWovQJATWUC8bbvA+HJD+D31cRRlIrjKKAVF3kUJVbdi4ga3O/E2SkuJRCFjA5+k2qGKhh36g4VWVMt0LCAaBRVsj0MuQjgndQ/Jbc+OkY/vbdITq4MvMFq3WZZr2JYmJyFNgGYVuzXHl9F7zSPOSi4OR3kRhDYPPIfGQt+BBsEcC+WcHj0MBXpMffikFK2tBj4HtOkaTgAbh1otgSExYlh/eaWA7M8dEB3Cd5pSiXE9dGSkhS0vS0Tt6J+2uUGcolCzDt9HTNfTtmG9o/GDp1iiuGFX5MX9M9DxWpCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=im0w7CtP3iX8S7SAEQ/Bujr0mMzfVUiEcCrdAu32FXs=; b=wv16PjBPfJltV06scrfsoIuWg3iWO/Pylr/k+fS+kcHNHJjiFmN2HUc9RrLxeD4kG0cF84E6E/UjZ8ILNJPlIizk+gI55kt/QffyF6dcgTFcqb4m0seVnnfZKfVMTVIVLeQD0ef05L0xwPVqHU/I1LqWxOgAARcS6cJNrhtgyjILBAGR5XyR89iOq/wSnWAlILkPhnvFjLVotmQMlONe+Ntq7Fvr9+fqSRYic5R7JnqpizRNLWIypZus3Auxt3nhkFLO+iVfE67pfkX1q4rztxil7yI0gJHirZ5PIU4tS/tvzAO2lrYed0p4fwlj9cNR+rM+RClpAQuwKM28qRg8ng== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by DB8PR04MB7001.eurprd04.prod.outlook.com (2603:10a6:10:11f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:22:00 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:22:00 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 01/32] mptcp: export pm_nl_get_pernet_from_msk Date: Tue, 28 Nov 2023 22:21:54 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2PR04CA0184.apcprd04.prod.outlook.com (2603:1096:4:14::22) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|DB8PR04MB7001:EE_ X-MS-Office365-Filtering-Correlation-Id: 244ca4ce-94bb-42a3-4537-08dbf01d62bf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Fg4ojEp5dvs+5zG4VcWqUL7b2/ohld4rbI3m+KsjglHrzp6IX/gENu2MEaEaSeXQ+GK55SAFmSON8yVzIRVNM2+8IZPFenzAWnzJ4bOzCkeZgxTAVTj6Zwb+JX/2vJu3qNTO3cq7DVLubEpah+KRiXbvBhNyCMbeHjv0S/N+9b5akALRYeE+F+JFs+ZEpSIQobGtUAG9IzLwocjkOo1BQ4K0CCLo5QIFul7RSkUeNCLMQofhz5CNEdh4DmAqzoXhHpgL0vxqj8Lqq/XNeCWCj3FES1pdpm01kgoJx/v65B9O3F6Fo52pn/Z2Sv4UE0tveO3CAGlo7SUVw0vnR4ivq1Jl3oqVUxnjfhNxcNhlO78GjTg/MQHW1f8k/veBCReScD9f+SopmlAP4UWKwI5IkOSRlBRzy+2zeMFwPTUkur1QTGYye8caoNfpE5znkykDGzbUmlMLQG2iM6PnZAmaW58KLZVe9YWy+C+j3WKpopOLh75k8f/UBxikM93jEjmzhHoFkyVoRkI1DERLu6yUwQC6P8hQakxtusJTLvngIpl6acE9Mg4q0JJ1SBgSP2ai X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(136003)(396003)(39860400002)(376002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(36756003)(5660300002)(86362001)(26005)(6666004)(6512007)(83380400001)(107886003)(2616005)(6506007)(38100700002)(478600001)(6486002)(44832011)(66946007)(66476007)(4326008)(8676002)(8936002)(6916009)(316002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x9D1G3rjIVZ6bBvGYLnNSJWby7GLtkOq5Dbj9+g97LazXJcXI/lW7PNat4JNf815HfVnsGq+oJKZm4HuuS9mcYLZ/08D7FK5jfEk0LurtRp6EO/xsMNCK7bLVUXLFEHsGZIux+0y4XQm6+ujiM46Bhs5LhSyZeJVxTEQUG1PfkKJQoxvmQIVAvJ/COY6igt/CWThE3Ifo0jDYXr5WpEDNRNELdrqpFdIPxMox3fuJoWl58YQZ9KkAV95IbTuGfyj//uRDgwcAJLRsffWmZapFli0BG3OcPQnz7GC7FMEPDTodfqXocyC3dT/lxYNQWwUpUPeEV0y2kYNxNjURJy4CnTFzg7rWFgSiNliQ+hiGnEQ1daKKf1UjAFTzxiuLCcolOorMW5d6u3V32dw56uMhxkzbLNKXLdlo/MgJouQ5sPRGYQL1+bIlpSduV1fhhB+pS/glss8dvBxVGmCfJF44RlsPaem68IMA0DPpHtZCIqUhroTHZa333QPdltmE44yJzQMFJbXgQKvXc5IDPBlXnIQ1ngm5rJIuKY5A/pmaZo7q+oUX6+L1BjhFIJ9I917qC2EOp4WYdLb77MDIpDNrC/bRW/SJvIgWjhu1k+pRDCFUd/CkX9hyEZJ3iMU9wAcBEKQ0cENTORVj6G2u/MQF6ovfdyzCliejR37ByuJ5qr4W/+ec7tiXcVmUAf0fY1BoaSSaF97z2pccXBZIr7uyfwNmj3IIw/iaLvzQTYMTVDck6RM/CK9/HH46Dkowebtmvtemajv0AhZdcCbWP1tvIDOwVM19nXowaniBUSB1PMtVs/imrPxu6l+tQXd7ZVpjF2DLKTgjwnrAtryULAG2Fiw5S0yjU9LTjGDnSMRyJSPwWc3kLmyU/D+hQSygYLcY8LZ6PoZr9BIRNNlZTgj89TGBQUixIQ8utBiktlswTcnstZMq+rOow0YyBf6z5ceUou/StzWG1EyMbFwI1cfk8HnZNuG0vdAOaiSOOYNglXdIsns1s8kZGM5/7EZzVLuY+pERY3AZyefZea+ngRX4f3PymE1c3mM2SD86SoZs1Xx0JOjCOlgI8ZH2bpjdbIBezYzhVQhefppbvexURSdbeB8MMASdV+LS+JwA5CEJO00MDAkgg3DREydA86HRhrGh/i/72jr+gP+a1TQLjIo9U5RoiZiV9DH6MfJE2lWqNX3oaoNMnlufw3Xlp+/TFlbCxeRGs1caNK5Z8xeygJncnv8kqbtEDTBosJep6Of061tdXwNdp6u69RW1jwZeUclJzYjb2nW0WG456Te5XaWl7irRqzDcsPxPQ5k8117ie4Mv6sb6HqGAnnM5wF6lJr44nGgffLPiF9PDRvBoUnpUvDAMWxqhkOGUjvcU0ZJIUiSaOSjhqq5jofQYX/rBWuoEoD66JINuKMkNMMiBKZr3mFWz+ZQEdCCFoEZM+T4mE4Uusz46tEWuLukokSDjSTTIK/Sb90uRcYdYzKSjx7FaSuv4hNwmYI1DczsVHbfjJi9aXsh95bL2o8Bqdi9Lwuv2hDgM3nF7kBl1VRD3W0o3Dq31fplrYp+Dou33MraisBF+ey9E3lM4nPt9Mv1Z9hs X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 244ca4ce-94bb-42a3-4537-08dbf01d62bf X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:22:00.5549 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NZRJrmYhgqfFJrFJ9MIE7VM0fzZfgthlxKD69H97GibZG4VdVY6ipc2zwYalfZV6IcFzT7OHahnDzhGOPCqQGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7001 This patch moves struct pm_nl_pernet from pm_netlink.c to protocol.h, and export pm_nl_get_pernet_from_msk() helper. Then every fields of struct pm_nl_pernet can be accessed everywhere, not only being limited in pm_netlink.c. Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 17 ++--------------- net/mptcp/protocol.h | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index bf4d96f6f99a..1dcf104d7a01 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -31,20 +31,6 @@ struct mptcp_pm_add_entry { struct mptcp_sock *sock; }; -struct pm_nl_pernet { - /* protects pernet updates */ - spinlock_t lock; - struct list_head local_addr_list; - unsigned int addrs; - unsigned int stale_loss_cnt; - unsigned int add_addr_signal_max; - unsigned int add_addr_accept_max; - unsigned int local_addr_max; - unsigned int subflows_max; - unsigned int next_id; - DECLARE_BITMAP(id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); -}; - #define MPTCP_PM_ADDR_MAX 8 #define ADD_ADDR_RETRANS_MAX 3 @@ -53,11 +39,12 @@ static struct pm_nl_pernet *pm_nl_get_pernet(const struct net *net) return net_generic(net, pm_nl_pernet_id); } -static struct pm_nl_pernet * +struct pm_nl_pernet * pm_nl_get_pernet_from_msk(const struct mptcp_sock *msk) { return pm_nl_get_pernet(sock_net((struct sock *)msk)); } +EXPORT_SYMBOL_GPL(pm_nl_get_pernet_from_msk); bool mptcp_addresses_equal(const struct mptcp_addr_info *a, const struct mptcp_addr_info *b, bool use_port) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 8529b3ae55e9..c38a2126071b 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1026,6 +1026,23 @@ void __init mptcp_pm_nl_init(void); void mptcp_pm_nl_work(struct mptcp_sock *msk); void mptcp_pm_nl_rm_subflow_received(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list); + +struct pm_nl_pernet { + /* protects pernet updates */ + spinlock_t lock; + struct list_head local_addr_list; + unsigned int addrs; + unsigned int stale_loss_cnt; + unsigned int add_addr_signal_max; + unsigned int add_addr_accept_max; + unsigned int local_addr_max; + unsigned int subflows_max; + unsigned int next_id; + DECLARE_BITMAP(id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); +}; + +struct pm_nl_pernet * +pm_nl_get_pernet_from_msk(const struct mptcp_sock *msk); unsigned int mptcp_pm_get_add_addr_signal_max(const struct mptcp_sock *msk); unsigned int mptcp_pm_get_add_addr_accept_max(const struct mptcp_sock *msk); unsigned int mptcp_pm_get_subflows_max(const struct mptcp_sock *msk); From patchwork Tue Nov 28 14:21:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471234 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2057.outbound.protection.outlook.com [40.107.241.57]) (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 B86175AB92 for ; Tue, 28 Nov 2023 14:22:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="GCT/zOgR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ly1VmSR718vCGOg8+Uzfpzt5dRObhvzuiFbk3dt3t/dECsxAe64mSjOtTWuQ8HJBHUC8p/FS/x8KrPVQ7GuVwcWtgQWmIUNsSaquqnOhcuCf4fqr+nOp28X2veAt8q4aI3JtUJ5P+g1HhONOy6VESu+4FU/V6Ygvq8k5isSGo+fsjsxyxQ/7ixBdL1KTxBoZ8Z1ZkMEu65pKo/vGc+XGEiTiD0Sn9kEcbvkyPjOThcLJn9FtI0BhTV/aPbLdmwjsV5lADvoEWQsEKFqILF8I/I7Xx3euvPIOkH7Ge3rqGOegrHFXIZlitz4qzdW/TLctr6P2P3vXeMLWm0N80cBy1g== 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=GWWUSY9xk98fgltOIrmPyL+RfYmmMYbkdDqwVfSOL28=; b=XtnhdOPvXueG58U/HFE2Fh2pQpuvejfXxY20zgy3x7RCqRSy9dF31pAOvpHrzLPO1rvbI0xXSQgh5JJxV4YRsBFpe2shZKDO4OGJMs/pZ4486DMT76B2ziiGJGgLXs2fNJ6rqSYxeFfzxMV4o+HEOHmvNDFwJkkv+eBRjcgh7WPJwmeISsqgeYnbHtoLZSvTG3Ny4NRWUZ0YFD/gxlMbAeun/Gg+ZaVnG/UEx7OsuGMKR1tCdnljJhQUOjy2CJ6Fv+caV0iIa8C8VmC7HCRIB2ZE3u+G/aGnFb6wDrSvRmwnr59xuUSm9eQJDFF7xj8hHUdbuRFHovcKMxI9PlfVFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GWWUSY9xk98fgltOIrmPyL+RfYmmMYbkdDqwVfSOL28=; b=GCT/zOgRA5GYM1cwPxEBAPl/rZ6B2Nsvvhw53TtJJixroG2FcOabR7V7TSMmR7AKDvrZd44Q6FiHrsqh9Vb4Cju+MP77Y9tYDmYlVNmyCmyOM/1icVM0zoBJcN90xv+1JGe27enyWCOPMwe+ScMNTryWDCe5Ph9xEVwHooPczmK9oqivHUzaOh7xD6So9gcuX67kIsmWJa6dYNXTaAadRvfIDTnzv7RqgFQQxUKrDvTpNPANg+AUNPOMVgCiy0mbGslvAmXkxGW59glBJfwsIoh49lowzn5PpbLycEGoVaZUMjc4pLLGDGcWN9NWoS1Fr+MC6IyfFtoqtJeXejKilg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by DB8PR04MB7001.eurprd04.prod.outlook.com (2603:10a6:10:11f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:22:07 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:22:07 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 02/32] mptcp: drop mptcp_pm_get_* helpers Date: Tue, 28 Nov 2023 22:21:55 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2PR04CA0186.apcprd04.prod.outlook.com (2603:1096:4:14::24) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|DB8PR04MB7001:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e698855-24d4-4df3-6aa0-08dbf01d6674 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IlcWTp5lCddnO/t1Fil35KGkKc7JdWL3gtR71nb7ie57xIZdmkUWfQC0Wld7mACIA9bbEUYMUEULp9yTcsRy6XWZ47EFFRxkA5CxrHk6lWEYdbU8xlsUd7pF7dxsDcq9LPp2gm2kCVLYONPV33UpilgQDQEYb78DTdkoloenaYskcNZL862WAcezu2YRPqf/nI66lCZZjWmEzcWqWZazQi9U2M72WwmkfphflFTjP0poBXC1E86WH54+MDBRCra5vouvjOF8rdd67NUFpdmkYyrFLGTmXBPSmNFD9e71g8TT1oFnQY9JtXMR25dCqpXbEY/Xn92uQMSkfeGoiyG2s0MHBZv4pjeQTl/os3E1dPH5M4DF8RbQk4vEBrGhouf6R55tNjlvEbgYyC+4Ij6kcWmD/ruVy+j6VgVnDMwdYPM8veDLB7xz6++b2TxS67V6aqbNbvTF8TSLlF6j/QJRchGIlpKuXtvQJ20nD62HtfFakuFt9cmCGfAfxWL2ojUTlyi6t+V2Fa3CzTskGLNZW8vX02FvtYSvSWrvIvOAIHu6flo2mpxLQnnQIpwmlEYRmyYB8P9z3IPly6fw6Z18ZuH7BF4/sxrFjqNtaLqcXG7/Mm/XjNqA2azLZCrRiltk X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(136003)(396003)(39860400002)(376002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(36756003)(5660300002)(86362001)(26005)(6666004)(6512007)(83380400001)(107886003)(2616005)(6506007)(38100700002)(478600001)(6486002)(44832011)(66946007)(66476007)(4326008)(8676002)(8936002)(6916009)(316002)(66556008)(309714004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 70lYGNdC0OrKsmdjlFdEr14GycM4J7mXTIv59IipjZ7dq8ftwNshs0DlSF09m7oaA/Vq/SnTb3MGdSkDrWCoymdra7DQQWvBhx2YRzFK5s/glNc13e0zJR18H+Tq+XMfOPxDrfW/vmLRqTBGeKn748A4iXbVI5ImETmxR14yE33oQWKCo6ZnfK85nyHrLPGpxjvlW/wtrTDq4cu3yi4jkVcMgaIufXME3h/Uaq2B/VoMvI43KR1d/+nCmUm97nSMkVTxgOT6MCDEUtg828VRktZ1b1CaTHMPooIslsCZ2UnE7DJSJfnKqD4VKE/7do91FNeTOPofRdUP4b6epZxBBxiTZUK0UIUj9wcUXpY+RB9+nZ9IbLrdMKAAimegjVFvSzAcgIaAr3OoRVaoJxQF+xJu7uaaoZIGnR3GIPfT+CqzPczuXRCIPFPy+vaWC47Mb6zXzjf5XmlXLJoO6ZR4pr0Nh76cAGzdcJZMf9U1qxSvm2IBxbNTPM1b0NrBuhbAuZe7FuzEozMoOWm9sLWrXcviZAZoWqfM+hf3bzi0NDHt307jFL8QIu1Jrki4Oaa2M1P/flnWfjiz9TUOhmPoqpxdXXcgfZ/Cqzw0SMuKkICJRAqX0IpbKPJA8OD3PUQrsaHPim/n3UKlye3kvsU6I27gz02F6lhogZYsI6HRQepDtMH+a1mZr/seni7e8bnb2hBC5QP/OpANkRaJlyBLfLQ+UAyx9dXO5+lp1A5z9m1Qyk0otYRB6vj593Lquqo02cGibIX4eeRZmLXBBr8OU91G9xyq5L22cviumrdRtD7DokOp6HjoTuvUpIhSaHDAkff9L4dpQ9cDmq2aQg0O+c6EGDPZqlLREqD5V8YLlNlPrtdWub2EJXGFzrrEoaNH7AR2Q9oelO+ERJE+3MsyjnxwxA7/J2EE+w3obf8J2QJ37fdtAk7+upI6E4VLK++JVog9WlPKvPpunZoU80h1pk6cdQOpOOMrYamSwSDYzaS3pXsb+BEvjTeComyOT6we1EaoVGmj5lNZ3w6ul7U2PjPWihA4GKQOO9IUvfhIktmCQtdnzCkyI2sS8//4KguMmOg0Y9QjWB4RTylc+GyNbiYqHCKlfBy2hytHk1FRAondpxcJJb19L7nZ2yYhqhjdtout89U0QX9w1P+j68UWreOG6GkkmidBFOIAfeLgaAqVVsjvniBEaurpRujQU0On2hIpfvTowKwGxS5NtizBKsYdLht776EcQ0NzLm5XOlbLwYZn3ZZOiJaKnsdCR1Waqgs2lplgyrLknSfBWIU49+1T2WHB669NFMw/SGhl/HUqKRCanGqDsZxrw7l9mHSbuCeF4JdFEwVhzya805uRYnYOAgHXuOm8H0vOfQhDYDOF/X/VvLEVaQVy2R3Uc9rizMsyypvsfrHNjYR8j4nGmSbvwBzXvRdFWsOi1kt3ymIubUpM+GogRMWbjauBc7PGJ2liy8mOlZckq5HT/POM1tuW4K1NYtYfIKf9icZQzAkEaU1/7W2xKFiJU67hk1fseNsOKOIhDFWa12wNrMAhUHAt2ZjqRafxlBQ7A+77NMBb776WvMhReXD0iCT8fdxL X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6e698855-24d4-4df3-6aa0-08dbf01d6674 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:22:06.9755 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ctqzk8xpFRx60l9J3Jze2OuLaeob1eLT0lP2uMgBuU4IUm2XDo9PJ4OpSqLV8e/jHddGYQ25bQ5QsHP5/C1hcw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7001 Drop four mptcp_pm_get_* helpers: mptcp_pm_get_add_addr_signal_max(); mptcp_pm_get_add_addr_accept_max(); mptcp_pm_get_subflows_max(); mptcp_pm_get_local_addr_max(); The helper pm_nl_get_pernet_from_msk() now can be used to replace each of them. Signed-off-by: Geliang Tang --- net/mptcp/pm.c | 12 +++++----- net/mptcp/pm_netlink.c | 50 +++++++++--------------------------------- net/mptcp/protocol.h | 8 +++---- net/mptcp/sockopt.c | 9 ++++---- 4 files changed, 25 insertions(+), 54 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 4ae19113b8eb..48ff7ce20890 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -85,6 +85,7 @@ void mptcp_pm_new_connection(struct mptcp_sock *msk, const struct sock *ssk, int bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) { + struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); struct mptcp_pm_data *pm = &msk->pm; unsigned int subflows_max; int ret = 0; @@ -99,7 +100,7 @@ bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) return false; } - subflows_max = mptcp_pm_get_subflows_max(msk); + subflows_max = READ_ONCE(pernet->subflows_max); pr_debug("msk=%p subflows=%d max=%d allow=%d", msk, pm->subflows, subflows_max, READ_ONCE(pm->accept_subflow)); @@ -496,6 +497,7 @@ bool mptcp_pm_addr_families_match(const struct sock *sk, void mptcp_pm_data_reset(struct mptcp_sock *msk) { + struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); u8 pm_type = mptcp_get_pm_type(sock_net((struct sock *)msk)); struct mptcp_pm_data *pm = &msk->pm; @@ -508,17 +510,17 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk) WRITE_ONCE(pm->pm_type, pm_type); if (pm_type == MPTCP_PM_TYPE_KERNEL) { - bool subflows_allowed = !!mptcp_pm_get_subflows_max(msk); + bool subflows_allowed = !!READ_ONCE(pernet->subflows_max); /* pm->work_pending must be only be set to 'true' when * pm->pm_type is set to MPTCP_PM_TYPE_KERNEL */ WRITE_ONCE(pm->work_pending, - (!!mptcp_pm_get_local_addr_max(msk) && + (!!READ_ONCE(pernet->local_addr_max) && subflows_allowed) || - !!mptcp_pm_get_add_addr_signal_max(msk)); + !!READ_ONCE(pernet->add_addr_signal_max)); WRITE_ONCE(pm->accept_addr, - !!mptcp_pm_get_add_addr_accept_max(msk) && + !!READ_ONCE(pernet->add_addr_accept_max) && subflows_allowed); WRITE_ONCE(pm->accept_subflow, subflows_allowed); } else { diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 1dcf104d7a01..dbf040e39af4 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -183,43 +183,11 @@ select_signal_address(struct pm_nl_pernet *pernet, const struct mptcp_sock *msk) return ret; } -unsigned int mptcp_pm_get_add_addr_signal_max(const struct mptcp_sock *msk) -{ - const struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); - - return READ_ONCE(pernet->add_addr_signal_max); -} -EXPORT_SYMBOL_GPL(mptcp_pm_get_add_addr_signal_max); - -unsigned int mptcp_pm_get_add_addr_accept_max(const struct mptcp_sock *msk) -{ - struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); - - return READ_ONCE(pernet->add_addr_accept_max); -} -EXPORT_SYMBOL_GPL(mptcp_pm_get_add_addr_accept_max); - -unsigned int mptcp_pm_get_subflows_max(const struct mptcp_sock *msk) -{ - struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); - - return READ_ONCE(pernet->subflows_max); -} -EXPORT_SYMBOL_GPL(mptcp_pm_get_subflows_max); - -unsigned int mptcp_pm_get_local_addr_max(const struct mptcp_sock *msk) -{ - struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); - - return READ_ONCE(pernet->local_addr_max); -} -EXPORT_SYMBOL_GPL(mptcp_pm_get_local_addr_max); - bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk) { struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); - if (msk->pm.subflows == mptcp_pm_get_subflows_max(msk) || + if (msk->pm.subflows == READ_ONCE(pernet->subflows_max) || (find_next_and_bit(pernet->id_bitmap, msk->pm.id_avail_bitmap, MPTCP_PM_MAX_ADDR_ID + 1, 0) == MPTCP_PM_MAX_ADDR_ID + 1)) { WRITE_ONCE(msk->pm.work_pending, false); @@ -404,6 +372,7 @@ static unsigned int fill_remote_addresses_vec(struct mptcp_sock *msk, bool fullmesh, struct mptcp_addr_info *addrs) { + struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); bool deny_id0 = READ_ONCE(msk->pm.remote_deny_join_id0); struct sock *sk = (struct sock *)msk, *ssk; struct mptcp_subflow_context *subflow; @@ -411,7 +380,7 @@ static unsigned int fill_remote_addresses_vec(struct mptcp_sock *msk, unsigned int subflows_max; int i = 0; - subflows_max = mptcp_pm_get_subflows_max(msk); + subflows_max = READ_ONCE(pernet->subflows_max); remote_address((struct sock_common *)sk, &remote); /* Non-fullmesh endpoint, fill in the single entry @@ -514,9 +483,9 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) pernet = pm_nl_get_pernet(sock_net(sk)); - add_addr_signal_max = mptcp_pm_get_add_addr_signal_max(msk); - local_addr_max = mptcp_pm_get_local_addr_max(msk); - subflows_max = mptcp_pm_get_subflows_max(msk); + add_addr_signal_max = READ_ONCE(pernet->add_addr_signal_max); + local_addr_max = READ_ONCE(pernet->local_addr_max); + subflows_max = READ_ONCE(pernet->subflows_max); /* do lazy endpoint usage accounting for the MPC subflows */ if (unlikely(!(msk->pm.status & BIT(MPTCP_PM_MPC_ENDPOINT_ACCOUNTED))) && msk->first) { @@ -621,7 +590,7 @@ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, int i = 0; pernet = pm_nl_get_pernet_from_msk(msk); - subflows_max = mptcp_pm_get_subflows_max(msk); + subflows_max = READ_ONCE(pernet->subflows_max); rcu_read_lock(); list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { @@ -664,6 +633,7 @@ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) { + struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); struct mptcp_addr_info addrs[MPTCP_PM_ADDR_MAX]; struct sock *sk = (struct sock *)msk; unsigned int add_addr_accept_max; @@ -671,8 +641,8 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) unsigned int subflows_max; int i, nr; - add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk); - subflows_max = mptcp_pm_get_subflows_max(msk); + add_addr_accept_max = READ_ONCE(pernet->add_addr_accept_max); + subflows_max = READ_ONCE(pernet->subflows_max); pr_debug("accepted %d:%d remote family %d", msk->pm.add_addr_accepted, add_addr_accept_max, diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index c38a2126071b..88f5b422f941 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1043,15 +1043,13 @@ struct pm_nl_pernet { struct pm_nl_pernet * pm_nl_get_pernet_from_msk(const struct mptcp_sock *msk); -unsigned int mptcp_pm_get_add_addr_signal_max(const struct mptcp_sock *msk); -unsigned int mptcp_pm_get_add_addr_accept_max(const struct mptcp_sock *msk); -unsigned int mptcp_pm_get_subflows_max(const struct mptcp_sock *msk); -unsigned int mptcp_pm_get_local_addr_max(const struct mptcp_sock *msk); /* called under PM lock */ static inline void __mptcp_pm_close_subflow(struct mptcp_sock *msk) { - if (--msk->pm.subflows < mptcp_pm_get_subflows_max(msk)) + struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + + if (--msk->pm.subflows < READ_ONCE(pernet->subflows_max)) WRITE_ONCE(msk->pm.accept_subflow, true); } diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c index cabe856b2a45..8d63df5ded50 100644 --- a/net/mptcp/sockopt.c +++ b/net/mptcp/sockopt.c @@ -893,6 +893,7 @@ static int mptcp_getsockopt_first_sf_only(struct mptcp_sock *msk, int level, int void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info) { + struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); struct sock *sk = (struct sock *)msk; u32 flags = 0; bool slow; @@ -910,13 +911,13 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info) /* The following limits only make sense for the in-kernel PM */ if (mptcp_pm_is_kernel(msk)) { info->mptcpi_subflows_max = - mptcp_pm_get_subflows_max(msk); + READ_ONCE(pernet->subflows_max); info->mptcpi_add_addr_signal_max = - mptcp_pm_get_add_addr_signal_max(msk); + READ_ONCE(pernet->add_addr_signal_max); info->mptcpi_add_addr_accepted_max = - mptcp_pm_get_add_addr_accept_max(msk); + READ_ONCE(pernet->add_addr_accept_max); info->mptcpi_local_addr_max = - mptcp_pm_get_local_addr_max(msk); + READ_ONCE(pernet->local_addr_max); } if (__mptcp_check_fallback(msk)) From patchwork Tue Nov 28 14:21:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471235 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2055.outbound.protection.outlook.com [40.107.241.55]) (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 EB8C735888 for ; Tue, 28 Nov 2023 14:22:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="L5Tp4d2A" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VZlToa0Gt8Qlb/CxHckrGgcrFo67FnihxvY0KFw3NCUd9yk545NPmfTZZfvf5Uih3QVkYdAzrZlIXTkFDu5JJWKCwj0tnaHPfu7EGnXeJhXY3PrfqVeaAL8AHqCTsA6K2baPmJ+ODaAYrwCH463EhWA/oeEm/ToV1xJ8X8MpLKqxkkbIJaShFZXC8qjP+pg7Lau6cwZmkdkZIl4viqGAV8BeFgBxOh5FfdgEaFsnLQhYVRZh1hAfAmND0nTO/mhse+lt0X+G6ODrAOAQzugDL4lQHCjA3Pq2iauJ+UlJFp3UZGiqUnGU7Mb2Pygz2i1lHTXY1OvTzDCrHGcs+MRy6A== 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=DIHyqT6HE6SN+ei496ifxFyH6B28w5/Nfb2pvs1TXCU=; b=Q4E7vYlkoIE/y5OjrQ0CtZfX3+JckrluwN3l7AzItwXwBiPWBgytZTVUhd+sQB8E7f7ydl7DpMr8anp86dGOoC3sQoWOu76LWD9Lw4U8tmOemoIjLzYSeEU/wO7xvXwjBJoX8Q+5+npWZGEdlEiV2cYB7isvs5OmiBhTVdV2AY2EGBi2eRqniMdTxu/X3JTqHwduoD2KrW2Pw5ou5hsqPU++QPTD1A6lLmxT1WHnZlujdRdnRWaGv3yiGCTyvhhtw4SU0ayTSbNjlnbqwlKKdyIEXlHwUGEfkGwqIiuakaLAvTCFWulcKGXbAON+7tlQbXhK93otll122nOoPZM+Vw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DIHyqT6HE6SN+ei496ifxFyH6B28w5/Nfb2pvs1TXCU=; b=L5Tp4d2A8cOxZ7yCR57LGIZsbkOLlda5aVk+4ArHGLU3AZq53+ljRzCl8RQhm/s/IA1g7I2/b1s6ur6d8ENa61Ix4OIRkkYtnFMd1GEdEUUQeZqIznrHWISKTRJXn56lrrrAfR/Ls356ynVB7SQ4YeJuuK6uiSjvBWS092mPsy/DiQyIme051I21cIFov/V+PE/noHB+feRBu53sjNyNuaCbEQ8FmB3JZkZdJXjzF6qI24qjfKB3PhRhZGkGLojuQ/S+tTZWhZ0Cnx3yVOirMzGidPUtc79qQmHN5TxE1HRwvgbqx6oSLwdgLODwkeuW98jo6ms9NB4sW9kAuAyCQw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by DB8PR04MB7001.eurprd04.prod.outlook.com (2603:10a6:10:11f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:22:13 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:22:13 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 03/32] mptcp: use pernet id_bitmap in userspace pm Date: Tue, 28 Nov 2023 22:21:56 +0800 Message-Id: <13dd8a9e51dbe243a462dd61200d1a4deb7bc6a3.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2PR04CA0193.apcprd04.prod.outlook.com (2603:1096:4:14::31) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|DB8PR04MB7001:EE_ X-MS-Office365-Filtering-Correlation-Id: 92b0b1c0-ef84-4c8d-2cc5-08dbf01d6a4a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0LY0kKPqQQI4K3Ix+b+8T9RMIyiUtK29AIFzEPOmKAdwAOM39YnmLEhe/3muKrJk7J1CU4MIw0NVzp1AZCUtHknymL7rZQsEsmlqv99OeHumAWo3X5cjBLd/rLSX7nrwRFUPGhQNBTruS41bWZV1JUzdtxfHiesTlJMAnTqk6FDMfiLrznjfOmU5nBHIeYix4zWyoQOA3XK9FqSTYFZjVrrXeIQuZPdu2GNx6u9KKhdZQRYJCc09XyFjqMDSgzWS13kkoD8AJF9iy2prqoSsc2d/PRcA2SsO8su6iuaN6MdWH4G7Pu1Fr0/tKt35i6J0QwWJk1u6II4tGMjB270vvw17SwxRpcpkP03V7GFcXjWmTWEhZ5P18tJq++fAWxH935g5IJ8d8cwdniAeR5bw9aMVmqK8KQx28NBMgOpimSmEZZ8ny0paqepQlnAX+Coh6ya1JpDbOv81FCr+GxmI4sQ59Sa1xlcgfmf7sDK7b2tJc2ub+5j4LoYxJg/UUbP1Nul5oZ4AOPMopY0gknzXVIwIO7v702l8KaFxW4ZsHpz+Dk9Qrw4Tn2uS23ZxbfFY X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(136003)(396003)(39860400002)(376002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(36756003)(5660300002)(86362001)(26005)(6666004)(6512007)(83380400001)(107886003)(2616005)(6506007)(38100700002)(478600001)(6486002)(44832011)(66946007)(66476007)(4326008)(8676002)(8936002)(6916009)(316002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: h18aaPaz73AkI+A+b49kxN6FFp+u4eISruv0EZs12AIoHykLUQdlFsdKmXvmRUkootsxxGZ2ewTtv/mlmcmVb2+MzRXpUCd3NhmLZ41NFTRgu1bf+MG7TaabwOk3kMMrOEiqIGuoADIuOCsW/6yL1E1S0rsb1BeduhCzRKR8C66djiKtCYdF3YWdQNi6kJ/RrhurCPsVRon1MlOGD1llWj6BKHuSWPg6iQHhTMy7+bBvwWyTCxkyJ5ZCij994117/Hxj/xdkMG1rYvLJOnVsH9khWraKfc3wp1+32Rm1KnPLWvGEpQkSg6QxQnbce6vB3eOvvdCBt6i4ScxDBl55vSCA1E/EEoIlCJDI8xcIM3WYP83n7lWog40o9hKBWTqojVAqsJrZ90gOAeHBeQsJkhjAnibD19z7CPjtPFBzV2Q3YUnXyQPG9q1xQjFKdf/bsZFoFsT81HrIIjBqlPmbh67c5qjepj9pVoqFtCIiH3uK+c+m+OMRfRsyaHPCl+h15Sd41S4YjmGQUnGa8xOlLUxgXR+mi5afZIauYpQLnEErxPD2stVTG4Dt7pqyMJu0B3IgdRefw6oZiKhoqfZrFsFMXX++HZw2VWExdr9RCcFtQdxp4hFWUDeLBZMuNnKFTS0tEvsnkr51LTUAhlLYpK2fG+tEvEGcrT83aEz1XAKUpGyuJbCAvIkpXBg4UcK74amEZsMdclWJQr29YovgSB0u6X3L9g1XeIfUaF2GvpVwm9Vr1cRlQKRClOTqM1xbgrsUReDP/atXMnwqCmt/9zzkNVdQwYxMrTJDHChVCxi0QMNU8sFPdtjx7H2ABTjbjFCdNE3f1Qh3o/PjZ4/Wh+JycIRi3l5AcAqCSlaIreD4CzmdKmKGH7D5YJDyE3QD97K3fy7LRo/O9Hkw99N64mN9OVi9bkuqIOoYe36j/mUXb1ip8i/wPLWOS9RAbhpsimJE9Tw4Ve8kONgeUmhkgQtkD8Md7VfwgrSUqWgTp+aWpJcSkfr9AxYm2G8HIUpJcQVlF8vi0dq4vN4KdKDfRHG96XCfiTGYYMPq6LEW3JSWPTswv3zA+0HVGrDZpITl+E6nzYZuH2YRb8g7+cm3uEj+85KpKgtCvI5X+nfD/rsB9qqQBTEeQDmJoAxGTilSidd51LQKYNpAP4fpqM/7VQnU2O6h1iWZsw0LukwiK7MsXlz8JKjD04fU270efSA2Ipdgkx+CfW+HgeivHuAjzQSRnepmrzybqd8EfTAsVW8XaFbMvhSfnyvo8vqEkS+Zz22t8icpImLxMwFYFjlOsMAighN/E1OltJz4KaDVkSawD9W9somEnFGsVDibk3dGQoTAWlmrxNIj47QBMcbHKpegdP/ZLc4OMnfa+4dz4FUnUxwIzE/MzgUCCIGayuTYRySho/11arIKSpfVnGtFonZxyYWuw8ppAPwduvnrSL5uDrCiP5zTCESEkFuj5ENVRlwl71kiWfFLWLNZPxW9s2gVTrHM7U/rAHsjIv3alAId2WzCSAlpFUyUl4kZyKxl/WQr6mwX2p7nkRW3zBABJuYyPdIcJDtN8J08A5x3a7B0X1YDHH/kZmkasRyunzUo X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92b0b1c0-ef84-4c8d-2cc5-08dbf01d6a4a X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:22:13.3122 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6lX9++RciiX7PKGm9eXPp0tdseWxqHYQCe88RzYMJ0B9Ul6QFR8U2h7qHpjwm2OFj8uEW6lkICNg/p8HCNuOAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7001 This patch uses pm_nl_get_pernet_from_msk() to get the pernet id_bitmap instead of using a local bitmap when appending a new local address into the userspace PM local address list. Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index efecbe3cf415..b3a606a5e182 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -28,7 +28,7 @@ void mptcp_free_local_addr_list(struct mptcp_sock *msk) static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, struct mptcp_pm_addr_entry *entry) { - DECLARE_BITMAP(id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); + struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); struct mptcp_pm_addr_entry *match = NULL; struct sock *sk = (struct sock *)msk; struct mptcp_pm_addr_entry *e; @@ -36,8 +36,6 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, bool id_match = false; int ret = -EINVAL; - bitmap_zero(id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); - spin_lock_bh(&msk->pm.lock); list_for_each_entry(e, &msk->pm.userspace_pm_local_addr_list, list) { addr_match = mptcp_addresses_equal(&e->addr, &entry->addr, true); @@ -50,7 +48,6 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, } else if (addr_match || id_match) { break; } - __set_bit(e->addr.id, id_bitmap); } if (!match && !addr_match && !id_match) { @@ -65,9 +62,10 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, *e = *entry; if (!e->addr.id) - e->addr.id = find_next_zero_bit(id_bitmap, + e->addr.id = find_next_zero_bit(pernet->id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1, 1); + __set_bit(e->addr.id, pernet->id_bitmap); list_add_tail_rcu(&e->list, &msk->pm.userspace_pm_local_addr_list); msk->pm.local_addr_used++; ret = e->addr.id; From patchwork Tue Nov 28 14:21:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471236 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2055.outbound.protection.outlook.com [40.107.241.55]) (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 8C5B835888 for ; Tue, 28 Nov 2023 14:22:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="jSFiaYWp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bcu3PDb8N89bDo187BW5qrk+GrF7YGqjz4WlDqslLloGuf+3GTEOehuAO8JX+gxsQ+RxWSK4WdrXOpKanWhLhhDtvsy5c+UHS6jIcP1uRcrloUR9a9VX9UMJgTyA6pk5Q5HTHIrc5+iO185wkbhhoE/DdcOO3mawLNVPJqgvDEJ0JjgOTaPQvL/eackG7DiUBSQsiyFFG2OQhKEaZbZYv0or609Go/Nf5tiG+EPYmmPNNn8k+HCv/5xkkSlf4irBM4+acbEeMw/cF01C8+ua9tClbyTJ3/iJR3HvjO7oB3B2rw+jnJF2zWptKTAw8Gl2wlTYl9fC6/0gxV/rDNEuiQ== 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=QFu5NR5fYWXwtw4Q2nfrmDukq9pre3TiGE1SzTkbt14=; b=RvTnmzZ3a2HJP/ObgoWfowUG7Hh8OnxXWB4orOxNUAWBEgR7EXy06SfqUIOqBX9MIRm6Z8yZKKU16v6dW8EflR/BheuZOWY0L2LHhhaLqZRLPxWrkVYIY1qruHSuDuagSGI15R9IttcKGu5pAtLFfl+X7kDoaspaQyyVhZ2+7u0PExNq0R6avhaZKr5Z4LUpEjzCMPz86KGE3g7MTo3/ENTDR7teTKoW2UOL1io8LW9LcFR6TyH1E7/4VAeLuW8qHGmmfQRMjn0Rt/E+NuiOHicsC1CDBFbF4PWZ4WH1X9ow9MJ5F2DHpL8jGuSwy+w7mQkDQ4EgMfQBX0B6arrN3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QFu5NR5fYWXwtw4Q2nfrmDukq9pre3TiGE1SzTkbt14=; b=jSFiaYWpPB8fG3GRKB+E16ojkGjCihqBNAEFNQ10mxpG/xZ75Y5EfgMl3lBQSR69Twm5ZQpTonqtC5CpVSkQTtwEvqv/B6r0Fl3s+IHuyf3V6X2qU3zD9SR9GJ87+1o1vCRSyR9FI94Q0ww7myS+P9VRpa0J7jb7JaDWGqqBGzh5zZSyU5sn7vjCB0mmI8MCnf9Gx7EtoNfS1bDVsrHUUnHiPYXsqIJexh41XxWhJBWydJVKlFWKsoSIqSD+8dx+I7PGvKVKK4l4wxpBVcFpzk4nKI67YK59b1VDAdOOL0TWyaXfEdLtw/wxg/qYOqQ+6sNW8Qd92S/aCW05HGDWzg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by DB8PR04MB7001.eurprd04.prod.outlook.com (2603:10a6:10:11f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:22:19 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:22:19 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 04/32] mptcp: add userspace_pm_lookup_addr_by_id helper Date: Tue, 28 Nov 2023 22:21:57 +0800 Message-Id: <8113515cf4afa6ab23296f05bcae27abaf6a4a73.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2PR04CA0176.apcprd04.prod.outlook.com (2603:1096:4:14::14) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|DB8PR04MB7001:EE_ X-MS-Office365-Filtering-Correlation-Id: fc577231-e9ce-4942-8353-08dbf01d6de4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YshPsx6JHZSvp8qxEx0xABPBq7aUON4aZoDKcEhCAcq+22h/kvC4CkOyKn7G+mlruNaOJsgrpv8PcR9MobojlkyHABLpdjUsZCrHNDQH72Aq+2Mcl6RbxECMVE3jFJtTpPu/tWr5xP5LpcrenWP++z/kDVT55H4eod/uFyumaNM3tPaf3xO8GqbNJNmnnIgfVRGtETIcZQ6vR1nt64aJ+eD0FQViTvxmhiI/26vdZEwWhLJALgRs8M7ikY7clQRElVCV97lpoTFDsqb8Mb3bhld+djxCz4j+Qsp60zTgFqfuyIZp4mgdLYz16ss2udKV1u6lXwCTC31aZR1bUw+CHkQ6LpdWEO1YJJoboffXzrxBks3DxvU4bMctHe1zmbiwspeuWTZAV0UfYLne6VC6ZHcQ81sDdP+lPqvszXi4dvloefJu7rLpVEP305D7dmVCxgLP/EFV6/vFNVibeTC/Gnq2QKVCOKgcFe91f7tIOF8mGsx71Xfz3PDK6k6Fmu02jUA1nAsgopYCQBg9Ta4rJVyLl4eAaV7eqrSRKQ0LKjYSdikk37bAigAcWKVfKbiT X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(136003)(396003)(39860400002)(376002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(36756003)(5660300002)(86362001)(26005)(6666004)(6512007)(83380400001)(107886003)(2616005)(6506007)(38100700002)(478600001)(6486002)(44832011)(66946007)(66476007)(4326008)(8676002)(8936002)(6916009)(316002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hbY8+TVnJcjT+S3SSMP2cSic8+UdCm41fwzdSXvnqwrtV+j9YCgiODedvX2RqEtIXENIwiT2eX3r1QzqHvdNueovjaNsHJqiTLSOA6YpybVxXD3AucG7CFoZtmLUPggKdDOQRL1PONXliH1tSxoeFSREQw0RNBZHRsgtRqrb77RhxzvwfCi2zdwDDVQTdO5n4r3iKUoHhcFVx7WYkPv9x0zWXytEkuS3YebtjFLfXFBfJGTLbqWFMjucfhUpyvSRAA8ckG1NM40FHYIV51COLHfmZUOYiSZ97wCMT5C91q8IXXZEoUPwI1o3ZcPzGbA5QvcE3c04jUHMtnUdGI3zYIWci7vkXrI8SWihGjbeTb/Xr7oWrtfawa2+P2zp6Ht7Kr90f2l3eCNF/yxiRh5UjEca6a1rH5NitsAgjeGD3lOvN8KPXa2KJpw+gl6LPsdU88l9LXu460lEKoA0fned5E2I7PnM1Vi9VoQS7OgG8mDs8fpYw/JtQk/obhmpXvvmlj/8lUDLCQYPbDYreNsUDpjqZxc6Xp5OHEjwszxkw3Mb4ALpviyLcfAeAhXmmHol4PwSrdjzzTBpslR803L21PuIH7NOaZdVv8GVLVzKjw0SBpqsG74hEu1jzaNdgqoAwMdlGZyfPQdk87NdOicDwYK7wP66+5c8GggfVRQ5abX5uk2ASWZjzR5wEnHNHwMKrmNtpfrf+BtxeCiSR0bC6Z0//M76IyHh4FMwFqTXGmJm/lWbF0wDdFfHEGpIqA+C6sAnQDvYxS66ccYUM7CMvACKNBXmLWSi1ztFkPXVD5QerOfOWAtaLzLECgWMcT80jWMaA9Jp1+L6VR/r7o6G4CcHoUswdvhOIuYA5TLELmCS+kCEotbP4tLDm3TVKV22v5ex4n9qlgOnlmPq5HBQJmhRKyEcUXLNu57Kvunu/sktwDrR1MwHg80e06HfhAkK8gYLLgikUsF7Euv8R8Vz3lvOfNoSk7st1OcWtf9PeXZyVN0MbZS5n9MCPMbzagw6jR7ZqIzBxO6P/4Yz2D7rtNleAxTJkBS/DN62+rb1OB/C13cRrMqLcEPWDBmymQQ69k1oxhIkz2mRPIHhomZg2hmPxebaA/m9PayyQH8OnOL6LlH/S+88XLJ2qbriYNbrYmdDneD2nIEe+Vr9vs+a7+R4GoncSlOC62uEyLO6t337C95AUIgQj3k3vpiJSCGNj8jP/F9SdbHbVbiOVRAS4zGT/EUdRseMDQhlw5h+UFz4dWCC/3eMOX1E7vO8S4Cc8UTrfj0t/LqHEiwHprHYQ333qt7skcq7qj5R1WXJ6UhRPs28Np2u15ZC8PNSz20nea5LDQkcghzcj9AvbHgFe5AULnvtTUqSgWREVvgot66ZEtpP56zLfHqSg5212EdIK07FlDCRB63XNs0J2y34l4AmPi07V6vY78JADHMznnn5KHydqUDl2DOlf/DE/e/rqP7ALMh7VYbnFnTxH7Vd9hOWKdcD/fmCeApBSY1Td77DgQNXg2+8MlOzGmyMLgktE9CYwgxw5jHlk8zZY4UnduUrfOYdB2yES1cOmDTiHGi99UaL9+Ggm6NVnkU2EIlR X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc577231-e9ce-4942-8353-08dbf01d6de4 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:22:19.2998 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ywi5pGfDe39sA4FBrH8nPr25oKckMKG0zdCryIUbNsOEI6Yf6qnDUXZj5FR1YKWHzY2Rvb1SjQy91vYaQBQprA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7001 Corresponding __lookup_addr_by_id() helper in the in-kernel netlink PM, this patch adds a new helper mptcp_userspace_pm_lookup_addr_by_id() to lookup the address entry with the given id on the userspace pm local address list. Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index b3a606a5e182..6999296cd5db 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -25,6 +25,18 @@ void mptcp_free_local_addr_list(struct mptcp_sock *msk) } } +static struct mptcp_pm_addr_entry * +mptcp_userspace_pm_lookup_addr_by_id(struct mptcp_sock *msk, unsigned int id) +{ + struct mptcp_pm_addr_entry *entry; + + list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { + if (entry->addr.id == id) + return entry; + } + return NULL; +} + static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, struct mptcp_pm_addr_entry *entry) { @@ -107,15 +119,10 @@ int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id, u8 *flags, int *ifindex) { - struct mptcp_pm_addr_entry *entry, *match = NULL; + struct mptcp_pm_addr_entry *match; spin_lock_bh(&msk->pm.lock); - list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { - if (id == entry->addr.id) { - match = entry; - break; - } - } + match = mptcp_userspace_pm_lookup_addr_by_id(msk, id); spin_unlock_bh(&msk->pm.lock); if (match) { *flags = match->flags; @@ -247,7 +254,7 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) { struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN]; struct nlattr *id = info->attrs[MPTCP_PM_ATTR_LOC_ID]; - struct mptcp_pm_addr_entry *match = NULL; + struct mptcp_pm_addr_entry *match; struct mptcp_pm_addr_entry *entry; struct mptcp_sock *msk; LIST_HEAD(free_list); @@ -284,13 +291,7 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) lock_sock(sk); - list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { - if (entry->addr.id == id_val) { - match = entry; - break; - } - } - + match = mptcp_userspace_pm_lookup_addr_by_id(msk, id_val); if (!match) { GENL_SET_ERR_MSG(info, "address with specified id not found"); release_sock(sk); From patchwork Tue Nov 28 14:21:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471239 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2063.outbound.protection.outlook.com [40.107.22.63]) (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 716BF35888 for ; Tue, 28 Nov 2023 14:22:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="uSsaf4ZW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LwExRkraPzpXcFIB3XCsZqmSQ26GUaBsmqMbSZXMHRXPSK4KmSYteA+a//iju2cxZx2UQM4eE+q+8j8oNiEDa8KrTqwr2C42m0KiEyo0gUl7B4jOe0NRFxi0MwLkvYaNBmMLow/EPQIbYn9RTwC/tBqq798zPKiMRAaCEd5BMz2ejvqDCc1qP0a1UQHinOwwDSIdg80rJ9gssZEREgq4BzfuaAaQoidG1SUoYQchpdANA+UuXFM9Al1zvIH279woTNPIoz8OUWAmTy8ATf/pjvJJe6W1OgBhAi53HrQ3737PGrwdoM5w2zgbsvripxO+gw4DWkRPGjDZtWTfUpJwHw== 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=pdLYbK7vXnu1Q5Sj+OUn839s8mJ1ffI2svEYGzcGgdM=; b=ghnuEcssMkT0reYwTHcuW+/XM3WxCcHAe0E7OQf1csxkwFinXUkzJ0A8j1khwW6BjFOoC0q2HYqHsLDh6lFmYVz/O6G7YGjAhi0sZkuif21nQ0EHEvfvTbXCt+IkXxqKNO6Ez8n3/WkQxsDxkoN2LRAjz42fKszzmJVqH9nac0xU8LiRcn7QgsqhHoAee5KSgtNPRGrjmDlCt+/uYNIgaS9JqC7a9rb157YYlxubXGN5XY1WYQhGupGAGl+AIRPjL5Rk9Z8uKA6ZEurjnzOleBRBgDEvw++RNCnZgMet6PL8Wgz/ySD76f9S2Hjihl74R5OB0kJa3DYvyPaYibulSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pdLYbK7vXnu1Q5Sj+OUn839s8mJ1ffI2svEYGzcGgdM=; b=uSsaf4ZWrEw//GE+Wtk3YuD7ZGt5N4XTBGzC1A29CQOzCn8sGrpDeZcKDjSue/6xaSvEcaYmyfjUU1e2Qlf9WXKcWUMY/EjcrR5TkS9fqawYRsq00MYp8BSAmCbqPwrcG6OfTtk+ZKxp8llHUT2tLi6+uGbjhCGuNSTfrOUi9De1NMRVJR4b5wdByE/CZaEkWAtJSxF/a2oWx8zBPtrBcha3fLVZVozmJsTST00z3JlZ6iB/zum9vRI6N75WkXq7r12IZ+LQNc8iAERXqxEEc/OEbO8RtcWeRRYN1MECebvrj+FgUeuGqzhYQOT34xIJ8MJjG+BEfNrXGe2PHy+fXg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by DB8PR04MB7001.eurprd04.prod.outlook.com (2603:10a6:10:11f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:22:25 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:22:25 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 05/32] mptcp: drop lookup_by_id parameter in lookup_addr Date: Tue, 28 Nov 2023 22:21:58 +0800 Message-Id: <9bfe393c72733c5a13ffc52163435196ac2c81d5.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2PR04CA0178.apcprd04.prod.outlook.com (2603:1096:4:14::16) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|DB8PR04MB7001:EE_ X-MS-Office365-Filtering-Correlation-Id: 0fd9e108-7d5c-471b-41b3-08dbf01d719b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3X23ZGx+afqMDtwIKfqMX6Bn3WuYXnerT4Yq6Z+OS4HMNiIeW4gLWgsZGUJedHCGdyEBJTAsy8qS1crnr9Xo8ABXmuAwv0S01qU5Jd3JKbFy5dy5GlIytk0ZmjcoHVMQ4SbwCp8T8aL4n4JyOMUgDhhPclSAK0cR7dzIlgUc5mwXSv5SK37zoUsMiJr1pI2QfqP3QovF3cFfSFCvw0npPO9yMFexxTHrVbTByy6xgbJLEltyKyGPGgeyzTtq5DJbkDSUXVn36qoACBrU+J2LmayatDNszjBJv6zxgNaR5VwbuGCZzcS54m8KAeGZyfnBrXFKnKLwWvl5lCOFljBuFwCoOTyjPR0G6JQoPwd1i4X4A6AgndRcRcbpHDV6pYQ1uay8VbmtaEwktaBL+l7b1FJM46kLlO5PyIbbD7ybprJt4DWb0RPGpDCU7qYPpjqJKQVJsEM0PsJWfn6S6ixSG4DMgbDCrUn+cvhngNwn6z23/g7AHcHmBVDft1B0wBYKPDJshyPg8ysgI6rKfT9yBSQQIWDIycPEfhTRDNltnADG1O/082k0+Nl+IhtlNLYQ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(136003)(396003)(39860400002)(376002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(36756003)(5660300002)(86362001)(26005)(6666004)(6512007)(83380400001)(107886003)(2616005)(6506007)(38100700002)(478600001)(6486002)(44832011)(66946007)(66476007)(4326008)(8676002)(8936002)(6916009)(316002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iz876a6fb/y5UojWweqRJQ2IQT+L9xpqaGn3W49aGfGyLPJ/U5ftEdL4Lnh6qW6V5dVoDSwbKQDsn/IOpTS+ahqnZF5lX4oCsxCJbPoamnIaV6V5bECtXoUwJJEGYJX+eEfws4FPRsYOQ7dTvFtKfPa+lMNyueqm3xgSc5DTh42u6WDujrixU2cw9wVY76h+Ja5RvLYsS7/54CFjzCf0XmTzDcUkvDs6yz+H0/lszFZCDYb08Ovlx1FyXzF9KBLHjTyTV8goZzU7MJwl5ACbNXgwoDt/G3qpoXOvl7AYHM2W04R1kbzDUZw0q3pZF3imKHSUC3zIEA607bKJJNmXcxJukATLRc3mLf1lEl6VY6BBh7yB4yzrDUMGRE85kyVQmWnKIhSC+clVLGb7bLQBSPqp01frCIw2TTt7kHjpTrheFktzMBS1PSDlrGVNrtG0tCoC7ShMCDTErm6QyaMs1Y44W3lHzXgWP5x6ZmUIgZ4jmsiZibtsSxTefOUqd0761C2tJH6LqyKAbLqcf19IZg07pbKWBmqVObyEljAOXSn9xEKf0MSp18Dhms+c5YoZVzCVfwFaV4wjD8jGxAOfY2PSEL2aflkadrQbBXaHL3c69HSVYc5PLZJGNI+8qeKzsQVCSrmCXhhWndM6Ltu0eJwClnf9YtJCYKVazDlqWx8ZXHqJPhLYi/zDYfKRoM+wBZklRkjOI9uhDJAxHNd5g3IxNZhcmppwFSbDZJUL6FIaDoBXgdttBE24Q+hGsgrTJyzkYgozAMd8y6aF79I7rtl715tojREF9GuBgubSt7HvexGYtRyR9yoPV1oLo2vdYm6mWpXa6xMjsZfkejg1wa6gG6lHDIxHr80sushIarayVTZLCEQpR3rjSA9IHhBVM9ajwuD/rZ6XuX9yrBTPbdz/wkkekYjjAtljktQ1gGXppwtNTP5073inDX8JImWvCAQNMJWAoFfR03Qcttsp+7xWmPSeMgN6qB1IYSdmLVNTyPa9NSelAfB9cE+qaOMszHlwEmxu6DF8zmPX1hKByfVAuRfReXNU783oZ0Ei7MC/E4fvHqrzD+yxg+YlxH2AHqnefyVJBpShAratFEuDjkNorAUsirCUDBeGTz3B7+ypaHIhrrsUENiolbBGxtuYwAG4zNlOXci8xrpXCcSeik7sqwKDTe/cQu6eXwbiqemJblN8eIgcbbDAvLeKCuL/rJtuvazxAPiT4UYlV9qzcaX3R23CtEy4tjxZMYTGPDQbG2/RW4cri6cKJKanbQuzubFsDOi9Q2semW9TgitTQt9r1R2aIm5P3LR05n8B4WAtH/vYMEJGw4WeYnCdXyrzbkI/JXGZcDhga+vhJU9mWbmWsPEpDu70CUt6EoFUOvgAXIkVjYEa1Z5vreiMXId6qrrb3zM3RPgDipSbUzlmBWf5X4BkREK4boNnvf5I/LglZISP/JzaMcciwS7pk8TFBOgsGPzPkglGCbTbC9WbqSNCSLyGPcA9WNmsBJzbxL+/CAjiE453XbtkJ8ZQHqsoIA5Bq2OFNktuprV+67za2mPqW+BOxi/6mjidBjqrf9Jp8jlfrWgB4rE3dzVLkZnG X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0fd9e108-7d5c-471b-41b3-08dbf01d719b X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:22:25.5559 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: d9rXUxqxSiE4qlczf16laXexziS8HYeNwTR6dN4nWHu16M4APC43Gzy2tH1W2JRPyhuZIfyLywEhLy8JBf519w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7001 When the lookup_by_id parameter of __lookup_addr() is true, it's the same as __lookup_addr_by_id(), it can be replaced by __lookup_addr_by_id() directly. So drop this parameter, let __lookup_addr() only looks up address on the local address list by comparing addresses in it, not address ids. Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index dbf040e39af4..4cb52df57ba5 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -458,15 +458,12 @@ __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id) } static struct mptcp_pm_addr_entry * -__lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info, - bool lookup_by_id) +__lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info) { struct mptcp_pm_addr_entry *entry; list_for_each_entry(entry, &pernet->local_addr_list, list) { - if ((!lookup_by_id && - mptcp_addresses_equal(&entry->addr, info, entry->addr.port)) || - (lookup_by_id && entry->addr.id == info->id)) + if (mptcp_addresses_equal(&entry->addr, info, entry->addr.port)) return entry; } return NULL; @@ -496,7 +493,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) mptcp_local_address((struct sock_common *)msk->first, &mpc_addr); rcu_read_lock(); - entry = __lookup_addr(pernet, &mpc_addr, false); + entry = __lookup_addr(pernet, &mpc_addr); if (entry) { __clear_bit(entry->addr.id, msk->pm.id_avail_bitmap); msk->mpc_endpoint_id = entry->addr.id; @@ -1832,7 +1829,8 @@ int mptcp_pm_nl_set_flags(struct net *net, struct mptcp_pm_addr_entry *addr, u8 } spin_lock_bh(&pernet->lock); - entry = __lookup_addr(pernet, &addr->addr, lookup_by_id); + entry = lookup_by_id ? __lookup_addr_by_id(pernet, addr->addr.id) : + __lookup_addr(pernet, &addr->addr); if (!entry) { spin_unlock_bh(&pernet->lock); return -EINVAL; From patchwork Tue Nov 28 14:21:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471240 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2081.outbound.protection.outlook.com [40.107.22.81]) (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 85C0835888 for ; Tue, 28 Nov 2023 14:22:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="JhVq2G4m" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l7o3gGp4zhLovjEplRLqnJcWkhh4atW7TQV3cqiPCXCM+zbm/TrI4J388j7U1WWOA6lkSCgTJshxMvUHXFVz/0toqQXCnySxK6kUVh/tlVBAY9Acx8Y4TLFq2XYrweGWqujdQ/CCVm9WmgZeatip3aRP3NXS2EsVzxXApvA5Hns43l587ofH0aN+lPDgw0ilDSvn+3qmQFTm1giIZPezLxj6zcyprrgcKh9XqyWzvm27fQLWyKsex9tgXf+hbK1RvNf0EAixxM4/iepb63z2oirTh+8BtPrPcZX/mKdVmci7lOwkeUhpS4vpJqOU6bWVzPHs7Xij9BqszJXI5Mq9qw== 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=9I9BhsUgHu9NIyvVUommWpfzUKT8CPGIVlfQ/Lgp1ME=; b=fuStmismz4dr6BAoDL0eQQvqW2eW+J/900no9jPdrF1bIAjhaYB53embYjZcjOLogTP4gePmMGa+Nq5+Yux8RiOyqB1bZ+JED1MzalEIQMninVQLaGbOm8l/qFAk2j18XYiU5b3pe9oU4jfaMt47IGA+rxJVU4Wkm/AUZ2SsmXH1EG7JCGu0nNa7JOUDJatg4JmRuSImO0u9byyCVfKw/cVRxIuzEwzQhF+6XofKUM+3CSLzIuagKOTLwSiV22dmEU9mGCGJJwy0WW5E9s+jJ/XdzHbfaOh46YR6oKMjajm4TSJZZ6ltjlrGHt4SLaYmrcp0Id4qIGULu3jy1epgbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9I9BhsUgHu9NIyvVUommWpfzUKT8CPGIVlfQ/Lgp1ME=; b=JhVq2G4mD+7CsVUe0gm7dnFjMnDJJkTIJJyaAmwnmJ7DsgPrAALUQ+7PXkgzAsTdYgVGim5fYz/9azevBBrJw+wTuvl648K4rX0HPl5UH4OCIGQYJc0W1u7EwIa/FPg/zWuaOUN4Wv6fGJv4gh+FMGRmsLx13tVUFoLyynXZVDP60LbkDgw9wXp+KClJP9n4KH64IwQ1xwGTzLRV5dxFe8GgsDQhTXGx+N9PBXQ9h7gpzlnv74eUMr5efPp8jDH7jn5HWHH+vAE63Hnr2PeDzDg7GRF+7cl5yjDj/a6PP5d3+4rwxqsiY+CuC33WGE36zCF3wU9NdHHU+fgE2VU/Iw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by DB8PR04MB7001.eurprd04.prod.outlook.com (2603:10a6:10:11f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:22:32 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:22:32 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 06/32] mptcp: dump addrs in userspace pm list Date: Tue, 28 Nov 2023 22:21:59 +0800 Message-Id: <781c84bd56315a08ca30027b5522959a66b5777b.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2PR04CA0190.apcprd04.prod.outlook.com (2603:1096:4:14::28) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|DB8PR04MB7001:EE_ X-MS-Office365-Filtering-Correlation-Id: 1474aee3-6e54-487a-5633-08dbf01d7583 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B82kkVzZhc4nHC0eoyWEMl2AKq71sFfsE/rrc8C/pe9FUSAegtQ9Sp7tOMlmNvFRgSR9LZGCL3SUAnvklZkM4pwm0apHULO0d3UEGioJQSf3PpAEAG982JGBOC7Y34FQYjAlj14kySZYWJt6fHON2V2Cp40CRllTHPQQL7bQlRIMhTJ09eTrjXdAqTaXOGkwhPCyZtiomy93slWuxO2QZHWCSOdvS/otjWJgviHQIIYgN7N9GsFva7mBSUPkudPHwKMiu09/PkGNwXxbABdcknC8cayownZYydNqjgyqiAk58rlXHU8BA9hzUESyaqhOhMF+AntLRcUKdzYV7ics1msk6YRP5kPB19KYTW/BS7SJu/dLw9TwME8zYhtrNsWkM3xvuAuyukiCN20JELLCvpdx50mWwhLrOPmLzBGQfOz7JnlXEdK/KLt4UEaFB63n6q6MKAxx/RWzpx+Y5HklZcipkDFPZzumSciOJnYTO7WwnQElHVNcM0wQi0syy3FsrdMqADq/A7K87FvIXFYKosbdYbnjWelbxq/yIVIzZd0tYVuQDAUEozezs0HoZQ/z X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(136003)(396003)(39860400002)(376002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(36756003)(5660300002)(86362001)(26005)(6666004)(6512007)(83380400001)(107886003)(2616005)(6506007)(38100700002)(478600001)(6486002)(44832011)(66946007)(66476007)(4326008)(8676002)(8936002)(6916009)(316002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RyaHAunWfC+bPGWK/dAIuFU3Iis6W8TxnHIH7a7ea4PxdmC83JJsdCBRKx+MKAxcqrWnE9BPjdpKmn0Wy/OXYtvoAjm5WO0jesgjbbIw3WJFT2DnxH1Y1hWDMqknykGclb9Urmd20Ji/OWtmmmEbloDE5GCSfzHv4FPu+oNcL1bfHjc4sngp9nU3NMc+9BmCeWPjLnGCeJc4gjszlKw8lemdWrBpD/F1qEKwg0M8ointoT+11aVoMBok1jmGrwwWFgUGoDQZs6ZhPceQoF8z6/ue7n6dtHbn7L3QW0NyBoBob9EJ5vh6xXzkYes6hfN/mOMmFgTECkfa6VF3wKuZg6pafOppYMQrWkXgT7nZH8u0SAqKD+F9lRzs/vsFq4Qy99nEGdB6rTmCBWYAyPuEUHFDVGt2pl5Vns5ikIcnTYz7x50X+0Na3hgwZ7woV1WEMj0STTYZpeF1cQqCJregxQA0MZN7ZGCa196ynkL2ZIWu8kMAiVH2vUnPdnl+SLRJlkSSbXOJNe8gIwZbkH0xkmnkaMCExQDa7HyxB6QJ9yTUTaqf5YZI4ezYt2eg8JVTZYwd3L0UFbX3x4d/qskN09pN9TXloPx+7Xdet86bxAsuDJohiBZwTRQr8oYsza7oaRX8aTqHkZjsgTMVpaE38ixj9a1m19g6NKdsFXxlIbktAddINKNuIrrqG4mo+DNpiYKGTa4lbn3oiQIpeY7qXivZM5wAYKh8AOoObrzMuKBjt1VzAWr2UmXV4v73cowB5CPqsHmxNncodXziHp/+mHxrOg3MsyXY1A0cw11ZU5vhwYYKjNtc8R7z5GK0Hkzi78yoRIvWF2VyElueYMMOubqkeAE9Onor4Gn9JTTm/ChpZ1avzWB+AkevsjrcHrzs3+XKP79CKdS5sVFKA5aW4OaBjwaeaX7NvU/W2Jmg+qkPJVbRwTFO/bA7m+Bo2jVzukHw1mkQnEoKiqDLUlfbMszUVogwtQNQfWwqk6xWpaHcpFcfZbBEUUTPxY8tYmPBwA2noruRUUF7yiY8wXB9nMeYQ1z+dvO/niPLQLLrynFxd9ZAvU9ncn57cwe4iE9KCGAdXr68+iY6AsiCuxEg065uSnPtUVmYpGMkU3ud3qJjt934AQXExarIBIke+ZWgRNCRJEivyEwJCB8RBK9VlRTx2j0Hwyyssc+sDrbDAMrXEhrFhzesvvEH1eCZC1IMRcVbNt42/+Iu8gsMlQIYYjw3MYgzZPxGQiKZZ4DaLa3TB/NZucYyYvyAF2Y3/jZ7m7AGyUQNoUXeT6x94SXli2QXY2PPnUehXvBgcgZnwWOqAWgjDeQ8J3QH7xw8WShH7apKg88m/VehoIGNwoyP3Ea8xjnXL6pMHy93lqvGjQT768CrSwUm4+M9lUtUr0T6EXLXGi/uG9pDVrrB1rEa1KddihBiqbRzC5bR5asENeqpJ8NRvfYUJ2yEzVcsOpOxXnf1Om5DDKn8pQ5jVh2P1+3dE2689Iwb5c9EEDMgUL+F9qPjcNi8bsy4bBiGvjWu/zsklVacE87N4HWxeVm00Yd1zTlVr/h4Vyb6vsVwFsU6f/pS5tzHu0gU8Jo+eBM4 X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1474aee3-6e54-487a-5633-08dbf01d7583 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:22:32.1367 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 84zgmgPc5maIXSXWNa5TPpHYVHi35oylL+MOQTpsvJcPla8pxtff6Nj3yqzG1kWryR54jNp8jAMKIkZ0yAZDBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7001 This patch adds a new function __userspace_pm_lookup_addr_by_id() to lookup the address entry by the given id in the userspace local addresses list. Invoke it when dumping addresses from netlink commands. Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 9 +++++++-- net/mptcp/pm_userspace.c | 25 +++++++++++++++++++++++++ net/mptcp/protocol.h | 2 ++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 4cb52df57ba5..08b4211fbcbd 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1673,8 +1673,13 @@ int mptcp_pm_nl_get_addr_dumpit(struct sk_buff *msg, for (i = id; i < MPTCP_PM_MAX_ADDR_ID + 1; i++) { if (test_bit(i, pernet->id_bitmap)) { entry = __lookup_addr_by_id(pernet, i); - if (!entry) - break; + if (!entry) { + spin_unlock_bh(&pernet->lock); + entry = __userspace_pm_lookup_addr_by_id(net, i); + spin_lock_bh(&pernet->lock); + if (!entry) + break; + } if (entry->addr.id <= id) continue; diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 6999296cd5db..5e45e36ce1d3 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -549,3 +549,28 @@ int mptcp_userspace_pm_set_flags(struct net *net, struct nlattr *token, sock_put(sk); return ret; } + +struct mptcp_pm_addr_entry * +__userspace_pm_lookup_addr_by_id(struct net *net, unsigned int id) +{ + struct mptcp_pm_addr_entry *entry = NULL; + long s_slot = 0, s_num = 0; + struct mptcp_sock *msk; + + while ((msk = mptcp_token_iter_next(net, &s_slot, &s_num)) != NULL) { + struct sock *sk = (struct sock *)msk; + + if (mptcp_pm_is_userspace(msk)) { + lock_sock(sk); + spin_lock_bh(&msk->pm.lock); + entry = mptcp_userspace_pm_lookup_addr_by_id(msk, id); + spin_unlock_bh(&msk->pm.lock); + release_sock(sk); + } + + sock_put(sk); + cond_resched(); + } + + return entry; +} diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 88f5b422f941..c30e59278080 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1021,6 +1021,8 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining, int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc); int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc); int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc); +struct mptcp_pm_addr_entry * +__userspace_pm_lookup_addr_by_id(struct net *net, unsigned int id); void __init mptcp_pm_nl_init(void); void mptcp_pm_nl_work(struct mptcp_sock *msk); From patchwork Tue Nov 28 14:22:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471241 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2052.outbound.protection.outlook.com [40.107.241.52]) (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 18CDF5ABB6 for ; Tue, 28 Nov 2023 14:22:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="QAPriX+b" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S+HwBX55GjSsz5RZJ8jt9DrWVqOI6e4GyP6EBHLzzrh21s3Hzkrt6bLtPcNgCu/MJ4kG9qblZf8HzU+E92WOVwOLb8Y/rm8xnh5Rnd4ssX9cMkSDYvH+JRUM5YhBKh+viGXeCIqty+r6PC1Uw4tuUKcxtavv/r+X+nW2vtXQHEgN2rg0gU/heSL3PB05DAU6oh0bavLAoY9WiebvBU3Ibk8WcP81pcRgI1LRsVxoA9FCMh9OWDFdxzOg4WmV/RsigzRH3ondu95w8SDZaAfxxOzvL1aVtAeBjcxWuuVrV866oUNUzySkfKnQkKNjWUfFyOFK9tteSp+GD0wB4vrg6w== 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=dph7slE2gv8EAzbuXoW1AIj1s2dm2ND+F4+zezBtKwE=; b=PMUKRCWk5XZrVEy2gEZpcrHwcTshTWTijAlTQavi3AEShWyBbM/gcNGa702O7F52z8sr3uX5ZDXmuDEh/6qQhyG6hfcc+TVPbzvV8a3eph5je7EbeGSR7BhCUTIgVO/ahWCQZjs1X4FopKmA8+jyq9pr/V8NdjoL1NCt8L7iKdPjBmjAlfHGysakyeGcbx8P/khfpu3xWfkVBk0CE9AHVddEgYxdQ9eXVAPscYlb8sE9qpcW8E62EsLPQBpADrR2wt0fJuM9mrv6pylOVI9AZTUmFgLA5/CZ7UHR1aU5pAijOVBrnAI5mkObKoE9uKKRy1bUFq08wWNP/Fq4ZVzivw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dph7slE2gv8EAzbuXoW1AIj1s2dm2ND+F4+zezBtKwE=; b=QAPriX+bYzETXYlt5jdk1tVH4crDtg0QL3UC00Y8RRJoYYV+UU5KAyptyF5Qm8m4ByyUvL8OiAOhaB7lZFSWSwmF5fBpQ3VCyL7178DNzWblAwBw9RvKcvgeWw+sgts2PKN6JT1VEHb7s5+GJOmv8q+6IcsCnhsW4xlZhDTxSo8dhHeKq7N97dNpmAQsK1xcM9Z3V6ZHGSq6mUd8IB8oJFbV25D2zWv22a9tcoSd/e7ZoCiBwn4/9jXOF6wMgmrTB4VR8PnYvTDwW6t5SSdxLUM6MOfikZ1onLAxjcL5I+5kxeLmIRO2AySFtgEMIV0FUwVsG8qezeuWPpgOB1Lx5w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by DB8PR04MB7001.eurprd04.prod.outlook.com (2603:10a6:10:11f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:22:38 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:22:38 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 07/32] mptcp: check userspace pm subflow flag Date: Tue, 28 Nov 2023 22:22:00 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2PR04CA0175.apcprd04.prod.outlook.com (2603:1096:4:14::13) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|DB8PR04MB7001:EE_ X-MS-Office365-Filtering-Correlation-Id: cc7bd06a-650c-4b1e-be62-08dbf01d792e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b5qdrdkcQ/26u0JORFOznFyZOI05gGphEtHc9ubMJi1NAM3J6VUBFjanVaKxOCgjdo6OY2iTZK5KXFYBSiqBsWmXbywmZhzKMseKhLiecef/j2kOja4yi18AUpezy4rtSqqMDa+PxTJBvRSBfnkHbTyk9jz3D0NhkbDb3w8LdxShg9vlnguDevIF7Tj22DsO5qvjv/d6+oOSWt85CZh6X3ORTFmHk7HD8WGHIYBSgc80LvQAeH3u6PJvdQgaY+qK+rIGVIisDxp9cAX7wq8TAIunWYKCuIzOvmuY0AaWLoKQPTQzBz6FGxtQ9wMBQ2DaUEVIcXg/N8Bnqbas25hI1ft+Cp/xBkIzLqUsEGLoMimQ0NeWUTSpKNE/JeoNIKZis/IJtvRYhhKe6OyqjCqidSzKTEG0OjLsKLn0BeZ3JNuhMjSKbacWSdOZPz1HbG/S7INL4eg/ljHX7FfZyabqQMiI8G4F8nUaLdTincxdJfYn500hOMhiOcMAOrOhckmCU4ssWTFb0/3EfJmjsISmKGYZvBs8t9330DoVcCPkSYbRX1TEQ9uUbln6yjNi4+59 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(136003)(396003)(39860400002)(376002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(36756003)(5660300002)(86362001)(26005)(6666004)(6512007)(83380400001)(107886003)(2616005)(6506007)(38100700002)(478600001)(6486002)(44832011)(66946007)(66476007)(4326008)(8676002)(8936002)(6916009)(316002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uxXV0KaaO3AxNhdHGlq8+ce9AQbl+HLrSxs+I9Nv3Cb5daoP32KaX6El2OMlvKqBK/3yf/aWgbZS5IWatGojNVF75d2xONaS30rRVpSBo0QG7tRhwWoLzBaLaZKRCIMW3NRHtKnDpz8+uZEy7ImsR34YFXEqKt0zHLkv6IHkBfAjjTABOSh06v5TEabJZ4ltw5cXR0DHZzsb3SOwFwaMGP8rU6Cfm6pTUs3mD2mw9G7Bu7xT6f9H4cbTDuvfn7GqomdnrLOCOd5upDTwsfL4Ne/9ndgXavoX9JQSiHXmoV+/Mx8zJ5ApLWHLFZS5A2zrENrGrdk7Jq8CpRRBx9GVZS6i48qrl5aLDGCKGoXaQ3pK3DFo/gtoz7p22GS8osv0N4A48AKN2Vh+BE/q6YXQkjJRnOtAcqTPZj5h5Yw6Dmi/Y4792Kh4vaBH+z0QNiAm5DogAUsjQawMx9TsshHV0Mjs9BMrRsTUzfnoQcCZQOv5sM41PzIcZEbJaUpusfGyiozq52O19sdrLFZ1bow9nouqbPP7992SmjiN0o8FIp78671xOSoqBW8uRK3GryK75jZL3nZ0KMNXBEycqlN1ypg9NBNr3kE2FGjh2ZxOrRkalS09hM29JCvyF0kCrvbBJTIdWt/v6kQbT6Zm42zvy2th5Z/kiczrXfB55INC+UAY32LniFzf59cY4mt72EpgS7g/QCQCOWSjZVPtlEpGbVK+dHl3D39xPvXBW8wSxw1bQhcVuBllivrbuvc+vGw8iWY/aIzqd/cqaqzNaaforj6hb6LN0eIrWqrrlfp6fvTxft4OnyU9mXmF5tX7514dLj3XcaEPaN+9dDqg695XPu0fXPrdFIUb6zNF/M88OrsyX0yHr4NGcPkaomZVPytSVQcWQmZjQ3AOtrjtEBpmhF03FLnxsxfs+Avzr+CX66d0c44Tmn3L3qYn7CFtuKW+BrxT9wq9E/tx4vVa5e4EQ7cmVSADJ8irOo0LFaeXq6gn/xRHtYBGjP4jd/nIZ7AkDAoPRbMr9nkRWgHi9t7vBxQavNyhWa9Ju5Ni1i9W78owKh3OkUGaj4L3fawrscfCpZlDZsm/0Eah1Bpg5AxUuPvrDK3mom2C0Oafn+gVZ7ChSGxUqFooz3QLpG3YjDh6/7BrnR/SaeT1I62xdCVEtRgFonCH/6SUH8hCjuLwkEwy4qsWLRprIWz2fuPheVo1dmxUf8+VgWcqiNT+nHE1F4Y28rtOiGYNFzQnbGC+H5AvYz1G0E0xJdKIqpBPUoAGOJ1FJFQ3zevzqbJIwEFbDird6TxXAK1bPLBQpgilG3Ie+pQcxtbmX0Zi46G+mOOaOeEWB2ZC9mPhr40Z4tPX79lEvtSABqlBaoZ2g0OOYMHexepfvFT8ZP2/pudWdPQ1BD70vsOTxDd4mnb/mKQ+kbE6RRLIsZ9XAbjDQ8QfrDk11c4HzGeZg4IcVH4dlBE6k9KYyEnu8VT4qiSQX3rwW7zpw83T9U9CDkGqhhxSiidmS07MJI7p1LH2wkbbGju6QBrMZac3BWRj0KKmiJpbWdphn8I2PYbYX8Ok8sunKOcFA0PbG1K2LKpmHWz7vwKa X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc7bd06a-650c-4b1e-be62-08dbf01d792e X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:22:38.2066 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ii/CTY82ZlkLGnSGNOanKYNfWdBXCpE4Fqc5BVWVEcXt19aBqla7xnVUl+SAHjQEyIYJa9KFZLF2r/d+57JXKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7001 This patch uses mptcp_pm_parse_entry() instead of mptcp_pm_parse_addr() to get the flags of the entry. Add MPTCP_PM_ADDR_FLAG_SUBFLOW flag check in mptcp_pm_nl_subflow_create_doit(). Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 5e45e36ce1d3..de10be21bf26 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -347,12 +347,19 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) goto create_err; } - err = mptcp_pm_parse_addr(laddr, info, &addr_l); + err = mptcp_pm_parse_entry(laddr, info, true, &local); if (err < 0) { NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr"); goto create_err; } + if (!(local.flags & MPTCP_PM_ADDR_FLAG_SUBFLOW)) { + GENL_SET_ERR_MSG(info, "invalid addr flags"); + err = -EINVAL; + goto create_err; + } + addr_l = local.addr; + err = mptcp_pm_parse_addr(raddr, info, &addr_r); if (err < 0) { NL_SET_ERR_MSG_ATTR(info->extack, raddr, "error parsing remote addr"); @@ -365,7 +372,6 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) goto create_err; } - local.addr = addr_l; err = mptcp_userspace_pm_append_new_local_addr(msk, &local); if (err < 0) { GENL_SET_ERR_MSG(info, "did not match address and id"); From patchwork Tue Nov 28 14:22:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471242 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2045.outbound.protection.outlook.com [40.107.22.45]) (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 464E735888 for ; Tue, 28 Nov 2023 14:22:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="dNhaC1WZ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aE0IlVLkeuFOm48/AsuK0534/x2uESbzQAuf50bmHzF82fjz9dbbfhwlIkMiton0x48cAG8fxKXcLl8B7gwaentkNlQias9TP02lrUkJwoK4sVY7g6iq3BmHpH5bWuQg7CIQygfAkdtul4rT7EkDe9rxMqQXr9JqKpax70/3848X9Pr0JUTNYof8ibNraars9mC97ssdr8cW+MD56aXWn8xlGf/q1YK7vmKktHw2ye9nbaRNOHAVVqCOy/E7TbVx5R3MoN9nJIZnZH6NQEoqCparIJwlo9iNHzgTVjFzHlp2CW5VoVCum3Ur0xBnXDum+vLxrwpb8G2CNtmwGc/z3Q== 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=bOp2TWhtoPPob1E5rhy13X9kUGO29azvPp9LWLnT+zM=; b=QlQ/QVoqhRIXdqokrriO91o1x3rkUsfogZNc9MOfGvfWeF4mpWfduY/N5SkSmk3zOdFmLTxzAHSlasUk0tUAON7OG5nOIVjoHz5ENxkKxxqr8JM6UgXDgpHb+f7gBD/xdox5bEXO1Hk8VVBHXNGgKvA19k145tlADX9tXHfg6VCwY8QWg3zopp+729MVWh5KRyeSkrDJqZb06G12vw4wT0N31lbLUScshnQ5gfwt4/llxRz4pGok2zQ7XbgY/cDIQLDyJ2Ei9gFgIBlYTyfI/T33A3wUW8GuXqT+aWxsenlI2KLcGY9un09Kde8Epgs8HIVCEwBlTsXYDn4cDYhHoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bOp2TWhtoPPob1E5rhy13X9kUGO29azvPp9LWLnT+zM=; b=dNhaC1WZwNHUS+5cWYTxNSr7vpFPUMgAU8BhGYViPg45JH1Qc/dmuPlrCT+Uw/x4KdP+7oyDX3UvkBYQwI6mNzRs72Kj2B7fMjZpjpsDBzIiyX0AFacQmhrcRNOjLXk5ei6WO+4947hwbduck8LrZyF/QenlA0ZfJQMPxz4Bqtxns3bofOQb57VZljD3bmTHtx+UKs0EkDiUiOOQlcXv6MsajhQ0pS06UfiLZu++f4pshPBVpf28oluuZ5GeD0EHzp5AXjAsMWvox+w4TXydg96VmNONQE8W8zq9HLIsmOG7ipTm1OsOxVaOeDMpGXtj7P7UltKpE3Sdba88XodYcA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by DB8PR04MB7001.eurprd04.prod.outlook.com (2603:10a6:10:11f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:22:45 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:22:45 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 08/32] selftests: mptcp: add userspace pm subflow flag Date: Tue, 28 Nov 2023 22:22:01 +0800 Message-Id: <771f20d661d95b6b2da50dacb2db03f14e74bf62.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: TYCP286CA0182.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:382::9) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|DB8PR04MB7001:EE_ X-MS-Office365-Filtering-Correlation-Id: ad0aaa64-b788-4af4-0f01-08dbf01d7d79 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5CxZQW99T08u2yCG2U73abT1B+e6Lk7oKVUWUPs0/4gT1gnBXy+Rn1AOvCRh8pk9HzDGRgKPSFvtSoCT61mON/MCzfjEHcmWOZxJ8OYDSUXwK6F0wAqR+Lpl4VgfDa+i2Lpz0odzqCT0r3Vcd8KdAvFki1hMtJGzWskxm28vGQwIDVobm6f9oqyihsvkW2tvGiJrQ/APDPYzAKQkLdeCBHSXmKJ4I8WUA/eHcZ3fhvx1XYY+qzGqlNH3+QYqSobRQ6C4o7Lalh86zgEh0c+P8Evj8X5RfJy4RW9cR599WgInPsrlUvhAsCazpMTtMfjayO8YFvkR9A0x+c4bl99wL5mtTfDWoNCCO2x0b6ssBIGUF+bnuCvQZo5ZiP22qQdRDDkGloHt4iEwjfg22auGOukqHVaI4pRysql1XVmhN5NElYxPHmv2lU2ziCsc0e+rhPA6eNKG3fXVFyIOcylt5oU78ZcnaajGMnO6pKlwV6h5cVGDGHd6w2erfcS+rTkXy8DfAguvWNnmZLMamOWjJ9QIY/Uf4XXzs2fDnUkxDjdmdUv97MFvrGG/9zOwhU/v X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(136003)(396003)(39860400002)(376002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(36756003)(5660300002)(86362001)(26005)(6666004)(6512007)(107886003)(2616005)(6506007)(38100700002)(478600001)(6486002)(44832011)(66946007)(66476007)(4326008)(8676002)(8936002)(6916009)(316002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DzNI9KX+jkijNMm+0MEeD1FGBFkKPhk9XaJeCTJd9ldFpQDidumPkop2B7kpfDIPhrmsrQj6illOds+auptAXizvfCvGPEuSiR0uIeAwA7myGKBhmV0KWfWxK7lUksZVvIC4YOT3wmHs2shlSR+5sCFczspsrHvLtSO4gUafRpTJB/5MSbIARylbnDArm0+n4WbbKeQgPeGlBhp1F6Mz9k5SlM81RH858gfCVgaR5GFSUOOoEBALJXfHhWGxvG0CA1bwjtNHyOU7yE4c6sowG55vaJeY7wgjmmqWur9jqFlnPWokUDZKgdknCUohWLxkSDrzAY1vmK5wGvwOWBsyJED6wMGqrtE8vHXoi6NB8Fx2qHARNNX4s6RnctHXSMXLk1KuL02ZNIOoGwAIB+XxQoEKrLIPig/somPI7VtvT0MKxtrjf0OeRxoHVNX88fET8rjmOlciHfP3d8RXggsBtFuPVkU+Exc0mnix+fkcTo3+PUaTtUUAB3vb1Lgx+Gz88rhOPp1Tx2Ww1HHWCuej7pFwQPo0bX7ZA28phJQ9E+411S3q8sWr+b/tJddIQ5mrscHGibex6tz6uGYexYwj72wGkyFNj9UqXtyK/OX8H1eKGS7usCJ/ROnDWWeEdfJfsijfOVfeKwIyfc0kx3KaHk/28Q1sYQkm2swS+yF5f5Aw8e9DX/cuxtIet+gBPUgrz77DequNBsMkD9JAfSgTSoPJ/uz2YyMosmrCnVTNsVCppXXz8Zt6d5KD83pZ3RkroKtplhAHuMVOixdELUSMalKhAN8zgBNQcFbZCReYw70Y5afg6Z4gGvkGs1duDOmwU6umi9/9AfsUqhCN3/ciRWD1j+gnEnuayKcra9OcMljxSC7+gF4XNNh7URCC1s0Pr+3e1RMaTzzhoLMb24wkxM3cMQBtRp3Kkkm0xgdJ2zBJCAYXaPlCEPxuz/s8AsbLwwACN0031GPKcLDfaCjEoJI3///96h8iA5pmzvtwJNz4S5xM85smjdeq2TX2E7gdETxwLTqtTl+9eSzo12NX/nM8IT38wD4YRsPw8G7+7+F/Tfsnep1Z/MokVFfLMl9ldIeXGMR9pV2NFtGDhC97AN8g53MJ18l+qqoE8/hhYRMyr3OA6V1yJIWj1pf7VR1f8yJeBpqcK+wFlznhJ8DVDlothcP1KkV23Kwl1p36yEpv7mMB3eUlVlv+5cU/Un4c3pUxGdX7pPXRvgYR2Avgljujv65hor9BvZRgIVyuMqtUuo6V9UstZfiR0LYRIdn/lAzjG6NZz6VPu0oEbsUmREoXpX56p8X86FGt8Wx9fiGZ22W+jzfyXC7+O3HJIJmi9RGxF+bFyGm0RD4eVS5Ft9yRZzmFR/aqmasGXb5TWp3ycKnrT0oVb5TkWeImgBzTdUPaWOmQSqXoQU473e3R148BKlSJOBDRpAdH6HoGRtAwnxPMcStMcdOTyg8YOQe0uStLkkBJcRXf9RIX3U6R6qFiU3wPDyWCC43XtkC92Ffy3KUONVyBhJnkP2fTgSdgbvZ9mNG5f0Q/77iX7Raoxgv7/eWMTR8asUG/9aZqCHGglyEua7Axe/bMRA3yUv4G X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad0aaa64-b788-4af4-0f01-08dbf01d7d79 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:22:45.5855 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CEOKlVLgPpSVEGd35my8yUEmCal9cU/7EuPjUezX/B4bCpv0l+WJ9I/O7P4FHwlMqlfWVIJw9c+SfC67MSjCuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7001 This patch adds the address flag MPTCP_PM_ADDR_FLAG_SUBFLOW in csf() in pm_nl_ctl.c when subflow is created by a userspace PM. Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c index 49369c4a5f26..e97856323ec3 100644 --- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c +++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c @@ -453,6 +453,7 @@ int csf(int fd, int pm_family, int argc, char *argv[]) char data[NLMSG_ALIGN(sizeof(struct nlmsghdr)) + NLMSG_ALIGN(sizeof(struct genlmsghdr)) + 1024]; + u_int32_t flags = MPTCP_PM_ADDR_FLAG_SUBFLOW; const char *params[5]; struct nlmsghdr *nh; struct rtattr *addr; @@ -558,6 +559,13 @@ int csf(int fd, int pm_family, int argc, char *argv[]) off += NLMSG_ALIGN(rta->rta_len); } + /* addr flags */ + rta = (void *)(data + off); + rta->rta_type = MPTCP_PM_ADDR_ATTR_FLAGS; + rta->rta_len = RTA_LENGTH(4); + memcpy(RTA_DATA(rta), &flags, 4); + off += NLMSG_ALIGN(rta->rta_len); + addr->rta_len = off - addr_start; } From patchwork Tue Nov 28 14:22:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471243 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2057.outbound.protection.outlook.com [40.107.22.57]) (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 8B8A935888 for ; Tue, 28 Nov 2023 14:22:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="siYjINv0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mG6KAiGcKn2wAZZ4RnF+UCW847kOBbWiaq61bVRu06DnO3xV8t5N4heAetLBIIPy7n+FLuvVea8xRJ5TIBzZO4BLrkcQw/SjB5RHWNnc08Rk3d8zXnV99lG/fWXC5UrHWd+VMsI8FmrnRXSNxtsIcIeaQQp2nqiFyLnjN384kEShOl8rejNkxsGfVn7YMWbyVj2P5w40U+5WAk11i5ErLJ++Uxovm+eamHoQwFJrvWnvlDu3+d4hCg7+XVUbPcZBC9eQTr9+TxFQMxATz38NUH2v6/gXGrRk9KyLu2nWcPR7yUkcVwGR1E+/PQZOjh9ZUSOj9uOX2eGxwtekOeJ55g== 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=fdfeH1bjK+oDhRLa9WbRGWcewYqeZENfXrVzENgNtL8=; b=LMwf9qmBSXYXd5gEhME8Fnl8USnybsLs7oidT8pTBpLfLT9NyX0OzuhpZG3/LcyE6+BNe9nPVpW+6/U/ojO5g0Km+NhbryvP/EZLXtCxHVPSTiYED1I+5cC8Q4+S18hokh1sGLBTJOW4lX1fIios7EuQgCvEEWUkNla9SnYpE4SeM1RvStQ7U89k2uvsbo0EKBgmIYHSrd8PP7pmHrkZeAxzgpiZLcAZDmKgBHQtnAntLwlBJOr0n6BRVwzyVYMI2SDSfgtft/6ky39gONN6kheLmaNBDN7qlxhD+0bBSm6j9AwAbuwB1njAyrp14FbzTuDJ83uMoZ0xfft7REX6Mw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fdfeH1bjK+oDhRLa9WbRGWcewYqeZENfXrVzENgNtL8=; b=siYjINv0pE81d1YLnAAEjpK7tVDcCzIMxcRkKGmpDh3n1R0UwIPAbJxIFugHHNVDAnsbbGSMJ4/gmfKwoCDy4Ebf8xc9I4aNepWVBBXFs56ba7SCRupqpljxnRjrn2SyiqnP4yt15msSBTimPU9Ntw5fNfN4cc+d+3XZPdg8LhX/eJ3krHToiMS2yQ9AIkBexy8KmAp18hAjwrORDRLgdAP69OvwUd6Ss8oLiDOoXWdzUZ7NgpFPvFYgWfxcSuCFtorKtP/KnWayewhkvCW6Tb4CTtqeK/SiPRQZJ6YgTwpsqQWSVSo3SA2Qlw655ybxxFhP1uSenl+akfRNN356Yg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by DB8PR04MB7001.eurprd04.prod.outlook.com (2603:10a6:10:11f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:22:54 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:22:54 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 09/32] selftests: mptcp: add mptcp_lib_cleanup helper Date: Tue, 28 Nov 2023 22:22:02 +0800 Message-Id: <04727d3b882eebe828a949c647ea70dabbced9f7.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: TYCP286CA0188.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:382::17) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|DB8PR04MB7001:EE_ X-MS-Office365-Filtering-Correlation-Id: 57a17d89-8484-4766-3d2c-08dbf01d8281 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mduMv6mdY+dynmlk4S14MJPN6s7Dgj67G4Pa0n6JFqrCfvzQOHfohBEIkwLUaFvMtcHiJn6R+iTWAdjnZF4WmZjpubEFnfhXDKez9aAbo9UNWfVO83zt1s78TnfiriaJeaPpFyY8Wwf+ZLloZqO4gFPhbw0DYmPIQRmsuC9YtS0GcjxHl3F++ccZNJr//PI1zug2o+pY4XxkK660adS/VPFvUX/mVt8XA4yb85PD9k4WH8gtMQY1WKSkwK/Oy0yYQ0Wv4mMpS7rdVDf0d7sZ25yF7TqiOM4emfkosoIiZXxW1YWDiQqaprI2zX3jeOijSghMDq8ujwYL/RycwIvg2ovHIKMHjytzGuixPXeKdET/ZsP1GsEWAXtCtzwxmEQMJOQ9RoMmmSL/r6IuQyyJDHwYdJc2WSzzAHzvGfhCuetnhI6t34g6dpDQSx50XHSipYpcEcHI6AeztgX3hyYJAQxfoQtaorJRofmE2406n9It+1pRuRKRCSWR4v96eiKW76oNsnhrWv6aXlpnCgwp9Dpjm1M6rUjC83Q64zFyCAHm8YBPlAi2jpDzo8PYSdgM X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(136003)(396003)(39860400002)(376002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(36756003)(5660300002)(86362001)(26005)(6666004)(6512007)(107886003)(2616005)(6506007)(38100700002)(478600001)(6486002)(44832011)(66946007)(66476007)(4326008)(8676002)(8936002)(6916009)(316002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vrDZAqcn+nJ9HcaZQMoRD6ZZX2ve28AYi7vuiR1HkfrLrJKB3FD1V0rwUaZzn1fe/xLxHi0oTeW61kUjrhpAmDHWIQruo19R/wbe+EMx+4OLkrFpXsCKmgHoxLXpKYqNRV2IHqZwvVVzI1sIR1Qk9FPWbHOrQsgxNVLwxZErp1001HATvaEBzJrMsL5+3gH/PHcaBaEICecSPZCrQ4QBtj7lRM/pVpluMn2c8Q9DNlULIfGgkO0CUKUYbdf9i0vMlorAgwuiK9PrGeYN7V1Gioj8gXDEvUMttFjWCxm4870fiyn2aV7ckaD8ZWMgdjUbUVKhVcm5YmQqEMquz4Phl5sQ6oIbSWoD/9lmgVEXuUYDCVVPldOjS8ZX3msupdxUgD9zjc5H5RyqDnq8fsnQDa0uJYIe9wVpgD6Ftv17YAT/6brLIneIzwjehWeyW53PqS/R1uyUTY+0VTnbe7CstkdsuxHmAR97T4PAIxmUtFxB59q8dQ0uSlqrAohf/bFeSH+ehHMbvIfAPGyBTTvPOooRBKE2fdyDxt+QDNYeYP+tXCzYa/saY+CICu7IL/hw7YmYwJ0YdHsNh396MZLeLlKWIOaHq9A3/0jDat30gncnwzvF1cHKK7wqdT8KJ3wzeLkNMcOT0d78ZZ6Eu1atgCPoOnAU1hoXUVPTQrjARAgW4s1Yp0unecISxl22vIFq0ge/iqCPnYAndtf2nKGdu1Et5guOJSD+PoI3hItDBGp9H3HsUxyRIXIsbcSm79715HxWGpKw9LKOhVgAiAVb1GDqRvI6mFNPeEX0bZSyY9AvBJZgIIBi26sLXPpjtSnZXOmsMjVH9KTEvqLgKKnU+SENevtZHMo0s8T6Qnv796xwZ6RaWypaaAd3qt7rmqkTlGLY9foazWQFOfwWWquXZS4gjSXyBVLFWCMrqA+uh566puxQ2uFENdXGxaNgWsI6A5FMp7pGrLbpzZGvqR0OrNhBoDJkTq864q1SEGFiBFDGeQM2juvjCUUVGb4S7uYsSbDAs02PoOwcxKWtPWY4XQzDHZl4Usi7fnGD1ZuFhQ47s47g0tQ8+VeFxvehhbYfwUFo1kIynVoULQwoprmmVtHwr6cAdFdCQ1ud5iKcaKeWY8Gtnc7A96MfxY8MAX8ZNHwV9JtJjsyGppyQRWQ81m7hPdNfCWEEw8ctMnnTmjQxYzSQRNL7PqfDV6h3hnmY1NWBHgFwFxyPMll9trd0KMfWDuZtfnHVKmG14xdufc9SsFYJIUroj1csnFmK+pt5VBXAwrlznzgQfFVULuxm23ElC5cZMVOzKvOw3xVA2LI3mnE0iyv696SUpp8Qkxk6NXbtRB3Ow90AJKV70YcF1fafW0rMh21nHvmBBnlGOhHzaCkWPR64gfO7W/q8u34mNkbE+Y14FhwSgonQvhqm4N3u7iENSqmqWTZeDG4+3D3BrFXmW0Fs8ie/+DksiEYHOmARXTx0rPH4UcZt/dHDcKhHfbexWGsl+BQNUYSZv+yGYZxUVAivi3zZcud35PQKBpqNN3Qi/J5PkhzdoCS566JZUO5HGc6Kw0vt1Yrj0g3jl1wOJKNuSeo4ppKDFsOU X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57a17d89-8484-4766-3d2c-08dbf01d8281 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:22:54.1483 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9BCQefdmkErRyk/u3I0FdWedtvp32OVBBdMCsHeFaUMqo88dX72It3u/oE/kBFvuU/Ei5LwisIAKx5uLNMqtnQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7001 This patch adds a new helper mptcp_lib_cleanup() in mptcp_lib.sh, it's a public cleanup interface, being invoked in every cleanup() in all scripts. Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/diag.sh | 1 + tools/testing/selftests/net/mptcp/mptcp_connect.sh | 1 + tools/testing/selftests/net/mptcp/mptcp_join.sh | 1 + tools/testing/selftests/net/mptcp/mptcp_lib.sh | 6 ++++++ tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 1 + tools/testing/selftests/net/mptcp/pm_netlink.sh | 1 + tools/testing/selftests/net/mptcp/simult_flows.sh | 1 + tools/testing/selftests/net/mptcp/userspace_pm.sh | 1 + 8 files changed, 13 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh index 95b498efacd1..a678ee21973b 100755 --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -31,6 +31,7 @@ cleanup() ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGKILL &>/dev/null ip netns del $ns + mptcp_lib_cleanup } mptcp_lib_check_mptcp diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh index 7898d62fce0b..98f4e82789ba 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh @@ -143,6 +143,7 @@ cleanup() ip netns del $netns rm -f /tmp/$netns.{nstat,out} done + mptcp_lib_cleanup } mptcp_lib_check_mptcp diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 87590a43b50d..98b6814af0e5 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -198,6 +198,7 @@ cleanup() rm -f "$tmpfile" rm -rf $evts_ns1 $evts_ns2 cleanup_partial + mptcp_lib_cleanup } print_title() diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 022262a2cfe0..5b136c8f0827 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -298,3 +298,9 @@ mptcp_lib_wait_local_port_listen() { sleep 0.1 done } + +mptcp_lib_cleanup() { + echo "cleanup" +} + +echo -e "\n${KSFT_TEST}\n" diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh index c643872ddf47..75d8c648f9de 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh @@ -85,6 +85,7 @@ cleanup() done rm -f "$cin" "$cout" rm -f "$sin" "$sout" + mptcp_lib_cleanup } mptcp_lib_check_mptcp diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh index 8f4ff123a7eb..fd413b4c8123 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -34,6 +34,7 @@ cleanup() { rm -f $err ip netns del $ns1 + mptcp_lib_cleanup } mptcp_lib_check_mptcp diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh index ae8ad5d6fb9d..436500c55e12 100755 --- a/tools/testing/selftests/net/mptcp/simult_flows.sh +++ b/tools/testing/selftests/net/mptcp/simult_flows.sh @@ -34,6 +34,7 @@ cleanup() for netns in "$ns1" "$ns2" "$ns3";do ip netns del $netns done + mptcp_lib_cleanup } mptcp_lib_check_mptcp diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh index 6167837f48e1..005251b61d7a 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -129,6 +129,7 @@ cleanup() rm -rf $file $client_evts $server_evts + mptcp_lib_cleanup _printf "Done\n" } From patchwork Tue Nov 28 14:22:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471244 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2088.outbound.protection.outlook.com [40.107.241.88]) (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 4976235888 for ; Tue, 28 Nov 2023 14:23:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="4+e9aQ4G" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J5/YSWxHETxCQgUk+JnI4cH07zWuf4kf6GNSUGl7+3hEzxRyAT3l7xZfjC2CDG1RSPuGJlPYkZO9gb/wLm4D+SH345ODWGexpLIutHQzbFxgUml+ixSwema3ZyK/OQPRpSCwtU2LweBjze7LmUJP71gt5EWXLNb5O4+Uank5LZQ4f0GZhHZqO1+yllgrLSY+//qcV9pO6A1DxhxSIoFZQ1piB7tSXCbFUwEzCx7rd8BOCbUMouukIPz1+B6964VUx/9Ig4zgw13WXqMghPphC7z37jvoWEvzBFqqf/0ADXZYe48mmhQYyTdsIpFv1vPrFsptoqCJv5mAhHhoRlaOSQ== 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=258KaDdxK+39PcXMpwwPvAYImmDe9VWWlY5xKNU4Lu4=; b=eO0gP9N6MwTjzOM5JyJxwLvwCIlL+0QjtBFQtjBG1IXg92PkqslTcYcE4TlbTSSF9Qjtaa7K5KVkBCquwwoSuP/ytxj4HtDDo7sfvUb6r8nKN1fPZX9Je2mawGv3kbjdetFcnHW9jYrScAUXmVFKMLwBb9gjeD8MGSwb/6V/SNl0Zjmf5FPJg5L8G9n2/Ss7D22cy41KWe0WHIJwgChjvFQEkap41C1Yq3aTRen5J7qqylWMk3nEu0lWEO91QBckqJJZuzYgO13UH3Lr8DiF7rnuwXXhmmoo8Cbj1PxyJk3xL9wIMUcgBu5Oc6Fd74FjxBK0N7ZR5YmSQb20/DQKmA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=258KaDdxK+39PcXMpwwPvAYImmDe9VWWlY5xKNU4Lu4=; b=4+e9aQ4GU5lHH/2DWPeHxyKvjMuZ/pagYmOCjJLJkIVTpz/D4ZFGzZemQXcRh0VcS9CrN/ONDtg7z9+XvDC657NemA2P76iqu+dtXig+uzLdRPwVvtYRz+HcCEDiffF89FkOtgzziPr0aNLddiLAqNWt2OY7gR70EwGV6AoMJ+OXezoV3CP8fkJ0ZUfc7y7mfG3Ek7dgx3g2UBpW5wRyB1h54SMGwU+3IXgWPde06a56AAhAqFJYqiZS95bKQ22I3wWXthJ1zTHpNZX/Lzqt8t61HWOcEXb50Qkxl/zOFQRej/v6Pd+yxWStwqvKcaJlEiTkpEjU49KNbwdqqRfhXQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by DB8PR04MB7001.eurprd04.prod.outlook.com (2603:10a6:10:11f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:23:03 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:23:03 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 10/32] selftests: mptcp: netlink: drop duplicate var ret Date: Tue, 28 Nov 2023 22:22:03 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: TYCP286CA0199.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:385::17) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|DB8PR04MB7001:EE_ X-MS-Office365-Filtering-Correlation-Id: 1223e1db-b87f-4070-5bd4-08dbf01d881c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: clNLtuORbHivv9ywa/QY9eOcm+BwDRHLN5F8bDazchQ0YkPZ/+hM/86xfpQG5HxnzhrhUqxLd6mho6FjT2er1Qk7DqUcao5qfFEh6pCXVQL10kVOumWswDlTNV/ecpweAKfZjCvR2Rz1KwSQFIiEY7LJ59SvfA7Hl3th9oxEvkZM8/RUDuMgn94j9B4w7xUaJFx1hgrYGzRQHmVBNHvaNKfvuffuopytSdb9lv2NHUgW/CD7ozVnGpEfeBwtYJe4v15N01UwkeCRFHHy1I4vby0TvqsjDiWJIrTP+DFp7eeDWar126/elbqqfEdWAaPbOuG1xzjKBhYfx5H6aYPAFTayzr0jXwWewqryIjlT6UTrrFvXmVNuvCtB/wRvibsFP3dwblZe9MnSr/3c/McfAwMvuAx26nbv6ZrO2ItvpGu51tyS/qt2EnXf0LFWt6Bqnnu+M6ZmeSY2C4/R2CxdEVzZANyJ/aoYaTifU9M4WY7ebEQCUUEM/Rjn74DxAN0+izT2QEUhw8Vre4z7Xn2adhz8NGQmf4n/PSyZByN4GD5kWYPFv6S2zkeaEHsprhjl X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(366004)(136003)(396003)(39860400002)(376002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(41300700001)(2906002)(36756003)(5660300002)(4744005)(86362001)(26005)(6512007)(83380400001)(107886003)(2616005)(6506007)(38100700002)(478600001)(6486002)(44832011)(66946007)(66476007)(4326008)(8676002)(8936002)(6916009)(316002)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RhrEiqUQX3V9EEbi4GsgDiCbq1s0B9S2JFE9DKUEHQ0tyIvGBaMMu/3EEUrWmpFNJ/CiX6OWrwSs1lY8nAxdeJG0VWkrv4elhYF8k5tOJNchYbPPo9rI+19KPCqX83uYRsL8StEcX7J5zXwKYSX277bAG2Lg2xR1+lVaF08XJyNt2QMxb1jNkarZiFCcSW9GGIpXYL3Ucvrhg44e5vyXxuAoDPGPpHiMDsxWKowTpXhQ3oH04lc0kphabjLrhN/OxSedJITR1unorbXftJCEGL2+qA/De8HJRqGapDsikMIDQ7ZZMkjLutS7lBl3iwjXMpWkN54lKmgKgroNLMwDo1Vby/xQj9H3RNS3vCWkWYfc/nXCNhO/+6EnEyWUPBGvemKBa+HSatb3E7502WUcDHAmnNW9z0wFMgS6opRqmAHxR0h1Y3LxnuXmQ+8/XsUkl+WkKkd+yeLA5jSIB1VVTipgHzyTMriMk5B0ZtfJkqdiZgjqO4LcXB6ewwardAPl+PRX+/gIlJbfrKCaEb1ieKzOozlhvlQ7jpyczG7+Lr/HU9aiVPcl7aLtV4p0XG/MCII+wqEKwRh5FYn6feEhYusGKTNbBMBbI8eXUSv7gg4DO8jQJgdda+JxdmvcbIsInF2ZEzO8OjadymclIJmN9rqk/kOS+m/hQB0ZfmrcmEiIpd9vG4R+OSLlAifDCb/f7EjlyTZdMCOzkTsh1mpFc6wd0BCw0wWkdV4JvE6SXUf+VqCrxFLJLtRYPx6DOrL+sAXS3l9SxiDn+f8Ik+1kFhhOAQtftrb53XAdFbU+db1ZTbOLmVcUAj8TdqAyJs3o76H/KShIwA44XKToWpK1viHcX1QeTUtn5JkAUq4PtR1El24me1f7ErTzDlCFZ0fy0dSvJA93xoMTNf+lxyJeWr2d2oDBzrDTnH8Y4hD2KFkJffeRmW2stnra5qg9VySrEwlD3kxnIg+wekGiFvqygE40ddJM+8CPwbgK67Y3C8MOtqiiqfoHTFVxMjmupBTioJZpLZdOlgXuAcWGXFnP1Gi9YEeFIwEHdK7U67I177gkBI4nLQH0deqwBBo/TpSZ7F+782/eQsIzed/gzR5ClkozFVcNTiNLjWr49IGOcrgkRiLISMRSoKutMe9zhm2u5TwVdCcHsG+BoXxTlpqmUPixiLoPTq5S76xJAWDBzaCKW2C7tHk+MTe/XVYacjw8t6AWZUjwfQODWhnFsKDeT0y8B34L69ritCbnVpynpQNs0WxpqAOb/uW25NjVzYVOxkHxYwI2/yByIAin9NAKQu4+mA0+Thyq9Ds2EQIN0M0ZVQM3vtKBD33AeAnzNFhU2AijyVtHPrarofcEA1huSrCD1fQssfo4HJ/aaFt09au1tzVh/YjEuj+hNyrWdF1x+U23CUkyDO9nD15Fkk+0sK6Tg66AjZgZ4lJQb+KDll71rHnC9JT1jSS7+wZHRLBhUc0O3yDGNkYUSe46yd+DL4ODIHuH/7OMtC0mGLgRIxaJU8zYDD/zowhb+eFWkw1Sg8in5sdgXXpOg6PbxhJ4eGua/VYiXmlYuDBZbbbg1/Hsc2T/KE6nRvmnOEQ4aR74 X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1223e1db-b87f-4070-5bd4-08dbf01d881c X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:23:03.3300 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0JM9S3UA6lJP/JiDtpx1dC6lMstGiWvcqbXNoRbaTlkhwPWDL4dZMmmkLdyheRZnVxHy0uvDCCfLfanBU+sv4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7001 The variable 'ret' are defined twice in pm_netlink.sh. This patch drops this duplicate one. Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/pm_netlink.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh index fd413b4c8123..c0b6faed50c2 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -28,7 +28,6 @@ sec=$(date +%s) rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) ns1="ns1-$rndh" err=$(mktemp) -ret=0 cleanup() { From patchwork Tue Nov 28 14:22:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471245 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2073.outbound.protection.outlook.com [40.107.104.73]) (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 743FD35888 for ; Tue, 28 Nov 2023 14:23:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="jMBVFw6o" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jw7wOHzSOa2R7fGsb/9m532NF3CAm9ySbmBFiPzROEXsgKTOKzIOmX4KHwI7yT6dsGpktscfkYXEI5hWHfzUJ4Nn7fSIYG49KzSoYhZkxoImBehUatYFCCYtQzW4kRjozIAs4ZqO7zMIKoH+ZJfxu7OMC7PusybqTHRIkRq8y5GWSkYwFZoBXcFSwF9q05W93+cpp/TgHiARRx4FOcGYQFdo1H20uDn/jl/hakmyRDltNVJwszRIykf5C+NZtf1I+P4zJgVOebD4iOjPhLxfPEbhyHhEDO9QRpM/hebo+Im35Ap4u1KeTOXdZGOx3O9fLjYu5vl6YAMiic7NBCKfyQ== 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=fwEtQAfnJ0hRvquF1g3hhDaLkAvRuMhlCIw8B+byzSk=; b=TgVzS0H+qJQFZFEA2/4tbVe1Q4rmsFV0E5bRLvK+CtIK914xmQcZ3CUpWFAyIinZ578P2yG53Y+F9Xr+4T9a3lUdbcelBB179Fi3z6kk4iFrri60THUkq8wYEo6hxj1jJnWhAy/B8FnawUbeOb+zfamDNd7zAoSvTCM8xGlFbK0vGvNe5cJr7g3j4ZvYWcmtXn7IN3Q6WMHpGg8BfxkK6lK6LIolYvRz8k7T5XkzOV26Zz4y0aoh1Uf/hSyVFa/ztWRCgcv9XaNMyLzV24pTBICC8OCsKSEa1dbwIpaVHUCMtjVQ1tXNLQpkR7NTiJqDkinHGxEyLkS0hmJsiVLkWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fwEtQAfnJ0hRvquF1g3hhDaLkAvRuMhlCIw8B+byzSk=; b=jMBVFw6oFW87ScbCeVO2Hn2AvwgGHmaedEQrfuVKiG2dvomZIV+BllU106POgP1gyRMN4Xnft1s4TJ9oJUfUR4k/HtcMxNRsK+phy+t1/bpLibFB8DdgotdLwy391+ah9zpbv8Q1FzIQ3tYAvPPVBYn8iuWqCwbPdxPQtexihWrCQHUl4wFglNvKSvrW0o8PdY7y3qjtksO2lm9vqXEH93tuhJsssdt0LzxXX+X2YtfUlc7ZezUrebkOODEW9pj2NXwzLEjuUN62dmD64Fjn09//+M5XZQ5Db7Q6X8lwuEQJFhqBNttzhaYlNxO/MPqlylBphQh7DRKuHBR32He/Zg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by AM7PR04MB7045.eurprd04.prod.outlook.com (2603:10a6:20b:11e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:23:13 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:23:12 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 11/32] selftests: mptcp: export ret into mptcp_lib Date: Tue, 28 Nov 2023 22:22:04 +0800 Message-Id: <49ec1361b01d98f7ced2200cbaf3a95b83d767f1.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: TYCP286CA0198.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:385::13) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|AM7PR04MB7045:EE_ X-MS-Office365-Filtering-Correlation-Id: 349ab230-1c04-4a9b-976a-08dbf01d8d60 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NzNJ1SRx5s34lNcEgnDU0yOkcRboxmIfoBvM3kXOpeto8AuYFEstjKorcKf2fT+u+DLy7wTDB+y2Z/0CK4XX6JsFvrHZ4awdiitUOHYJnvxTQ3IYdVtQvwMrIuzKuqfg3snCdWxSMwPDZ3TROKOF6+J6DINUqHTvze7UJGjv1/nrSCkV+Mm+hqCFLrfvoj8SBHTtEfiO27JktBuj0TsfHHDlEp5fYtc74AHrXacmAY+y9kLTtzXWop59qIFQ3iFVcA9OnLGCCuoXpAn4vKjorih93gPJts/5DV0qwgYejMizd5Lyh3T/3Gw5rTXV3izl/M76KXeAOmZUsor22q5eqE6PgoSVOzk0DmRh9U4RGsVZgUr09Q3UueBhlxa9I8hYsn2/Nxgh1nk99XJq3uq7/Byf8jQWxgOqsV4oeXvKFeoMh+ceK+V+2iOb4U8oRPBL59fkvuLVBTubH2Mf1GXr3ZgE4KznxLN/5odYcDXx/2Bi2ohwCQDyTbFMYcw9KHj3onmai+9OsPQjXaKgClSH6CLIEL0fegNG02yrlIYBNaETaagBd2LgK6csgStqhjdG X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(396003)(346002)(376002)(366004)(136003)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(6916009)(66476007)(316002)(66946007)(4326008)(66556008)(8936002)(8676002)(478600001)(6486002)(36756003)(44832011)(86362001)(5660300002)(2906002)(38100700002)(26005)(107886003)(2616005)(6506007)(41300700001)(6666004)(6512007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I/Ja6U6sChla4ZuvNpm4zJNAC4oeMdxUz/cKZRMprND/MlW/qJ7R7tgxEA1+5RnP3Zsv/1+SFPjDfinCS2wc7W+3YnIefbepznb8fsermgnvzZhZPcN23MTIiUSGXdLJl/8K6C9yl+dOSmGljmBaM3hgOZrM2kTUgQYQUF5WirARGAP/dZqy+F4R64THrZgpZ8qCzpDj1hV0QYAoD1ooxXElFwVw8jNoyImWkfYsyoSbbY9B87KDswJEmRNyTP7s6F4hB2B3oY4rfGj8//YxU4zCuz6KLJLW2SLqEszs2wX+R7olRQlWxrdiLvwS1uVnBTkn9GwKK6p4ZD7kkXHsD3GCUbE6AQuKDTDVoJMo5R0EfaG5tA63J4ysv6rjZElG5Z8KXKYgDFpCwy2uPjxfIZyQk01559QvSy6hKLPoPv+AE97UDXDVklRmuELrC7viNCiENggwyc6ZEevVZ9Z6L/fiooGUQVVWzT2S4Xfr40M8+lBi68tigqBqRcTucksKguzS63UGhrGMWpKkmdEFR6trrgniuHdMiyoguU+l0OE3GH3WTW5x6oxWp11PsFWDjcXqHNQI0B4JHkhit0WEU9XZTdNk9eOglZfj5zGAV2VmMC1Y7V+L4xtvdWLvkLOudZgkXnbMROn9uSq4i2XkIq+6O/wfisSgmrgcfl9GLH8+WRtGJnvMtizDPsc+EaCc69kQkoy9crIE52IRVcYdD6o8y89h9YALnYaGNZcoV79U5fv/eve3OyFvEqSKFa3F2gd3muG6BQcky2qjYP6+aqP1hIwIHePEcMQfnB8l+yhtxf0xJJnV8570Durl902PdhwiRqCn+XsAMGK+8Fuw+AbkthkCa0iOk2Yrjbr8GzFyuKzJWwDwRd/CWJIfVzDt5oZgeJvCiDo7wZdmg8EuKlD0eeUkXe1LJZnaLJmjt4yb5DepnT5Lml19lo5+fUY871xFZH0lmRmcddVZj2+28x7RCKO4/893cAvUeeej5ARr1SxjY04eXjJsp0ZffKXE33tnpky7MgcRaGVSHClrsk+fhFbt72Fj68RhZtS7Bq23KZc2T6+bD40JVKAYRG7637g+lZzwW8P3M/0VUK4aMBGCOaUBtZTM+Zj8C3fLSR7xE3oCyJo7hsOUEGpHNwR5le9d/FXRjXPtet+9nsHSZpGHOLHQ7BIXEIPBSGzZek8UB+CyFQ8ps1zEM3J2GD3HCNjmtrlYFjO+Dl44yIDTkfwNl0tD9RLxs+UQri5vPRrCwYSNxLNe72RYufhtf8krjCo/x7ZGDwyLb4+moVB2oWwl31H0ZZ/sIrnkmO30WDvw/AJLRgUMlo0/ULpHJh6mxd4FHuvehvaWXPNog5rGWtQFQNpUw5YQf0Vu5EiR6ZH3KgrTh4OWugBbPDz/X35RU75HTl0NcW5hbVGQGVtJ91CKk94eylnPUlNHiwmpQzZkN+UfFa863K5SM7nb7uNH3jCEjB0eGOvVI3FyHnRybnHqu81pzZbxuU/Z3y/HLUVVxKp8Bvlckcl9pyDRDdoRL4PSnr6YPzBi8cUfn+sO/L8sxq7x5iRf5lJUcyIwBLqdFU37yA8yRW/JA4Flm9ec X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 349ab230-1c04-4a9b-976a-08dbf01d8d60 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:23:12.5883 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XxPNT1OQ6epvHBP3v9baiociWFQEPTaf2swszhGlvMn3QvYG8oEd4fnZMheDAGhIak7CreUjKMTBVnN3zxSXaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7045 The variable 'ret' has been defined in every script. This patch moves it into mptcp_lib.sh as a public variable. Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/diag.sh | 1 - tools/testing/selftests/net/mptcp/mptcp_connect.sh | 1 - tools/testing/selftests/net/mptcp/mptcp_join.sh | 1 - tools/testing/selftests/net/mptcp/mptcp_lib.sh | 2 ++ tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 1 - tools/testing/selftests/net/mptcp/pm_netlink.sh | 1 - tools/testing/selftests/net/mptcp/simult_flows.sh | 1 - tools/testing/selftests/net/mptcp/userspace_pm.sh | 1 - 8 files changed, 2 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh index a678ee21973b..0734bd9b54b8 100755 --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -10,7 +10,6 @@ ksft_skip=4 test_cnt=1 timeout_poll=100 timeout_test=$((timeout_poll * 2 + 1)) -ret=0 flush_pids() { diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh index 98f4e82789ba..5e28292e1889 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh @@ -6,7 +6,6 @@ time_start=$(date +%s) optstring="S:R:d:e:l:r:h4cm:f:tC" -ret=0 final_ret=0 sin="" sout="" diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 98b6814af0e5..fa67c833f91f 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -12,7 +12,6 @@ . "$(dirname "${0}")/mptcp_lib.sh" -ret=0 sin="" sinfail="" sout="" diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 5b136c8f0827..2a9aaffabbcb 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -8,6 +8,8 @@ readonly KSFT_SKIP=4 # shellcheck disable=SC2155 # declare and assign separately readonly KSFT_TEST=$(basename "${0}" | sed 's/\.sh$//g') +ret=0 + MPTCP_LIB_SUBTESTS=() # only if supported (or forced) and not disabled, see no-color.org diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh index 75d8c648f9de..45e5b5810a6a 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh @@ -3,7 +3,6 @@ . "$(dirname "${0}")/mptcp_lib.sh" -ret=0 sin="" sout="" cin="" diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh index c0b6faed50c2..10df0475ac30 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -4,7 +4,6 @@ . "$(dirname "${0}")/mptcp_lib.sh" ksft_skip=4 -ret=0 usage() { echo "Usage: $0 [ -h ]" diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh index 436500c55e12..0c211496e611 100755 --- a/tools/testing/selftests/net/mptcp/simult_flows.sh +++ b/tools/testing/selftests/net/mptcp/simult_flows.sh @@ -13,7 +13,6 @@ ksft_skip=4 timeout_poll=30 timeout_test=$((timeout_poll * 2 + 1)) test_cnt=1 -ret=0 bail=0 slack=50 diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh index 005251b61d7a..b2b132f61f1f 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -58,7 +58,6 @@ sec=$(date +%s) rndh=$(printf %x "$sec")-$(mktemp -u XXXXXX) ns1="ns1-$rndh" ns2="ns2-$rndh" -ret=0 test_name="" _printf() { From patchwork Tue Nov 28 14:22:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471246 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2070.outbound.protection.outlook.com [40.107.104.70]) (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 0EE8335888 for ; Tue, 28 Nov 2023 14:23:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Udh04Nt4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mjipHOnLBDDZXNID2Pm0QeTalL4nPlw2p9pJW/j/OKepIv82esW8LYYJU7TzHFVTR5LX54jGbWdnpJ6vd0emZXJa8/yg7k2Bv6fWxvxOTNu92VXdFD0gRHC9Vs+4tG+KtRkI8nPcNGmqkVnSbOMGRhjsh/B+XovVEWkHmJOYZc2X3dbfdDgu0lSZKxtvYQQbeHYXfmLM3J33oiAWtSzsU2S20qzaUs0zraURVao3vevQELdFk7XRM3AbezAOAQRAYAyzg3n35cTDpffXMeqqTWf/XdCZ7kaDDvjwXTPiSnhadCsvWFK61dQZAQROrmugKreF3drXRqPHVh4l/59ZRQ== 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=xlNnov++/Uif4KTLmCrP/QePTgePVW+bErHxdmuIRFI=; b=N/O9GBTOsqdOdTVvIEpFyU4wxFjORYmoZ0FaepJAXZEm02WGy/2aGJReyCqkVecxjxFnibd2XAR0otlk7H0K2DkcvTUvomPDlYO7HbmX9zmkIZA0+3abK6mZIcGifmyHrBbWbCdU/wmhtOxw438px1lbDIffqsCsbHN9RnK60O+r0GFgtUBgu5H7PsMTUB2o3Bdrv2RLMQaybeu/xmuktFtz98qe5WIEdHeDs265QVXJZ6VZQE5dvr7P2QGrbc4ShjpeocN/J+4t+f8lchUTHLCgnJsZWR4gU0wo/g6vj1xNexofCltya0s64TE0NSUUhJwIa6YFva/h45a0+U1eHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xlNnov++/Uif4KTLmCrP/QePTgePVW+bErHxdmuIRFI=; b=Udh04Nt4y8+K5TdenFISozD7Pqgu9IyfUbN0BdwAbgXSD+oxWppvjcadBF+ElipReGr6NxsWL1VRj5k1iB+7dggxAQANG/3rA31tamdGqH8do2Z3fNPm/l7bd30cnINQjJzj4llWVC2J84z+87MBOeuBacQ5pc6WHtGWHTBf+Ui591cKTLqh0OSqqPx1cLzQSHca0oeps1L6MNY+IteoTGs0j0dn6GUbQ6WlUlEurJ9k2CCcWPfFStFJOFEbEscJmvXsL88TySmYAAM+PiHhKMl1JVz/roAYTxyD8CKgi7AomGobAtPUDO7eWcqIETLGnwDhKMQ0B2C/D85AFVZQlA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by AM7PR04MB7045.eurprd04.prod.outlook.com (2603:10a6:20b:11e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:23:19 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:23:19 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 12/32] selftests: mptcp: add mptcp_lib_check_output Date: Tue, 28 Nov 2023 22:22:05 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0047.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::16) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|AM7PR04MB7045:EE_ X-MS-Office365-Filtering-Correlation-Id: 7899cbaa-3d60-4d58-8327-08dbf01d917c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u0SBNOUUqs9wyP+F114jNDL9r+MwDY9Twxb88GFLxT/mjbgIR9ibVi6rh97jfrPygzMZ3LGg8JW1JKMtQrOUjC34Tga0QX5cZR5a0HLJKxK8pour+7XDhOH/eCQTH6wDarocugzQK0jXIrsKY+9S8TmJlW9UTSYCRvAQOf8jAvxIwdbnAc3U0gt5ksosIeUHmUTWTp5XDPNp3QyNG4M3EXMdWaIgljuN/qkcaH72XhKXAaduG8vybukxjI+SZzid0JtaBKZ22uWc3X14W2n+P9pdYC7geA+pYGUoXdWJCvOGGkaPAjmrBz/c/h7iPQxpnZ0r8/Zy9gkm4QU8PNeiBJNthrdYExlu63zXHkdMkW5V7OsPrVNR4TEZLHoq36NBCPjv37kb7amQmw3fILc34J4NNC5VaxisqP+5jQPPLWZgliohCNrJb4+4UIXOjq9YXl1FgWLeDLwwvNczkoJQIrzvT86yiovzRsdsSws036Rdf974uN362eoC5GHkrGdCWu7vL62QTFT47LMFeVt1xYFWI9IFC+Heh8t970OMwTEtT25n73U4VLfQFPSzD7ax X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(396003)(346002)(376002)(366004)(136003)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(6916009)(66476007)(316002)(66946007)(4326008)(66556008)(8936002)(8676002)(478600001)(6486002)(36756003)(44832011)(86362001)(5660300002)(2906002)(38100700002)(26005)(107886003)(2616005)(6506007)(41300700001)(6666004)(6512007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Lmci1Wo7AdH1P32P32R45SlPC70dQbkj/sKejr0CcTu7HsAMTpkGQRamA0mKqcW7F0WB+BBwe6Im/bHR5jRlCmKN+9x2oo6bmUHwNwu6R2pC0mdsLmfdAs5GwVfT810vo9EigUaYeBw/o8AngwEZFtgkgtrLfAWIhGjd/+jk1QB2Ue9gHCcwT3wdm+zZorsaaOwupxWb7AxZrfmbBb2VxtGiri/JjSJmvKGoRyfuP3JUg3rPn93iwuqnlLSP+bYFijJBeYNCiuBO8NmE49OIuhGNUkhC8X8p6+3kM8u/ITH2J6HTGtijKC0ZYT6vg3c/U6b6Kvbvw0FISMiZGxDN/mAPU3nDSVRZZq+MXQHBLYAsxjRSneetijVp7k/k0+ev/PhBLGWg6fNg54FEo2iPZq2IBJDHCUx3VZw8jS1LdmKRfmDQfvJcEoQLJm7eUrqwUX602xVoUayOJnyoKtBdZp8lBjmDbPZAihU6zzCDvDyXhqSmLoXSYbB2gcF7YQolUMQBQDlfYxTrh0c0IIZsVo95RI2V02Ehisi8LBk26eZsOaJy1Oiu+3uxc1jTDIffg4H/IL0qRrf7v4Id6cWOZXf4/nIIUcDFCjp9RV0O1OLQYA6uu2zVIWFPSsRmqoTz4zWt+gQzrwkrvq0CMgqn3Avl2uWNyqMVDzSUDBMR+TON2CVl6G57+jSWDHjqBpCpKOV2c4VH7Y5Q3VBoHfisJpppZ0z9JXvfgBO4D0oyA6pCNWXQMDG9BhdVGidJd0ZafRbYuOR9+9Ufgajc82ck+FwFoaxEH/VQukdT7TdXsENarYluD4zt8L12cRCaGFJD8D/sENrjDhOJEOVgxwnJHPPhaEJGr/NfGITs24Ovma+emFuPgYU17HQeFWyC26XzRVVLuKl3MPxKHvFmaF4Br2YgtqoOZWEHkOdp6vNeSnDLjW6LwaUvdFZhvdq+KqrKt2e5xKEEju58UOwlI6dJpbnSB/r1uKSBj50XKmiUT2baNLYzb4hzszlL+uqxSzqlMbv/+pvU/Mc3lioQY49gaq5ztakznGMU2q0IlSKfvy6E4Tra1G3zqm8CgwdpT6zFj1bYZ1dR+YtXJe+ZoFS5sASHFcOp4yHWl24IPkKXDk89xG+0qE7KHGZQFIpncNl+DIWbhD6I5Nxvj3AHy4XkNd1Rjx5iLoI0GWKBMRpaRJR0kLY1NgE0Sj5hdD3dPnPF1DKyW75kcw2kr+E7XecnKnyfQdQF3tAKuqEIY2hhiF4Z3QXJ216vIcyrylAMREhVdgBqsizfjsJuXtUv6ItA3RK7j3vvSEgpJtwq2ZPw/P+wMsLQE6hnTCDBqyLTObuxEL9UWGuFHgQKkoX9e9t0ggKajV//eESYOSf9aZRKUizJN/Vq+qic4qEFKSI3EMbl9YWru1XH3pvaG+gVultwk53MqviS+EAMnZkO7KqvE/U1J6j1U0aG33MCMqx5mJu52iVrHjMARIGt04EwS4nY2xsaOmPzoClB4oc2aajqALgG+Z6HsG9eUVE+cKNcT14gw3LG23d/2c2hANpsCSSosMyd6s0FYEc09rYtdUZaV/jpDVT9QdZwQggYBmUoTLPO X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7899cbaa-3d60-4d58-8327-08dbf01d917c X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:23:19.1778 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: duKgDCij7PMtX3ipW+wHDzMJnhO45ZXzZ3+Xw56AhwvVu78I7oCrjonay8inrTrw+/dW+sjYLCzETKzjPHCLmg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7045 Extract the main part of check() in pm_netlink.sh to a new function mptcp_lib_check_output() in mptcp_lib.sh. And use mptcp_lib_print_ok() and _err() in it to print test results with colors. This helper will be used in mptcp_john.sh later. Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_lib.sh | 31 +++++++++++++++++++ .../testing/selftests/net/mptcp/pm_netlink.sh | 29 +++++------------ 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 2a9aaffabbcb..a28b480e164b 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -301,8 +301,39 @@ mptcp_lib_wait_local_port_listen() { done } +check_output_err=$(mktemp) + +mptcp_lib_check_output() { + : "${check_output_err:?}" + : "${ret:?}" + + local cmd="$1" + local expected="$2" + local msg="$3" + local out=`$cmd 2>$check_output_err` + local cmd_ret=$? + + printf "%-42s" "$msg" + if [ $cmd_ret -ne 0 ]; then + mptcp_lib_print_err "[ FAIL ] command execution '$cmd' stderr " + cat $check_output_err + ret=${KSFT_FAIL} + return $cmd_ret + elif [ "$out" = "$expected" ]; then + mptcp_lib_print_ok "[ OK ]" + return 0 + else + mptcp_lib_print_err "[ FAIL ] expected '$expected' got '$out'" + ret=${KSFT_FAIL} + return 1 + fi +} + mptcp_lib_cleanup() { + : "${check_output_err:?}" + echo "cleanup" + rm -f $check_output_err } echo -e "\n${KSFT_TEST}\n" diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh index 10df0475ac30..c0fc6f82a8c7 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -26,11 +26,9 @@ done sec=$(date +%s) rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) ns1="ns1-$rndh" -err=$(mktemp) cleanup() { - rm -f $err ip netns del $ns1 mptcp_lib_cleanup } @@ -51,26 +49,15 @@ ip netns exec $ns1 sysctl -q net.mptcp.enabled=1 check() { - local cmd="$1" - local expected="$2" - local msg="$3" - local out=`$cmd 2>$err` - local cmd_ret=$? - - printf "%-50s" "$msg" - if [ $cmd_ret -ne 0 ]; then - echo "[FAIL] command execution '$cmd' stderr " - cat $err - mptcp_lib_result_fail "${msg} # error ${cmd_ret}" - ret=1 - elif [ "$out" = "$expected" ]; then - echo "[ OK ]" - mptcp_lib_result_pass "${msg}" + # ${*} doesn't work here since there're spaces in some arguments. + mptcp_lib_check_output "${1}" "${2}" "${3}" + local rc=$? + if [ ${rc} -eq 0 ]; then + mptcp_lib_result_pass "${3}" + elif [ ${rc} -eq 1 ]; then + mptcp_lib_result_fail "${3} # different output" else - echo -n "[FAIL] " - echo "expected '$expected' got '$out'" - mptcp_lib_result_fail "${msg} # different output" - ret=1 + mptcp_lib_result_fail "${3} # error ${rc}" fi } From patchwork Tue Nov 28 14:22:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471247 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2061.outbound.protection.outlook.com [40.107.104.61]) (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 A082035888 for ; Tue, 28 Nov 2023 14:23:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="suJutbJc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BXMGYN67sgy6dlls1GT0eJmhsZ/vPPy/+XQ26PGb32WHfbFRW+4I7ynTrLiZjy2H8yiGyN7g5bQbM++o7SsUB6pWebrfYJczUa7qWSYAExqA/stRRnZVwA27B3Xlyzm+Bh05CNaB67zkX45LyZAWf73mP+1HmAvkv2c6XsBGr/sk31GoU+kjJXapu9/1WoYTLBWOMcFXUiQ20i69zd85ITtKfcNUwNvZZR96kYQKnnehbgE4rEh9A01YR5ZBWg1UY50qfYFnoQeUQf4gkoP+Oj0xG5Evj0OnKSKORt2Gqm6nqQJCOkDv+4+9iELgLzZTevcee/C82QCKiN5IYuMJ8g== 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=DyRzY/fIEaVwU86yq9iU6ZmsgRtYc8k1JF0Q1WlVzNs=; b=ZpLFyay3enzS5EnyxWzFLdmsVVHDpQIToKbX9oVpP38KmBH1E5J+dUtyOLxqxwGyp+LQbnVxx5djaNHvZtVFnDpKbdo1YMITuumR8ZdmexK6xPcNwTNMMQ9LRzyt2rK3kO5MCxvsmk8xLZIsjftS80Jkd1IKIChRNAtKuDPso4Qu5IwK62Ms75pFd77G0ind5u+bVWCpTLZMJHTOASg9r5NrhAbYU9kzuaj887qeSKSdZT+tLU4QNX5rh8lZd0syPa2iH4qP/fx5Nh9w4hJYt8zspzXFhINb5zDzysCspuTvXyhOXUSrZEPa2PgvicKaUJpARC2ffu9TqxAdH82fDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DyRzY/fIEaVwU86yq9iU6ZmsgRtYc8k1JF0Q1WlVzNs=; b=suJutbJcZIcKG3Deg7DUVGpwMkQSDBw72X5MULJCYyF1PqLxUKOGDLkSb9Nc9Pd3Mwe27+8WBmDX3HeWp3B2cGi3+yYV/CXZSmTnKe+dSOZBaDDncSTDWixN5zutyk3K1/PPalLyMSsJnRZucT+29VEW4HgGlSMZGcls3JeYdyI2h8Feu5ZVm4OonMib+9MN5izFD+I6glJ0TywD+GaTcnlh+pFn+QonmQqTL5in8OfSoZuj7yhvKbXt9Q6fEvFsmQU7bOoa/+mAH7v2MTAWYsEgYRC1gjBaNFgWzrq+cfOqv5mi3e6n/lpWAajRaIbfLA20NZf9Abcb4krWEYaaug== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by AM7PR04MB7045.eurprd04.prod.outlook.com (2603:10a6:20b:11e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:23:27 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:23:25 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 13/32] selftests: mptcp: dump userspace addrs list Date: Tue, 28 Nov 2023 22:22:06 +0800 Message-Id: <6f7bae86eeef8d7920d9b82425959b876af0c105.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0040.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::9) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|AM7PR04MB7045:EE_ X-MS-Office365-Filtering-Correlation-Id: ea4bcf4c-4fef-4faf-915f-08dbf01d955f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z03Va+TarCBgbPn9xb8mFAN/zBYQRuj+iv8EumSFyg8c/ZbTx4TyLGLM1hTRS6V/1h+x1AsoaEdV0TXh1jaFzL4JpYdY8tq+2HemsDqz0nAQGFtLeeVQ4yUi4+arqbHaZu9p8vXC0RWzRIoE5GnAa5qx0SttssTO/Xk6qj42Cp3oY3BvYF3HNHaIgK87n6Y8THDGGPeXsWXsfvkzrxKyGsraLfoF16a37uhB9ZNDcDHTJfXS3Ax2f6AmEQo5G2e3n8LkKFE0r7vae//0ELmLiXixm0owVZSKcvlmCf0CVY8YiJ2nQ/GUtfAWx8Ux6MdI5784aSIjIujTYZJW/DyYDLZrMcupS9MJevB4yMXqNAmZQBgYoMk1dZzGOy8kuMveYasgrgykD30WtbUb9nzl4ZbWHm3B7KC2kIY40gXIdIyBS45h1xoYxxoYRpR9PRP74rRaHFPORJ8sdY/Xqh8L3ueIdXSlfhy7I+ZdZVnZ2qREJ1kIQ8Aqn3lLYEgyrTXqK0kOHPm6jhQNnoXxFXQDFnLdQpuxNqll05r/NdQPT4an00lMLfV9zflS1+0wt1Sn X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(396003)(346002)(376002)(366004)(136003)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(6916009)(66476007)(316002)(66946007)(4326008)(66556008)(8936002)(8676002)(478600001)(6486002)(36756003)(44832011)(86362001)(5660300002)(2906002)(38100700002)(26005)(107886003)(2616005)(6506007)(41300700001)(6666004)(6512007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XZaXOXw7p6sJheDMb/KMQep/RwNH2rgJA7gRnEhL3j+gg8q1/zNzh5kcxyEZXJD6Afm7HjHAyMeSSI1l2UWz5oiFWWBRjWP/eAdIa999XPZgaTcqqM/MhETvdzVsUeqLjoiR4mbvmvWkieeppbXncwEzGs3F+/5hiKa2vjKyu3n6FxIQm5cywZHEG2EQrLX0HDGubVYoNK4Ew9OZnOcHUnZKrLeSHpcqgzZ19Y/+PyTqgvBr7byM5H/MYvisGzvn+2/uXpdYYklqcKNrd4d8wHRYp5+T/gldJm2mHV/uairCrmL5mCBiNeXq5qy7CuUNo6G/0pS+dbfDfC1zeQnT8nzPSxV/ntQIOXnOH5hERx6esufmr/NejpzGQBchAk2Hd/XZ+pTlxBxFPtaOwQdIVWbvp4bdY2C7gewYrGYjgigEr2CZhrjRrOtIhXfYQWElAd5vAkW6rdcwMA2i5wTWWgZQBElmi9PpPukl/36WgtZO9GkRUReCi25Epub5WvXXx3jRgImno1WGgWuAGMsIQpw+zsX2NUhyWL1FDwBeJhwqtOK4VUibrluzSU33ZR0CBJlCZtdjKxjleHn5fw76q57RoZcp/JgHUF2b3/EMt+3nJqTepvyJK4rQdkRmd5QPyasod0IilEFTmm2tu3ldnoQqXM1ITCpXEkka1UOlIcl+KZdksqAwFmCBIKdqrGGnqn0FYJizKl+qj+nVTsJlMgLiGtSSgWV1SWfsW7t4On50tHt/ZwKPIGPQ5HKeDIH+NNhApZmAmB8PWJDAmACx5FNKhTrZIpml9pqV6lYxT92DzGJrk2k6AkqVXqPyPD2UYO1aIdmAPrshXKsYqaXLnEiEC4h+8dOaxtWdee4uoCcI3cTvLH2ssZn6+VE5IcMu7l2LBF3BquTzafvVVEl0i76+Cga2OrWc/h/+O/ocpR2/bOeUn7wCPsB0+AtXLAm6scnW08mvUDzsyFyaRpH64Inu4JctV17Xz2lKFQRcHqdJ9FSzdTsfroQe8pYJANoJJIGLlaAqJmJpvNsHFhPpJdlXrNyVLHREnB8szMwxrzZQ3p1L9nb2BS00RFnIUTR37HPNW8iTuIqozt9UH2Q0EVtJ1Z0gyuQHjc+OO3YApo1fnGoyZsscuqR2+mY9+t1XLw53VwOxTEU5P5e5SBaqaVbG6vIaTnjl8iBKkFIGqgzTqpSIPx/mirltpz30+VRTSTBNFXxlCgw3ag8xPKKw7d1tI5PWcKIAgPe9CEYfDqv9iNleJPIS/o3uUyf/OoVguvvMzHka7NZXn8oiiuk6Ph7RVSGyq24rMkMblpW4qBibnTBAK+GfDDpKkqbz+XFZ5vsIG0yLRNlTgO/DUlKzSvcptf0kSlTz1mYDKjkuySJcwWJwyKMzdxP+wLPp0vlE9X+JdFSB+tDY6g3yHbZfet2z1y+xqAoXGfb1JzasSR3psscwQL7EFbxrHquu+mpAzg+YbrekW7Lx9O7nCH2MZE+6Px/LKsTxWLbwTPO9rw27PTWFeJU30TifoApwtz+CvBBsybGBZbN75bvd86k7p1TqnVqz3/dJyXPloY5aEFiMGY9S5P5/gSr5F4UXjwsH X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea4bcf4c-4fef-4faf-915f-08dbf01d955f X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:23:25.6189 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: egaz40bK9Id8KCqRFGKEnaOPv6O8wqpEYz2hcQDDRpe+AqVIOWntgE6svHGp+d7Ddde9X10fRVGtXcXetugTuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7045 This patch tests newly added dump command for the userspace PM. Add two new tests for userspace pm dump address and subflow. Use the helpers userspace_pm_add_addr() and userspace_pm_add_sf() to add an address and a suflow, and use mptcp_lib_check_output() helper to check the outputs of dump commands. Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index fa67c833f91f..574aaf5372c0 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3510,6 +3510,52 @@ userspace_tests() kill_events_pids wait $tests_pid fi + + # userspace pm dump address + if reset_with_events "userspace pm dump address" && + continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then + set_userspace_pm $ns1 + pm_nl_set_limits $ns2 1 1 + speed=5 \ + run_tests $ns1 $ns2 10.0.1.1 & + local tests_pid=$! + wait_mpj $ns1 + userspace_pm_add_addr $ns1 10.0.2.1 10 + chk_join_nr 1 1 1 + chk_add_nr 1 1 + chk_mptcp_info subflows 1 subflows 1 + chk_subflows_total 2 2 + chk_mptcp_info add_addr_signal 1 add_addr_accepted 1 + local dump="id 10 flags signal 10.0.2.1" + [ $ip_mptcp -eq 1 ] && dump="10.0.2.1 id 10 signal " + mptcp_lib_check_output "pm_nl_show_endpoints $ns1" \ + "$dump" " dump addrs signal" + kill_events_pids + wait $tests_pid + fi + + # userspace pm dump subflow + if reset_with_events "userspace pm dump subflow" && + continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then + set_userspace_pm $ns2 + pm_nl_set_limits $ns1 0 1 + speed=5 \ + run_tests $ns1 $ns2 10.0.1.1 & + local tests_pid=$! + wait_mpj $ns2 + chk_mptcp_info subflows 0 subflows 0 + chk_subflows_total 1 1 + userspace_pm_add_sf $ns2 10.0.3.2 20 + chk_join_nr 1 1 1 + chk_mptcp_info subflows 1 subflows 1 + chk_subflows_total 2 2 + local dump="id 20 flags subflow 10.0.3.2" + [ $ip_mptcp -eq 1 ] && dump="10.0.3.2 id 20 subflow " + mptcp_lib_check_output "pm_nl_show_endpoints $ns2" \ + "$dump" " dump addrs subflow" + kill_events_pids + wait $tests_pid + fi } endpoint_tests() From patchwork Tue Nov 28 14:22:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471248 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2049.outbound.protection.outlook.com [40.107.104.49]) (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 A18C635888 for ; Tue, 28 Nov 2023 14:23:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="VT+RIH6l" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XQDe5LiwJ16pQZHouu2pgDdErAeNMw55tSYUT9aK3Jn4lPVFGr37rSBLlRwzhlTDHeb39py8pRlMlHtBxN5BMTwlTTWbBiq0iqpD2SDQkRrHtuFcHbQB+ICLrRoaI53m9Oe3JhqTIw1mn7STyOgHED5rFkNMIU0tuPJlz6Mn60cNbPgHbwfeHzfJ0wDQ0CSsMt0VZlTl1Vacg5BTC1dPvdEEw2xiKdfQKD1pkO+oBSUPz+C1NurMe5XaOjx/HgwZtfK06mnprk6IY5GAZOUGXm/lAPJLOcslOTZkHbC0yCh7OiEAakvNZMOpNacZOy/LwLk5u01clWziE3VXtJdsHw== 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=e8cF9N0Tt7Wm0hCVdx2El5/WoarZD0AglWoxn39IpyU=; b=SYMw0y6J+k55mekfUoeb8XPC7KgDXcM8CIe+cpNwmlSOyLXzW7gXYWrVi71Sg1s0li9fwREH7UqyuWtZ65l1CV77DG830Dk0g/rcv4k8j7Dq+BHr2RnyHlyPDFRe2Gnwy05pjr9TC6m5OQkyjqXNBuHd4gG/iIe5GYY7ES6gCNMRcotQB7MquKzgp6bcJ16+jodSBB7gJ/c16UsWSIX+TEKDe/o52Bumi2KCH68cWKMfRA38bRzxNhKfkNOZ0M7Wx0+VXpBHe/AYrtuWGSLuSO6TB0uDYAUqY3WSkaU5SBvCshRedqpaipFzQZ3siWqDH4fyz0VtG06mUMMohar82Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e8cF9N0Tt7Wm0hCVdx2El5/WoarZD0AglWoxn39IpyU=; b=VT+RIH6laBkd/dly79zS3FraEZoGeVZDV0l3iiCuNE9/Ydz3xcf6iIHCe0EdCOQm9my8STD73OEWQZZyBJfV59a3b2v8Keloqo84Zl4KBODLEyANU5DnKzCXEgNUAEXjaG/OdJQ2BuVWfbB/XP5FlZ6E3nrrzuq94SxnxBv9iCI+1MKafHHjhISABb9UxuP1o9b1JNmg7QV1J6WtwQft6vSvHde6R2MfM8UhN5X5EWOd+UV3Sw6b1scVCV/9hvFkXiqiOCyR3eNFDaP3wC7zi3+tVjxvJxPrmdzLeXq9PtwWK9T40DSm/6UqBP6bxsHOImnKbb7RTJHF74hfzGpgig== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by AM7PR04MB7045.eurprd04.prod.outlook.com (2603:10a6:20b:11e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:23:32 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:23:32 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 14/32] mptcp: set set_id flag when parsing addr Date: Tue, 28 Nov 2023 22:22:07 +0800 Message-Id: <37db3134b7a5442dc2af408d8a2ef10f11b286fa.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0037.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::6) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|AM7PR04MB7045:EE_ X-MS-Office365-Filtering-Correlation-Id: 38ae5cca-7a8a-4102-a5b5-08dbf01d9945 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1wL6RdTnetMRhCtVeOdwMhj2w3qHPyGxJXiOlIKTj4YRz4GO55I02OnGusp1Hdf4JMQDktyFpSw+KTep8b5JlsEr2ukg13z5FBjXs6+btpJDNCYKMAx8ea0ZzNe811lnyAWYm2mI0ebLDg4HHOkCYG8fHHS3bCT6LXSCAupCtRHywkk86sYkFBJ14q0hQ5wmqccHHjNtz0hJs3hjix63j6kcU6H6ZiLVENAfV8VLtMY5lBlQEb0CRQz1JaX1hWX6WyrnWneZXNutcWi/w2FJT0qVJQIlt6zeb5O1sbIfM3IW8iN3+o5rekxe0lB/ZpnbeZilFp3HPQhMls9bEl+ujehyEGjCmR981NkLOrox9rbYvpPfuYUUWrAhLSqFIWKwmvYDcdTi5b0Am83dyhcqjODV1KOB/YodDf0HOZWSvGHAqfrZXSdbc28hYdIPE06lxOjv6nFOsI5Cz3+TNHAP6RvwdZQZ+2MIa6U9iE0tw/cn5x6pcYjAZmKzfMVrVpv6yNoz8B7wa7IwLjh+CjuBmrtJfAcr6nqtlhFruommznKJdQarsMwM7AFWMpg+qkb4 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(396003)(346002)(376002)(366004)(136003)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(6916009)(66476007)(316002)(66946007)(4326008)(66556008)(8936002)(8676002)(478600001)(6486002)(36756003)(44832011)(86362001)(5660300002)(2906002)(38100700002)(26005)(107886003)(2616005)(6506007)(41300700001)(6666004)(6512007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VDc/mGadmQPJnCi25mVFYcNUyFg+s47pg3n81QdBLy/9krzCaWQmBGwYDDRseHo6ughfmVGPd9Cf1p7X50MTbB1RPpXaOkSX5Y8F7b64v/JFiYq3XmcznnZcXTJOyrvcNwPGJhGqfKrAJcXjuTWoEM/3kVLTR9oGwreIOAokVFLiaRKGb7I271eEZLrViV5YSlwbI3HEAoe9Qcza8mlQFSMjHi+hWwJaWOh6JNJRh8Lv7oaGYaaw4jpnidkxGIIitVEfnsSbsvLwtFD9qTYtSDTX8UgLzz3wWftq3CSDNt46u0PcCGitUA7AFvBy8WqfuQpAABW9z7a3RiWp8ZLt4UEMmbpzCWPqepJ9jrjCqyQY7kqTTqVbuY7HOP6FETOfOoLINW88zjeNgxchTra8OwgU0Sh0rq7WtmycURj32hyGCd2qcvAjjsNDgzCdgK6WV2G1s5REGdPgIwNYIQwu/0rJj1aIsvHTBKunlkgais3umGat/dENc9W3kVh6tiEDnC25aklRVP9t+O5c5XjtaQdEIMLwQ6aADo+wPdJitS/bqvexJjoAr1MA75vWSJeuddX41zJilNGKibUOMx5hB2tlFRWIcPqCmEQIhOFBKlvWb4wvqQGiafFHwk2oMQgcBC11moh5zi+oW0ivjnHoliOfb5GEsh0So63joPCqM3EqxmnDHsVx8ESRU+3a5dnPLU5BsoXbb434iXuOVdTPeeRmiSR0/jCyV4W9qzrb7w1w8o3tNxnTrqGT4Hpn/i3RLzWzG01krXd5+bA7OeTd/0pcwiXDb6z4LwoWZDfY73uQO/POsu3MdUcBvbvBMygyWYV9OYE6O7+XVhHBXtljMIfygZty2Z5O4NZo67HZlmpDuebwcwOsHyLl7Wq5f5/j/FeRqnACGXPZ2EWNh4xPwee5xjX9YE3K7FHTe7uP6Xmgb5fZdocJxeLikpbPVpJIDSYH5fsEXzo8zVxDMBmr/m15kYN+4amK2D71jL9J/QPfnRLHS3CN648O823hRYbGElmsC5Nz1zx8Yyc1kPui/3Jhr9VniKjS1BjTetDykYLXnlk+Nvtarh4mAJ8GC4zkFHU46tNVaC2jB7/5TqicTmsSqnLe8Tm3hjUvEXML4adrmgZNvP78bmhGAe4FHDmOe8Z1FJcfjLfDuLmu+Ssd1DxjW6Absi1mdb+yZLGrz+vUokRujRfzoI+xDVFvOTuVlr5dPHodKZkZt630g5XrCHVV0mvZFGQQUidnlYy+vpsx+B7FqAG7kQIZAyEqxcj0565GvBV191iFl5npH46gFpHsMrSTszWoZhfgwnlW6CuYCy5PnFkGQxCnbl9AmMFD0NtK1HI28Y3x/fTlSgt5JKOm87PUZueE+KE2tiOfzhnUlvAsWPZGcvea4CZY90CXU9+gIUbmlgfXzskIoC09vAs+t+XGbf+PB6jZ+a/EwJ077+uue8RwMna0OUTc+IViEoC7RRBlprQ4nImSi1qu2wvDNITCDen4Cc8VmSZCbZ9MbyykwLhuZFRx5uc66Bubd4u0FKJwl4IYvZqu+7Bo9suk0efJvPc09Qjb+CUjsPZ9mx07fFcQIxVTE+FkoGoz X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38ae5cca-7a8a-4102-a5b5-08dbf01d9945 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:23:32.2411 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fqF0BWA2RPSIGKEE1MWsToi4Fxo1Y7s0ndPfD85wIqNmnvHxyqaOzRj/NAxjAQt3vzOM4qIpxf9rShB2KYoF6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7045 When userspace PM requires to create an ID 0 subflow in "userspace pm create id 0 subflow" test like this: userspace_pm_add_sf $ns2 10.0.3.2 0 An Id 1 subflow, in fact, is created. Since in mptcp_pm_nl_append_new_local_addr(), 'id 0' will be treated as no ID is set by userspace, and will allocate a new ID immediately: if (!e->addr.id) e->addr.id = find_next_zero_bit(pernet->id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1, 1); To solve this issue, a 'set_id' flag is needed to distinguish between whether userspace has set an ID 0 or whether userspace has not set any address. This patch adds a new parameter 'set_id' for mptcp_pm_parse_entry() and mptcp_pm_parse_pm_addr_attr(), and pass a 'set_id' flag to them. If an address id is set from userspace, this flag will be set as true. Fixes: e5ed101a6028 ("mptcp: userspace pm allow creating id 0 subflow") Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 26 ++++++++++++++++---------- net/mptcp/pm_userspace.c | 6 ++++-- net/mptcp/protocol.h | 3 ++- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 08b4211fbcbd..4db37baf74ed 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1108,7 +1108,8 @@ static int mptcp_pm_parse_pm_addr_attr(struct nlattr *tb[], const struct nlattr *attr, struct genl_info *info, struct mptcp_addr_info *addr, - bool require_family) + bool require_family, + bool *set_id) { int err, addr_addr; @@ -1123,8 +1124,11 @@ static int mptcp_pm_parse_pm_addr_attr(struct nlattr *tb[], if (err) return err; - if (tb[MPTCP_PM_ADDR_ATTR_ID]) + if (tb[MPTCP_PM_ADDR_ATTR_ID]) { addr->id = nla_get_u8(tb[MPTCP_PM_ADDR_ATTR_ID]); + if (set_id) + *set_id = true; + } if (!tb[MPTCP_PM_ADDR_ATTR_FAMILY]) { if (!require_family) @@ -1172,19 +1176,20 @@ int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info, memset(addr, 0, sizeof(*addr)); - return mptcp_pm_parse_pm_addr_attr(tb, attr, info, addr, true); + return mptcp_pm_parse_pm_addr_attr(tb, attr, info, addr, true, NULL); } int mptcp_pm_parse_entry(struct nlattr *attr, struct genl_info *info, bool require_family, - struct mptcp_pm_addr_entry *entry) + struct mptcp_pm_addr_entry *entry, + bool *set_id) { struct nlattr *tb[MPTCP_PM_ADDR_ATTR_MAX + 1]; int err; memset(entry, 0, sizeof(*entry)); - err = mptcp_pm_parse_pm_addr_attr(tb, attr, info, &entry->addr, require_family); + err = mptcp_pm_parse_pm_addr_attr(tb, attr, info, &entry->addr, require_family, set_id); if (err) return err; @@ -1239,9 +1244,10 @@ int mptcp_pm_nl_add_addr_doit(struct sk_buff *skb, struct genl_info *info) struct nlattr *attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR]; struct pm_nl_pernet *pernet = genl_info_pm_nl(info); struct mptcp_pm_addr_entry addr, *entry; + bool set_id = false; int ret; - ret = mptcp_pm_parse_entry(attr, info, true, &addr); + ret = mptcp_pm_parse_entry(attr, info, true, &addr, &set_id); if (ret < 0) return ret; @@ -1423,7 +1429,7 @@ int mptcp_pm_nl_del_addr_doit(struct sk_buff *skb, struct genl_info *info) unsigned int addr_max; int ret; - ret = mptcp_pm_parse_entry(attr, info, false, &addr); + ret = mptcp_pm_parse_entry(attr, info, false, &addr, NULL); if (ret < 0) return ret; @@ -1616,7 +1622,7 @@ int mptcp_pm_nl_get_addr_doit(struct sk_buff *skb, struct genl_info *info) void *reply; int ret; - ret = mptcp_pm_parse_entry(attr, info, false, &addr); + ret = mptcp_pm_parse_entry(attr, info, false, &addr, NULL); if (ret < 0) return ret; @@ -1866,12 +1872,12 @@ int mptcp_pm_nl_set_flags_doit(struct sk_buff *skb, struct genl_info *info) u8 bkup = 0; int ret; - ret = mptcp_pm_parse_entry(attr, info, false, &addr); + ret = mptcp_pm_parse_entry(attr, info, false, &addr, NULL); if (ret < 0) return ret; if (attr_rem) { - ret = mptcp_pm_parse_entry(attr_rem, info, false, &remote); + ret = mptcp_pm_parse_entry(attr_rem, info, false, &remote, NULL); if (ret < 0) return ret; } diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index de10be21bf26..3d4258d2e269 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -156,6 +156,7 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) struct nlattr *addr = info->attrs[MPTCP_PM_ATTR_ADDR]; struct mptcp_pm_addr_entry addr_val; struct mptcp_sock *msk; + bool set_id = false; int err = -EINVAL; struct sock *sk; u32 token_val; @@ -180,7 +181,7 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) goto announce_err; } - err = mptcp_pm_parse_entry(addr, info, true, &addr_val); + err = mptcp_pm_parse_entry(addr, info, true, &addr_val, &set_id); if (err < 0) { GENL_SET_ERR_MSG(info, "error parsing local address"); goto announce_err; @@ -323,6 +324,7 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) struct mptcp_addr_info addr_r; struct mptcp_addr_info addr_l; struct mptcp_sock *msk; + bool set_id = false; int err = -EINVAL; struct sock *sk; u32 token_val; @@ -347,7 +349,7 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) goto create_err; } - err = mptcp_pm_parse_entry(laddr, info, true, &local); + err = mptcp_pm_parse_entry(laddr, info, true, &local, &set_id); if (err < 0) { NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr"); goto create_err; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index c30e59278080..0460cb391ede 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -881,7 +881,8 @@ int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info, struct mptcp_addr_info *addr); int mptcp_pm_parse_entry(struct nlattr *attr, struct genl_info *info, bool require_family, - struct mptcp_pm_addr_entry *entry); + struct mptcp_pm_addr_entry *entry, + bool *set_id); bool mptcp_pm_addr_families_match(const struct sock *sk, const struct mptcp_addr_info *loc, const struct mptcp_addr_info *rem); From patchwork Tue Nov 28 14:22:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471249 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2083.outbound.protection.outlook.com [40.107.104.83]) (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 C2FC435888 for ; Tue, 28 Nov 2023 14:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="JARz7Bb5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XQj8JUFXkOpxIpaBwkUYTq9vqgo6yvjG1ThaT1deFiWiK6fKBQDvUVamziLiWvvdGBdZ9n6pI/KL0WdAB/OE2bzHat+dj3CsmKDSPGYKn6sWWT6jbEl4IqGhbIarYvm4zrOjbrufma04XCWcs1YDfEpjFoXuJHZVKxobyA4bKxVi6R0LjVqpShPaGZn3psYu0ALA5g6XfrteKcLkTykto6h816hTTkUBjrukLN4LQYfFpFbpnFgi9jWY2VaTcZ1dadMTOGdtEkezLfA9b0KRaf7kKe4sHC57weRQH5RZr4m1nAkID2emVr2DB2brZ9OUX0nHIsBM5awLbSF4RSJ4TA== 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=Sv6SbZfaNpoauTaauA4Q4ikrqXjzoN6RyN0lTmIDWjk=; b=dGEkdWrcgfr70hIiu80irjJdBg/8YFfhYpwoUoARkzarZudiVhOueGizqNqko3ZBVbUT9mYJb6lDlThnPT3IqrlTCdbRTDW474MOoZkybcFD0RzDo5yTV27VX00fJszAkbYfG9a785GIA7SAa4AHShfX+TIEyoOB9c187H8WPdKcmSNfesKGN9axz+fZhnfH/xrps/wuAgyKTlg0ExIcHu8FKUbn6L1Z79NFEQlxnbN0YbSeg3D1GBc/XZsS9uBEbkU/4UeUL7QWWY1UBieFP7dv3ZOj3JV/9SVKIIndu5tAAxdBsDs3iug0m7QJ4XzvdJqkQ5mSl+K5Nht5wi9czw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Sv6SbZfaNpoauTaauA4Q4ikrqXjzoN6RyN0lTmIDWjk=; b=JARz7Bb5FHc3QiKp8WCUWRyvHllDb9GzK79+2hCy57SnytePdSt5bFMu6BUhMH2wSLRpdKu+GeVclWQjOxWBNgZtDvJQGIP8ZCxqnpu92S72XMsaVGX6CicVmhIW5f+DI/j27w83s92Ge7bRZ9fE/ZK4zM8MiXODnvDxcAdDMnF/rg86x+hwnby1nwjmzWJVSuzURAe5Wv2TzYMcu2QsrLjzVY/fVuML8uMLmun11fioH/w0qmLwNfcvlalUmff9PG/GW+cLHERr8JHUXwQ3NcJgicX4fiC1Y3z+v3M0uRFhiscK0Eo1UUxQQNd+LRVxwaL2tblY9F4AxUxxLZqsAA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by AM7PR04MB7045.eurprd04.prod.outlook.com (2603:10a6:20b:11e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:23:39 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:23:39 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 15/32] mptcp: use set_id flag when appending addr Date: Tue, 28 Nov 2023 22:22:08 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0041.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::10) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|AM7PR04MB7045:EE_ X-MS-Office365-Filtering-Correlation-Id: 5bf1f41f-a5c5-4c57-ac0b-08dbf01d9d87 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VNVyWa+sHujyGdkHzEDJKQiPU5UQP6+p3T+kwT7Fa/PLwM+opbCKqKzAGKh9X5RyE7i+1a4/tK4Ovr5vxxR01wdoZkmgcNANtU7vSs2NwXyig4xNLYUIXh3uTBHkp3vEOq46GWbirUW0LiXOcSNIjRFiEadsOtLLMewK3w3mCeh9GBe6B8m/NjmEsfu+d1IX7K3p6ik6DLyLR9juyYw1UkFblzfx1gvQ893LVnibkbgZX2o14t/XZ4ioM381iilwXF92y5rKFKPKKxxopC7OAqfOT+fca9A6xsxb3GE170miHZZXC9DpWs5zlRXoDud+V89KKvP/7sxiNKEcUSkVXQRz5Gfs+oqwP0QCmjBl5bwWlwL4L/BSgq9r/8NHzC1H9bQmhNaHfVWmmN/Fs1HYIUVwtKoU9ryLI6qP7eKYDX6B1Rt8YaO8wHPHboPnMgBPd269pyI6TD/O7zfp4cOapDYt3gIV0przkByf8qAmMuoley7tGksTUzWYXRc3XZPwBWOcbyA2wYLrrvotUOVW/oVdtwvjpt57fsA8pA4GDNP7xNWy5jeiARozHmk6x/+O X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(396003)(346002)(376002)(366004)(136003)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(6916009)(66476007)(316002)(66946007)(4326008)(66556008)(8936002)(8676002)(478600001)(6486002)(36756003)(44832011)(86362001)(5660300002)(2906002)(38100700002)(26005)(107886003)(2616005)(6506007)(41300700001)(6666004)(6512007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lUVNj3kBAZoJ6VK6/2qgprjb1ec5hXI823kZkarfviNkpmgJZ2moWVCpxD3j4Ou/si1lZTT9OmYxzu+Lcc71SZeztLmbnnx116Oke91WtPKaYOo25XaK+8A6BVyArvWq9DQPVIUpuAEEAyt4MzO2z6TIfQ3kh+oOq6S0USBVeyhcW3a1OTBYDqzQ5YzQTE6jdoMT/I83nHzRYwPenwyRrBgtH69qG3qy8UgScff3Yh5zfGIBCjGXHmNX8YED1TLeLvaRilZKuFUTwvT9uXwxjg82F781oyZi9OR1DCSaIuPaulyS3naEnZG3yJ1XGHOf/AnsKOXwDpViUfXv1y0we4+xxtMvC6zRFwEAqOR73ZJ1VQ3WWMbIfLcNRduFygObCaf6Vnvzr2uVu5bsO6C+0x7sTLu/lksoT1Moo4cEQ7Lq8bpA+oDzdYfCbQ5k4nij8L9i+pyu01WUfWzMtIQQhUxMfDi1TRCXC1hPytIDqYxPY6rMIVlvfRA3mO4Uh1h1X2IX/j2psi5ou1g03nTqnA/Jgy0TPItzpcbi4FdeiLT1lbB43HNYb4nSCidxppni56YYfFdU1sm2pRZN7144f8qkqWUxxJeb8dtv7oOToB4+oz3Uhk0zUycZoMdxZgcyAWxGpHoaSL1a2iAx7Qv5LF1VUBRIQOhiW3x1BGKJP9rdVAbbDXuT+0eMrXQ+ZtDI8wORLKs2guoBJMpRC7DPWwQvrRjfMas2Y5fNszzXMQjt0CROvLLBfuVOAWRNMLU9f8NoZEP/NpJf5MHSq+qfIMnYg9R+yc1SOqrlN0EMQ1a6id1HGpqVp3eTG7TkIt14p1Cq0SKHpHQlfGTlBtqTaIT0OJ6IP83XI1sWUhc50OkK7oVpG254QAEAqxb9loUI/mijbSMe93lZekReZi2EWbIo7Lyoxy7cV5nJOo2L6frer4TuacYqcdVoTvvWx2nKRr7fwt+n/FDGdtg8BOu6nXbok7spOoKp5+FkqIgZ+y2eud3fK8PIJLhusIy2f3YoznL64MoAC2neEfeRpp6LkLxLUR70/PqdjdHwuT4/f1FGj676vY6SH/kp50U/PZWBsx/e3VCnQWBucznr8dHaQLEnwSSyANgau7F3lZYIARmC5rMv7qNa2KXF5+O1nVmrsOEh/juXXJB6gS9GPFLCj8FOnp3MRG78BhqaaDe/EkSoPuBgsE2aHyBdnzgRag2AewEkQKctRvN9m4DPHC5Rk9d3W4I2fZhS/n5mAc+GQPAeDqYp3cvQ2lYJvh2mRScYleXDt4PpY/zKSskPyQLVpHC9KezUoqSSy8xMAEOG2cjC/v8DOMcVFD+iuPjtRwTLJ68XD4I9VEc37WGZzreybJ5aWMESFP5m+CBSQoXzAEd4MyxXZMvae3jidXxZ9UITx5TB1q36m2k/rRRroXNz4dVCxmdRCRXDbAhm2Nre8+GDISu1S1+UKpmCenSW78KsG0+H1T4iYqteeCKq0Pe+RjH5TkWMoXHyl3JzUostmSSunIo8gVEjkljSvM3nuwDjN72D/xhEtEmrnnCZ7WS1hg2WASHLMiI+ebcxfAZh8FsYEgPwoREYcMbZcdGXPD2s X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5bf1f41f-a5c5-4c57-ac0b-08dbf01d9d87 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:23:39.3731 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SJZf7T6ubo5cYYekt0u84a/vihQka4tPs2wUjUYrXI9uY2nfpEJj9q6yLAbTMi65eg6NDMyMZVztcOI3uIIx4A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7045 This patch uses 'set_id' flag when appending new addr, adds a new parameter 'set_id' for mptcp_pm_nl_append_new_local_addr() in pm_netlink and mptcp_userspace_pm_append_new_local_addr() in pm_userspace. Pass the flag 'set_id', which was set when parsing the address, into these append new local address functions. If this flag is set, do not alloc new address ID from id_bitmap, just keep the userspace set address ID. Fixes: e5ed101a6028 ("mptcp: userspace pm allow creating id 0 subflow") Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 11 ++++++----- net/mptcp/pm_userspace.c | 13 +++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 4db37baf74ed..cc4ac206f848 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -855,7 +855,8 @@ static void __mptcp_pm_release_addr_entry(struct mptcp_pm_addr_entry *entry) } static int mptcp_pm_nl_append_new_local_addr(struct pm_nl_pernet *pernet, - struct mptcp_pm_addr_entry *entry) + struct mptcp_pm_addr_entry *entry, + bool set_id) { struct mptcp_pm_addr_entry *cur, *del_entry = NULL; unsigned int addr_max; @@ -903,7 +904,7 @@ static int mptcp_pm_nl_append_new_local_addr(struct pm_nl_pernet *pernet, } } - if (!entry->addr.id) { + if (!entry->addr.id && !set_id) { find_next: entry->addr.id = find_next_zero_bit(pernet->id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1, @@ -914,7 +915,7 @@ static int mptcp_pm_nl_append_new_local_addr(struct pm_nl_pernet *pernet, } } - if (!entry->addr.id) + if (!entry->addr.id && !set_id) goto out; __set_bit(entry->addr.id, pernet->id_bitmap); @@ -1041,7 +1042,7 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc entry->ifindex = 0; entry->flags = MPTCP_PM_ADDR_FLAG_IMPLICIT; entry->lsk = NULL; - ret = mptcp_pm_nl_append_new_local_addr(pernet, entry); + ret = mptcp_pm_nl_append_new_local_addr(pernet, entry, false); if (ret < 0) kfree(entry); @@ -1281,7 +1282,7 @@ int mptcp_pm_nl_add_addr_doit(struct sk_buff *skb, struct genl_info *info) goto out_free; } } - ret = mptcp_pm_nl_append_new_local_addr(pernet, entry); + ret = mptcp_pm_nl_append_new_local_addr(pernet, entry, set_id); if (ret < 0) { GENL_SET_ERR_MSG_FMT(info, "too many addresses or duplicate one: %d", ret); goto out_free; diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 3d4258d2e269..c9dc25fa8540 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -38,7 +38,8 @@ mptcp_userspace_pm_lookup_addr_by_id(struct mptcp_sock *msk, unsigned int id) } static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, - struct mptcp_pm_addr_entry *entry) + struct mptcp_pm_addr_entry *entry, + bool set_id) { struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); struct mptcp_pm_addr_entry *match = NULL; @@ -51,7 +52,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, spin_lock_bh(&msk->pm.lock); list_for_each_entry(e, &msk->pm.userspace_pm_local_addr_list, list) { addr_match = mptcp_addresses_equal(&e->addr, &entry->addr, true); - if (addr_match && entry->addr.id == 0) + if (addr_match && entry->addr.id == 0 && !set_id) entry->addr.id = e->addr.id; id_match = (e->addr.id == entry->addr.id); if (addr_match && id_match) { @@ -73,7 +74,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, } *e = *entry; - if (!e->addr.id) + if (!e->addr.id && !set_id) e->addr.id = find_next_zero_bit(pernet->id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1, 1); @@ -147,7 +148,7 @@ int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, if (new_entry.addr.port == msk_sport) new_entry.addr.port = 0; - return mptcp_userspace_pm_append_new_local_addr(msk, &new_entry); + return mptcp_userspace_pm_append_new_local_addr(msk, &new_entry, false); } int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) @@ -193,7 +194,7 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) goto announce_err; } - err = mptcp_userspace_pm_append_new_local_addr(msk, &addr_val); + err = mptcp_userspace_pm_append_new_local_addr(msk, &addr_val, set_id); if (err < 0) { GENL_SET_ERR_MSG(info, "did not match address and id"); goto announce_err; @@ -374,7 +375,7 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) goto create_err; } - err = mptcp_userspace_pm_append_new_local_addr(msk, &local); + err = mptcp_userspace_pm_append_new_local_addr(msk, &local, set_id); if (err < 0) { GENL_SET_ERR_MSG(info, "did not match address and id"); goto create_err; From patchwork Tue Nov 28 14:22:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471250 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2076.outbound.protection.outlook.com [40.107.104.76]) (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 86238584FB for ; Tue, 28 Nov 2023 14:23:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="YBJ/P1qj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=juixdkM2saBf94gGmChE/MT/ib/axjgi3c1fXliB4IfwyPvicSfRt/rQh8zwrxeX0L4a0PEPDpkyjHpWjml0JQBvjfRlkCpkIfpjPlTSgpfOv1MQLpOrCJGG4YU5V3gDjZefhNLIjHytb6ilLvcfAUp0lK7hBXlhbbDypAiRMeFYu0/204ddbvtiocMA3olcjvbojZRboiy63J6F/LuTzWXqj+gaZoVUaFR00fZzDdKwRv5p6LDzytBpwCEuYUxfci2EWfXl+3PktQD9qn6Ue/wmXJVwPBCnmZcw/nvIxjDYm+fU9mmNE04sGqinKH2yCXWowKyOvBghW+N4lMbgsA== 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=+W/0yUoZ1wnZFt80IkvapzV5PXq/PasaOPYw4JO1yqA=; b=DKn2qZ98KGurWwpdDmCSScQ5HpWSAmFDfR46S6l7vfhx/V+N2AekrVrTeEoOKCSHB/eFOzrt/XbrS4YIxFVJZ0TDQtt14Ok3/qQB1fb8kp1BwxMf/9+myTbd1WXfCs+3roEgoBDMeHng4cjT7PyG9638PSsc4rKdLerrZ6q1Mc4E3bZ6CE3r7waOjalEmG1wB9vBoJ2uceqzXjAEAcVehNji8FgIQraohb5PFZDH2laEqA3s8Guww66Kpla8zfg+/6pT8iT9vDovzSzTEKNIIzlwvAxwL/N00p7MQixH2+0czTSvRyTZ7ABv9bhmbjSFr1dGs9Qo1RnU18aFcxd4IQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+W/0yUoZ1wnZFt80IkvapzV5PXq/PasaOPYw4JO1yqA=; b=YBJ/P1qji48U0IioPHTtBwL0sq2OgnXyecU6mnIjo5dLj6GAuO4gy7TJg2BcGbOJL+EI1jH7a52hqBzSFvoNF6d7gxWxC7bkLOx6+2J9n+d32qyoPxiT7ili/hZ7CtHhuxFJjijfNYk3d4Rpr0E1M769hRx5FpL1E0r8mFqLY1hBWr2IOXQIU+swzVrlb/uQbq7BCnhVZ+f3je1zkgnHGs0hqYMCThtbgaprr1lh/K8SCbIvWYRfeVT5pE65qnC2gJ8JPBMk1WCjiO0sZu7gUvItsJ6gM+aMLSKntWzmm3S/wOiLgbKUSakU0aB4cDVcByh29InYd8jLP0iPrgTUZw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by AM7PR04MB7045.eurprd04.prod.outlook.com (2603:10a6:20b:11e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:23:46 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:23:46 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 16/32] mptcp: check addrs list in userspace_pm_get_local_id Date: Tue, 28 Nov 2023 22:22:09 +0800 Message-Id: <079ceef62d67b91b32aa67e38f026f5ed9f21956.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0054.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::23) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|AM7PR04MB7045:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e8a765f-bc94-4f2b-743c-08dbf01da184 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3gbm5vnm5ZIR+LjNk/ZWkwwo519zHg2wHFmVAUOagoqFQ9on5SadTqySqpR7SkjLLpivUW3QgSk1MXjiNZXZkxtm0TptM2i8xHvzeD4vhpCPbCmkBtDf9wjJHRDK4V732SzO2p2Gk4tOX7YuqBy5qxaqlyrUOkG4rubkU//cbhlk7/4Dc/NUbuFWprmpt74QozeBUnCJ2Ug67taXWQo3Ov7uJhwREMxXaO5y/4AErLfxV4+2j0Gj75PWnbXFojJjGNSBza9aF6nYZKFKqegdcwUxcoi6LSo0Kab09VT9fvSdwG5qU6eJ3XomFbEqvDjOdiyinHD3u/a5ckMiB1dU8cQchgHbvqrtp70vGAsxKDcLFPTHfcOdv3Q3e1GLpzeqtJ/SMwC09u5K9zLpPvsKgekt2CS286Jy0qvXwY+fk2o1V58utKtQCvhbXhh2PY9lddm9smwXLDhZATle2SoTcjPyc1trz8vC1wJ8i01pTKGxJUd7jIvWH6fCOx2MomZJ4mHgr4q1RG7pt+6ynFD8AL13JeDVmwCSvC3tPLyu2TjGl4se+UB7hYgry1L+/BiM X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(396003)(346002)(376002)(366004)(136003)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(6916009)(66476007)(316002)(66946007)(4326008)(66556008)(8936002)(8676002)(478600001)(6486002)(36756003)(44832011)(86362001)(5660300002)(2906002)(38100700002)(26005)(107886003)(2616005)(6506007)(41300700001)(6666004)(6512007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RVFDdZ1gfqEA6J0uInJ4Ok1AdZFel4EchO+nTOnUBhVLTN7/mu9uzbm4DX316QuD7nyKBEPFaLDjFvhy2bRKJ6WvPcAYNdEPZ6GbQGp4WsmD7Pn7W8GG50JI7tckhe8ArZs0moND2LDqYMCDcnkv0BhNi2a1Lf/ZI6+NLbwUTrVIxzP5JehnPY57N3elg1Y5i2S/czr02ZR5xzhxBRUg++bLXdmzBH5GFz+gqor6Qejzj0FCIgaKmGT8MyImuKt+nezRaYcQq4xfYNddhlRJp/lmQAdUMg98m112lGAdlI2bwAUdUAttxkhpdjxJbvW/3th1jqBcrQCqZ8BXyK6DvvB1u2Yl5hxg6+VWyLXe/6o6GKvXKesVqseBjsNEPxzEA0J1uGvFuie6EgZwRAGs0L3iuxZAVtLM7tBQt2VIS1vGftzHdEVSfmT12EDDkvxZ8oyOKx/4dbNOx78rdsmn53lcX45melpjmp6zGqHvM/EUY+w/GARzXghMWzyPtHxPfeSIKCIteA+ZIILUnG7Bpb1uhl8scYA3ebDKM7VUBvhqsHEb8zDHASRlzDQa2fE55+RpW4MQin2AJF5s6ZQJrqKc7mwDjctDGjTpQ29ixLb1UHWSa5Df1qKcnMQTwFcS4bdodq76LEn7mr1nLDkiIZm/aKHXVD7lLDA61rQZoYZOnjUDa5YbUxSLllhMmJ8gLhz5t1sG388ter9HmsXe753a2GFPJss3+MEPR9PH3ooP7MVWJjdrYyflTMNlddT77M9bsBAt5qkkJr2JWNltxEqcLBHqhumsYciBkhLFaBlQhKahWAp7MKQ6Et3Tu/wLedUxdrmX7DTxe7SK4U7FZXgoan90LFOSDOMhY0q3V1Hp7EcUepkLNlj0vVZWK28/bU72UAOOcSiaZQA5enRwtm+uk3bthCz//h1HAUu8LCZYqJPGJC9zsp5ToIo6wEVxOKt2hKTPTO/aqTljK9ye9s6BhpM3KT7GRVj7M96AnPv+lWpSg89mrt9lBlgcmgVCedGYtIjh1iMABzcGHwkgFazJ2yBOnteisSgbvb2L1I01WdS0bj3vnx4DowdNnAj/1BAXTpi22UwKarTqqgzt8ryoSd8LtFXMGC5Px9qDfiPE59+2jqgCiMjhQv4OAmK63UTtOInX7FNTcatHRJatetGl5F9Pw7Ai1CZjuvmebP+p1fa/sIwG3zqV1K/qQiQwnDm6kFuhwaFHBr1j6bDc5slqNq76Ty3Cwr0E9AraXvYiWvnrzFTarOA2dB/J5DNHKV6X68A6YJbcV3a4FzZuZFuR+6syi+3z0DPoCwqLdJQe0wj40w0YLrF1F5ua5jAHqgNihsf+fFgOOMDJyoEYxVl2hZsS/dFp8u0pvc6Gn2KMmM4LUt/j3VR0fW05diHeOy6lwnjWnpOOoSGVx/JOlkqch0gf9NcwkaPbRR5BfuHb2CFEbcbt3q5doPn1BdKpyaFRNTE4Qa4DTKEEaAza9qHEMFqo448ebLbut9cAAftlMLqC00PNkhm71nmdcE5PxK9GsIU8xYUNKtg88LCzryFlt/WHgzcTEcO2zhzR13TOlL5Kvlm+jGNO16OCaHFg X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6e8a765f-bc94-4f2b-743c-08dbf01da184 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:23:45.9195 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6pYzvccNQwJD3T/06bgPYLfuCjFkiJJSGgf+rPyGg4opJI5eDC96HEVKpCQcXv3LvAQHDMY24WKcrMaHuZJqAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7045 Before adding a new entry in mptcp_userspace_pm_get_local_id(), it's better to check whether this address is already in userspace pm local address list. If it's in the list, no need to add a new entry, just return it's address ID and use this address. Fixes: 8b20137012d9 ("mptcp: read attributes of addr entries managed by userspace PMs") Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index c9dc25fa8540..489bb0e61118 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -136,10 +136,21 @@ int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc) { - struct mptcp_pm_addr_entry new_entry; + struct mptcp_pm_addr_entry *entry = NULL, *e, new_entry; __be16 msk_sport = ((struct inet_sock *) inet_sk((struct sock *)msk))->inet_sport; + spin_lock_bh(&msk->pm.lock); + list_for_each_entry(e, &msk->pm.userspace_pm_local_addr_list, list) { + if (mptcp_addresses_equal(&e->addr, skc, false)) { + entry = e; + break; + } + } + spin_unlock_bh(&msk->pm.lock); + if (entry) + return entry->addr.id; + memset(&new_entry, 0, sizeof(struct mptcp_pm_addr_entry)); new_entry.addr = *skc; new_entry.addr.id = 0; From patchwork Tue Nov 28 14:22:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471251 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2049.outbound.protection.outlook.com [40.107.104.49]) (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 3419835888 for ; Tue, 28 Nov 2023 14:23:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="O1cs/0BK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ij2ieSX1Fz2iddc86+goJ14ftCRJdoy6IqNRfmU0RbDEHrWdbvfO+i/MF5nLzagQ2P833eVA50Qwn0CK2lHpfLDLezPiZv6ufA1CgomGz0eOg5jlNMSQFPs1NDo51HvkqjeHXvblQArlVrzrlKlIFF4MA3LXYJbM2Sn9hIzySa9gUbdMgUvP6KZ8c42UZkGJL6qqtnzekP5kc+aBxXYkH6Hvf1OpebyiA/QNPq0aTp5qM0oId92raZbCVOptI8IFr/H5dkhExPxpKGBIGJ0CcLHSpuSrYEjyLvdVc8TXzfJYJTl0LkiOCe//HD00CENDUff+RuXZmihdSis4mYDFHA== 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=w1p27bizs9UmTXBRz1zh1Pad4C1GettBC50AN4T/Y9s=; b=FLlP3NRbm7NZoQ5jgeMyjouvQ50mf2XTwLVdbWrxJXk3+xTTOFiBIWwKL+KZzSJIpOBKh8oZhHEx6NZPFeh+6HNaIWVL4fViI3x443ArTOjGbdnbjtGRR/YshsWg2Vq73TvLpNsMbkaPhbLbWTPQ17AF0ld506z9bvqoSnkmC7Gk4EhAbI5g29EoEKS7HStqz+b5K8bZaZt3RC2hpFrpxSlbL6eXxQ9tMB6GKR+lv8hWy6mz/Yz/L5QSq4adSYm0a2l71thSlG27QCwdLCXEBrVw7TXQFVffUgvKq2S6Q/uA9tpyeOeAgCKMuXyPIdIpex8PjeMZ9vSWP4wdGl6ahA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w1p27bizs9UmTXBRz1zh1Pad4C1GettBC50AN4T/Y9s=; b=O1cs/0BK3BdSnuFRMfa0s3VfyT63hqyk+iVuPIhceg11pO47rf9CHggXFavXK9SOIZInuBD93LRm0rddZQeCmiPXQAYZLT1HX/qiEQcTjui5l+jhxVaDErlXVFfiMVj3S5/xGzbowJyUN0TxTy6u8rh6u2YCJtaX4wtzDGvucWk0yFD+0Yz+/P1FwFePohZmooeTutzVZKrgzn/8ML0ISohXYJ9iNdGnzbWHEKhQPEU5zJAapFPZrDAAOeMCepnz+gNuvzkedSS1ZrAHhm2uxsOQ9dhLbHFk+ENYjSwOjAZXE2Lmpa75t+bPK4J9XzyfSXdR7CfytTmx22N3vaBNRg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by AM7PR04MB7045.eurprd04.prod.outlook.com (2603:10a6:20b:11e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:23:50 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:23:50 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 17/32] selftests: mptcp: dump after creating id 0 subflow Date: Tue, 28 Nov 2023 22:22:10 +0800 Message-Id: <5a6e91b8eab1b36a5a090a089c112e6469144159.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0040.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::9) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|AM7PR04MB7045:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f89423f-315a-4734-7c68-08dbf01da472 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PukoES58MACEOFrAlNnz9N8RpMIxTwq1FbPJL47XIsDvxOX5t8OLhIX7rCyIvrSBNoLU430GwoTOqxKr8jPxT37+8+WZ9aV10l77SujknNu4AvPS0bhomXrBg478NOtz2SltzE1bOvkc6Oqt88MVeSxwOPMTEaAmcjlwWlIcn1xf1htME06xvtPdrgYgOFcjAXZcWHCQ/vR6GY5s/Ou/CLBmwz8An4uKKeykLzNUSKU5uua++NVFvthlCZ0MdNn8KEODsWyhKb459rMsrs8F2k9zJl4XDje1xpsX31fCkG9AzfEFydXq4hpbn64lxZarUrEtng2XH9uXXc2or1LEzbwfwz+hfRH52eVrjf/XqnCaPSHmnbTIn23x3/irDhnHFRa8JQiIKDwKYK/IIcyymQxUSBe/vOn/tRSq9QJbta2NrCBrpAe5j208fBqoNF5+U8scyaCnmioLtLgHo7quLE5BKuMfnAucm/HdpTu8ZFKNScRYj2B2K4S1PFdnUfe9AQa8nHREG2JWSmQaEbr+0DLf75L7j4Bd6oMVfH6wDxyAT9NPyFKiCXnqWSKw0z4U X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(396003)(346002)(376002)(366004)(136003)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(6916009)(66476007)(316002)(66946007)(4326008)(66556008)(8936002)(8676002)(478600001)(6486002)(36756003)(44832011)(86362001)(4744005)(5660300002)(2906002)(38100700002)(26005)(107886003)(2616005)(6506007)(41300700001)(6666004)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VxrH+E87oOtMpBx8h3XoG1Tz3/hlvbZCnX7Z4Kqp08xSnHwvj96KZLVt5sqteRDPsZpZ94ijZi+OyLk56CrUC/AZwu1MXWtjciPddUi46PwGkqOttPj5/XgAKFkoGyM/DzDmypEomRUJErR3Jqh6FOZ/p67v+YdQtTwSEhb2M5V4uduaN++qYPR5XDnng0VjxciBImDgqr/vVIVE1illPflku4wT5DMwJfuYi7/hjfKZ8S93qdtGsu13OYBxTse3EVfVJTNx3zLtpMm10r3IcMa4TRiWw+zTXLFd7KC+oO4z09IUSardrs2QGfhbv0IpPFFk2fWMSLWfQOGjMxnDOpo+EP4hGHnUgE+c+AlCmW6XjvQIhkaE9f/4reILXkOJSiLYNxc1K85EWXIeFfG84CL/rd4W1eQgHzt9IYshFP6qA/D8RC16CwQ4DH8NAcDbeMCriNdgFUAwLWj190A9hqYgEuLolTHm5aQvYhWurf8cOApPj/QRCjIMFfR8SZyTQZSDbtf2sdNK57y+G7aNJZ30g7amUvAFW5lbOW0o4cS4HwYEXBB/kdq1iLzfMdS2+sagl16mJH5w6+VZLnq3cnNnw7YPsnYeCip2+qslnZu3AOLGfqqCxazUlz6p92pFwJwSoQUZlHpmOjE4BLYCsddquKF/0S6gwxGB7Q5qANsC0ftsXmWEl+BYxDN4zsYJMoP+IeUsdi9o4WF5+HE/y9w6YxCKxgEbHKFyuuH68tJPAtieylxZtaGFGj4n6IzKIyKOpX2Si7T7vUFBGG249gKAJXdpQe0wJzfh9OQCkX+XVNnkF2C+LYpq9sKx2PpW+NUk17cGpqi+NbOGFhlYC2xReG4QZXzzCixxzfvQjncGrDQc0j+f4D93oUltatOxu20j/4HiCZZek4QWacSKlnl+KcRNDiyCYnG7UepuxDFnPiT354u/vICAx50soM26WxpMxZ/Q8vsZ6jWUxpsXx1W4HI7YGBEX1No8AV79ArhZ7hinlzVUMDVN0qtUlDaoSt9JO2mcO1yKHef1/OBX1RX03m4UYQJYmZM0d9eHjwN9E5il3T8krMkj8ysxsQMHBLgna5ODgxsuCWum7TMS9e2Ie8fNWkEp7J2XpntZzzohyACJa/aWEbUQ+H0LJhqdfALQIosBSMm5C3WHY9prNkBo8jqc7KRh6Uaq3JZfs37IcjohXGzDVw9iKJVEdskS+FlyHGgFXKdMoZlWgXpnp7o0USR1ok45Mq1y9ifnnT7u8PanzA7t39ptwWWXPeNYR6Y4MF67/ezoh6TTgtMkVKwxRmnhYERZbf14yIACh3LC+y2pww04jlqo/6+T0mjq4fZ+DtNYQY3Bk/haaCEudN3WexrVOf6uvYa/vHnQvzx+WG2OK0oFqG8KcLgpNdVleBb1/Lr3uZRH4PBcIB/LVwzXQOY3/L2httEdduxXX9dV1BOYIr6O9rahCNxk/Ss1tjjcRfrTInqdLg63bHVfQjVtRlSawz4vsHeF7xyks3XwH8mWM4hvKxRkkTWcu1e6QOC/YknTV4UOWJRrS19Qudb7gg4zE2qQWIbabZf6gzRsoY4f7ua9KezVIspZ3+I2 X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f89423f-315a-4734-7c68-08dbf01da472 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:23:50.7744 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Y9m6Ch1ACsrZLZdRw5sE7K3vUc+/vAbSdQuafI/C/TyMXR/DV9SnCzVw4V/DtDlR38iPp1NfU1uqVyLJhu+NyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7045 The output of dump command after creating a ID 0 subflow should be empty. Since ID 0 address doesn't list by dump command. This patch uses mptcp_lib_check_output() helper to check whether the output is empty in "userspace pm create id 0 subflow" test. Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 574aaf5372c0..ce5b5b71e508 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3454,6 +3454,8 @@ userspace_tests() chk_mptcp_info subflows 0 subflows 0 chk_subflows_total 1 1 userspace_pm_add_sf $ns2 10.0.3.2 0 + mptcp_lib_check_output "pm_nl_show_endpoints $ns2" \ + "" " dump addrs id 0 subflow" chk_join_nr 1 1 1 chk_mptcp_info subflows 1 subflows 1 chk_subflows_total 2 2 From patchwork Tue Nov 28 14:22:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471252 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2052.outbound.protection.outlook.com [40.107.104.52]) (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 C1FE735888 for ; Tue, 28 Nov 2023 14:23:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="CQ2TbfT0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GU7KUito7axJumRgRfp9dxNG3pt4HOX8lHqVRHxyI/5f0QPSqCw1SHkpmyRxwGzOU/VPLrrvda6LB5TkfjqnI81hKRMUDaxi4mCg9jXQSxx/8Rkj1vu3215gOoR8ynox0XOQ7EpT57i8+LXiV9BljRWZb0qBY75oA4bKpBBKxu8gd8K8dcmz8QCUIzHzQTzCy9WNkrfbHhmXe8Zru1QtJrkDrwH6RVwBxPfkof1B5BwWPTuJ4Xh9oQV0KNC3zbvWawybyYEqsrWXsCQAHO9JUR1Fu1sgxCgKkwANzfcOxXeVpKQ67NLPZERVkEg3+5j6PM/yTZlklCuIXrDvCRkZdw== 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=BNNIrA8tXFI6mjCSG5JZPitbSE3DdB9D37M0K1Au0SY=; b=KqLSdi+rMfnss44WVEQ4GOjJlpvxTFAKlDb7vSs8bSPC+EuBQr6wIu0vmtesuutE2qA10oiFex2mn1YjT4XHg+pYnmI8cFZD+c/q99MTbTQmWeTF4lft5nk4BRrUIGuBk0x2UEB+wB+FUay01WfZ4y24hwOVaTmedelX7ePBOGjP/gx9Ch4V6s2zD/GNxMDv34tfyncwhKgpXhX14cjn61K4S9IqT4DfQNznyjRd6XJ8gseDlZ79BnYGJaiBGObedvpLaUc/dQ21RoTtwT8DyMSlbhexCMcFtSDFjSN5ZvvZtsDYsuG1XfMtTF+emuyn5GIPbjUzf7uttfe2Fb09UQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BNNIrA8tXFI6mjCSG5JZPitbSE3DdB9D37M0K1Au0SY=; b=CQ2TbfT0FaHJYETQnBo0z+f+w+/Q+LkM8H589CB8zUOfvExqkpuPiNYmz3IulZplD6MmzBL/48P23T0SoylnpmhNDy67CIYxR91hm0OJYyffef+XJQlGEQOs5oyjhVBPTbBH70HmGZ8kKRa3uIycLFuJgQI/CCvXSimYPLFZZCvgDDLYY+hmSQn/g93/bM2GmGjDWpjkTHBQxfnZXfQPJTaBShDWT65e3yZRORuHCpDMBDFyKe+Po+zp0pQbam80UIF3GI6Jf71uCV5pRVafXc5TzU+Gr3Ykhrx5w0+eSqb1W0HxZecWfHU5ttG3dMwKHXnOfPoaT9EH026CbBbqZQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by AM7PR04MB7045.eurprd04.prod.outlook.com (2603:10a6:20b:11e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:23:57 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:23:57 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 18/32] mptcp: make pm_remove_addrs_and_subflows static Date: Tue, 28 Nov 2023 22:22:11 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0044.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::13) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|AM7PR04MB7045:EE_ X-MS-Office365-Filtering-Correlation-Id: 52823523-b2de-407b-34b5-08dbf01da849 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RasGabi+S6SCYuOduExNv4xwkCLEYtx/sJad43ywFUw8LmOx5Q5roKlryzIkV6oPX93YDxV7toslpp0Rpi8NZvDAwbbAcTipe7dL2X16pkcRy8QPuvIsLgT3sToW7/PD5COtxl4CumOOgKyskE9AtIcag6jdoOR0J6Zpwud5Ut1S1pUuMvj9XHzjOX+IoAFPHcIc2YExjj7mzuWmbKIc5wkAZOoQLnrwrb/B0kOTuWWckCug63Iny/H+QMCPr813bXG+v8ZZyCKzCFaI7V2hGh+Gve5vcBhERAHvesaCXuJfUU55i0PaVSYvak9n1qKpsWKOEQ16TtJ0GQxqC6V6ZrjV49aIN2kW+1uxxMFTtESi4hmo6ULuUesftgzqjZaeCpfGnvea/6E+F6uspMW1vsaxOiybyAT9mrBb/83Cb0qDnnHGbkbHkg9FwWMlQWf5v6zPbvSSwu8JOChZ9WVX7JrPJj67S8JQojegPRzSvn2PR8vIcVdo1Gh60Uahka8S00D3hvEhYR9gbh31D/VwW0KAkjjP2YHyTwqghOov5YuUEW8SNq7RyJygz6dok6tV X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(396003)(346002)(376002)(366004)(136003)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(6916009)(66476007)(316002)(66946007)(4326008)(66556008)(8936002)(8676002)(478600001)(6486002)(36756003)(44832011)(86362001)(5660300002)(2906002)(38100700002)(26005)(107886003)(2616005)(6506007)(41300700001)(6666004)(6512007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KyaxAXkz4eLqZhOTEHA2xw5rN0C2IQI4BxmtDC+LVR9ubeUp4e+YyFW76WenenI5stiCfd4EEuOLb1oPLxrOPktQ9lb3WaTDZsDD8fLACWUeijJMRT+xE3R9d83PgV2v2tpsgtLQqUZxz7Mfm+GsTdeF/i9Te0Z0+J2v0dMV9ciuwO2DmA+4IVaJvOecZQAAg+y38zPbj9Vr3MhX8ayE8rEG8GHJwDzqkHnPJ+yCSESPipHILGBo/aj0LDHrOn5upOchJjoDTo8kLXO5sEIOq+IdPGNvZon+VOeaaocEbqqQxtbgjjRcrUxFv+aJLSmgJPqrJvQMRm0Bz+uGPuqsUjnG3cviZXWu/ZBxQN6U/MnNajTYpFLkqxMNfUZoig/VCILrsQipA0NDc9FSB0q264JxKWTMs4UY4i9RCxDmHp0e81RJCMy/fLkHLl/2G6ee2oODsBg/Qo9Pw1G4WQ16gPhTmvkYlhvCx/3Dye9/hEedTVaDTxWcUQ7NHzdHBdDrakMdyKMMnU7oYslkot+bZ9Sk8tTkH+1nZjffklAyQsGGS040wvZmnrXH7iD7K9nQyoGzQmmEI/eiJy+fzxBHNoQRdp1pQ+QTlkdqOU2L1RJxzaAKwNPzX9udqK45V1YF50qUwSSbknxskp6jQPpVonNomZfZPI3wDeoXVL7+6TPlIeHvE6PY/r87PqcO1ZeKjULz3rS8yO4PLhh0Pk2YOMrbSySk751Y7+jm2y23+bTJFyi3/OlxhjTx0FRXWzA4Et9pRvcfV+Vb1UmCJR4ubrrrhRu1xShXYAwSi5WP4PsWKmS1/R9ngWs6OgukJukYQa/cja7uvvsbiOQgxKS446JSL0+W/qMiGb2m5XMdz8d/biKWyMEw7DmSrlUtWgGEXD5aEpXVL9G6hwDxJFgjrfFIdzcxuGNlFxeUlF8Bhyx6qhTMCA5WzQTIPqDZfdN+6UZ0zznXm1xrQUxy/DX1sadclrlr5BQl3RcK3pEgLRrDr+pnGNj90xyYQYMtcpHuRng10SPbiv0xFg6idkXk4NDbG6YcannzRV1jCLm1cYHEyRmCuXCjfBdd7HizSxp3X4Q5cZK81LBpCN1X0Oht7maZaau8LyeXQYjbNVzvOp6+blXi5Zs62LaBouXwRgyJ/H7q1z//Gveps5fBskzTIsKBzW4Nw3bWxKXu/cQ/N7kRAGLRpDRDgxHDt17OmNq62NKnRPtYB3HvS8pbtpLMq2DXwoRPPVkznaDwADOKL4dHPXAWSsXRXes/tMvNo8rNIVkpVDrnQDxhKcT/uysitUBtXXnSA0Ezvil9O+YUly69EvBjpPnUtFoTmXekev9wuJExngAwqQDCAnh9xHY3kZlQuF79ME64vhks1brOT7YabU6rGosCec09I7wYS9Ec5RKfxCpxEBjT2bKA/hdpxqD9D6ocImusmNQDGVweBWeNpJs11tOR9ujOfVg9MTng/jrBfFRiRke5qf0dFcXvZP/vxSnw30iPTj3WqVhZVhobNCCBuI9CqF/bzV5bYjJkfm/o8/gP+0ou4ZEipZng9q79F2/WuQ+1I2kgcfgwRCSdH0y8tGY7QSTQPPP8AUMl X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52823523-b2de-407b-34b5-08dbf01da849 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:23:57.3355 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MuWL+vEbX3flejtxDh/k2V2jlgA765Qa/9YRc15AyazrwzekWhJgWvUqkyEYgxIzit5r6bEzXsrLdkwOUwA3NQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7045 mptcp_pm_remove_addrs_and_subflows() is only used in pm_netlink.c, it's no longer used in pm_userspace.c any more since the commit 8b1c94da1e48 ("mptcp: only send RM_ADDR in nl_cmd_remove"). So this patch changes it to a static function. Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 4 ++-- net/mptcp/protocol.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index cc4ac206f848..a510c7d56d0e 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1489,8 +1489,8 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list) } } -void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, - struct list_head *rm_list) +static void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, + struct list_head *rm_list) { struct mptcp_rm_list alist = { .nr = 0 }, slist = { .nr = 0 }; struct mptcp_pm_addr_entry *entry; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 0460cb391ede..ec5557697c11 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -941,8 +941,6 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk, int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list); int mptcp_pm_remove_subflow(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list); void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list); -void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, - struct list_head *rm_list); void mptcp_free_local_addr_list(struct mptcp_sock *msk); From patchwork Tue Nov 28 14:22:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471253 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2040.outbound.protection.outlook.com [40.107.105.40]) (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 6201E35888 for ; Tue, 28 Nov 2023 14:24:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="heigmVA3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LPVmAGOFGtxhalptYYCHoJfiEWYQar1eIM7wFUGR7Rece2pfEdZOdYOw8Cd8e39qax6XYE/POBTvv6kwSagZK3bO8TYE92XPGWxq04rtjwEdj/DJRCt/uyEdgy3AvooUR6JotAHuwsODdXtjr7jVJVkIao8Noc1vA3PnXUIPz1g2TgvNF4SAE8nXcK8ovm+oSQowGNPyw5rsqaOGgeHugpFhcvGUi594gW3XAett8SyclbdJGwvgsFP22IommdQVBR+TDXWXS45aJYYrIZy8CPj/kgrjZdSpTYZGjh7EtW8dVdMyWN2jcZF3M4izLNCWjrACfa7ST355y0VF+XrAtQ== 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=eI70D7SROC7m5ZxU9wMumEUgLdE1slM2yKP+UoKBM0Y=; b=AZB92mm7Mv0G1zO3xFSYaoi6y7mzRaBu52KJ+bKWswBQwUSad9677hXv2cuVLVUwcMZiumjwLXeV21QR+eZ85lRBMsClrEE1rDMC1I+pr9/8eo/+G6N2cEndZg7ElzncflKPi1Ee3iL44ULps0EI96JLOYVaskEbTHkzsIPzkPCSs/MPLXu8XR+YIWjsJBjKXOeQUnZxb9ux/vmGNr3iORd1M64aiH44gHqy3925ZrsHK1s7wAWQ7iAV8CCO/x9asbhgmHd2EHGxzgRTCSJxKGKrLMrHh+hXq1pYgukMrsLuQ1k82Px2MyPGnvhpokPacIE2Q6YptekfWDbxNOT7dw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eI70D7SROC7m5ZxU9wMumEUgLdE1slM2yKP+UoKBM0Y=; b=heigmVA3mNZmabCYsESnFYZZX98Ud1BcKt7wb46jp5tx6Z+5WQziG+EMhsuTawPb4LCQ+KQQCjoT3Voa6YcyfCh50hEZgH93HGJWPNMM1WFJPggu2rpndtZG4qyHxu06UumpCXDAbj1Q+lXwUk7f8RQF2sorYAsSuOzbLpCF1HPrmCGV3Mn22ipSiOVbxmsyLvRfkNXFVne3Zrq4trJFj+8FIj/Pkl66SjCJw7k9k3v21xuu+7fMDzcX1hCoS6E1APrN07BrrodvuvZI4mmw9DSSzEIVafrZUzq/3XtJy05WYsUYXHjeoIuiEnctQ3xn+1weDKKfMYZOjdKN7Xtc/g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by PAWPR04MB9837.eurprd04.prod.outlook.com (2603:10a6:102:385::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.19; Tue, 28 Nov 2023 14:24:03 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:24:03 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 19/32] mptcp: add a prefix for free_local_addr_list Date: Tue, 28 Nov 2023 22:22:12 +0800 Message-Id: <90d783cc38377c80863d19c6cc4b7e14440b0dcb.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2PR03CA0101.apcprd03.prod.outlook.com (2603:1096:4:7c::29) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|PAWPR04MB9837:EE_ X-MS-Office365-Filtering-Correlation-Id: 70e0108c-d3d9-45ac-ce58-08dbf01dac27 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6kVTqOTN7zxlbihQL6DdW5nFnzQwHqTElfTSK0L8h9aR67GSrbUwP6NooXDch83EWWWsHRkOWwYvJsEc9cIdCNbnr6UmPJvZ2M9t5ajj19uGbvoaKzTTOHmlLBMzpmC/hltp6ye4WfLzF0rqgG6L7tyB9FsqKia0yI9MpSBx1yJujLJfy+x8fradDERNugnUx6AXTbr7tvwAIQROJe2wIIMHQDO4PeufCgt1FQazaALaxPOafehOkhICHfyPhu2UQLraigmEw+MPX5LWVhlf1cGY3+ivfEbVrMVk343qRoFeEhqWKI1h0v9U5+NAPvylE81SqAqzH5+N9TecyD1+n38kA5sbpAsNbXIZFtpNtQZZk7Fo9JnKkoemWhyqjPGvHAP/8cpTi4DMJOK0M4YWuRL2aD4H0sL7XGmns8gxQVktVwdKfeNl2v3xVfhZHe8cNOBM7vxq6HIm0RyX44FmikiMI4x508rdFwo3AOQVTytPe4yxWvmumI60cwr6ZgpF6WwtIIrTJWFMB1aMh+Ip0Gp34wBwi7JV5M/3EuPHnRH9pv1fjLVjsFbFCBVdZPhr X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(44832011)(8676002)(5660300002)(4326008)(41300700001)(26005)(8936002)(2906002)(478600001)(6666004)(6506007)(6512007)(107886003)(2616005)(36756003)(83380400001)(86362001)(316002)(66946007)(6916009)(66556008)(6486002)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qqH3fu9o3PH+xcQVbTjVg9CDp7H8vK6O67AFNvaw9AcpYyFUkiO1Ujj3CQY16bIuNypoQ5yR6Zk8fWWBDcLubgtNTiM21eo6j2QWy05+Wlh0bUGxhLEjRRQxlAhNeQQZvepz9S5cnzcazkcPT2r555SUWw2pFN+ahNTxxo7EIOUpDaqxJdi41vE04Prjr4cKZfnwUuwvDKFNqgYXgYlO1NimAdWXfJAaYu76T3jDnED/AuS40hORHw0CV8V5cU6jhogK5+HdfgD4wWxYCdiUgN6CfmLnqB9tOtWCnjWL+bCxfXwmZ4Nl6yP9owcpPokRd7AYEXusHzvhy+gKTsEYSYYvBMDOqaDBXUFcKH/ofVOhaTzJ0YuMPsvXgYPEgJ9YyvRBr/hJuH4qHl7oO+a4ZLp4UBQzlccnzdrAEXlku8dHfGrGv5ikMXOLZIZvpHOYa3O3tcZMuE3/SOR78XsSFuXbsTsCyY+6+/mrCzgmabQo2bK92jE58Y/3WOSTgSNDz84xyXFnydtbfIHa1EwgKwbD/mwHoTpBIOIikttNZrnMC1ybVBgX/osiEK6DZbvouOkv0SRwroFY1zBbxOHJ6LSRJODKTJwDtM5vy6Uvbvbn6ZwIS07wmkWzR1cC6PdXasQ6VmodSH9E8y05QjFHPu1qrkIPInJm6Dp4dsXXZRDzChZNvsnZy1GUhwIOgJ1bD16DRnHcl2uwpNLr4ts8bIKWBFCGd/IX4lzzaBBa3fO5cLZfNGlg9ONtUTfgg5oBTBRIZcKKYXtinshmvsZkpAo1QIzJD035ktDViM17bqlYTF/DZh9sjaeI9gzjJ9tYWlhOqJk+TE7H62r8npbwT6NfQTGC2+eClG0+8s2ssW5kBp5YtQORZbijUqV8iqWeJ00UDY08WJ53MvBOneDwlyVXU4UvMtymIiEbXp1n2/9omrdOdbNJUAIPXvxoQ7rrJT1fpw8qnraqit2BZpabDHc1j8IA+NgESHK+4KGlU9cuDnsuQ0HwV7e42MHYj2prdmqJHmmzOjaJIWXyuZbkmjMngTSkGy25EYDPH+qdwDbKL+hFfW36GMck97fRo2uOrLhIfybguAH9rk8t8VCFXGZGdsJ29CMePhZDB4XTmulepFPzVrWbi0SwA8DLUvHygE18kWelrDInyZ5G3lqnll61AzJa9j4ZinE9OOfzoAL93q0E3o2p6eKfpy8KPOQXJl9k3jJ250pMF7SsVXKYGvSYMr7Wxemw/Bs/9m49u36W7AIBgjqx966Flpdfoxbj7WUIM/2jaL7JW9IQIAEk2SGLlAOlqGT1TFiBvf9fs8jngJ9w5sjIWchwEjOZcnLSSvnR3BmscGj4qU76CpnRdX9ycZRv2J71aMVIw8Wz6eHtp4T/koQ/tEB9xbpdVU0bGg/qnkf1HSnmOcdNG0bSbbCYYNRkRsw0tIsyQUAPfi6V1hOqnzDwH8SYgrZk/HUOE0njh76Ihbb/3zP07aqAYOXQ//pl9XqtPWsx7KOuA6Vk/62q7k+vohV5FyEVJhZiwetpOQThRgqZi09qTk4wIH1kBHojAN6joL0tdy15VUpI2vv1zFWkMZlvJsQeJrSu X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 70e0108c-d3d9-45ac-ce58-08dbf01dac27 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:24:03.8109 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: r2FSj24Ga0Ey92WbzHZHbnVVS7GrgvAci28tv/LEsoPX9eEsaC1sEZ3/fExNAJhtnnNwcGWsjy361sXm85QcfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9837 Same as other functions in pm_userspace.c, this patch renames mptcp_free_local_addr_list() with the userspace pm prefix as mptcp_userspace_pm_free_local_addr_list(). Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 2 +- net/mptcp/protocol.c | 2 +- net/mptcp/protocol.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 489bb0e61118..87cf27dc1d0a 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -7,7 +7,7 @@ #include "protocol.h" #include "mib.h" -void mptcp_free_local_addr_list(struct mptcp_sock *msk) +void mptcp_userspace_pm_free_local_addr_list(struct mptcp_sock *msk) { struct mptcp_pm_addr_entry *entry, *tmp; struct sock *sk = (struct sock *)msk; diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 6956fde61c68..f2f0ce608219 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -3321,7 +3321,7 @@ void mptcp_destroy_common(struct mptcp_sock *msk, unsigned int flags) WRITE_ONCE(msk->rmem_fwd_alloc, 0); mptcp_token_destroy(msk); mptcp_pm_free_anno_list(msk); - mptcp_free_local_addr_list(msk); + mptcp_userspace_pm_free_local_addr_list(msk); } static void mptcp_destroy(struct sock *sk) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index ec5557697c11..94126212da8c 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -942,7 +942,7 @@ int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_ int mptcp_pm_remove_subflow(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list); void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list); -void mptcp_free_local_addr_list(struct mptcp_sock *msk); +void mptcp_userspace_pm_free_local_addr_list(struct mptcp_sock *msk); void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk, const struct sock *ssk, gfp_t gfp); From patchwork Tue Nov 28 14:22:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471254 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2078.outbound.protection.outlook.com [40.107.105.78]) (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 36EA135888 for ; Tue, 28 Nov 2023 14:24:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="zxu//6c0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G7/LUIB5CATZnuf3ZzDjYLzu8RbqGVqp9lAxvbMVcIfkss5aZVIWb5QwGR1A8baeaJoTTLmdBIKP5/+7MIJ2p1hRXlLqmdlBW71UksLcjAPGFiKRAoyAPsBI15DYjQg3E7iQwhCY/I7djV8g1kgkiGMvorrpnyp2mNDF3kC2l6lVMSbWEvC5tMT03+F7TmlfcA3v+sO3sD+O29I6e34iqbLuVOx8FNNajzXhlEfR7qJt8LO72rfufZIrCHoG0pzYm76gZ9Djv5xZUgxUwv6Vz/JDVL2htoiK3MDuW+/S596CY9ZrRBQ6s+AVaufKy7rqkuvV9PpfwlRZDl3GNoleAg== 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=cyO0dDjGQ8YNpkhOtnfh0sLwo5M8qTyjkoRsOX/2DU0=; b=Y6wEE7bhwpZhWi9wEhHfMjMwCHkBi4DZlg2hy7JtuQxQEEtD4E69l1U/4rncx2JmBh6038bT3KBTC06K870BwsuBgt6p/ZRMRp6fAyCjGkHsZ1+128VLAXMv5aoZQXVmWSIaQnjP3Eg9zZ9LETlmyiqYQzKcBUKmaZPPx+R5cMQULnu5PubB2w26Lqh/3AUlWPKVgYAUqlZ14rp0OFSNeECbmHIC/Kx7pTOykiEaXeyn2tgQDL2cMHui84mygdhvadvyVyPkuWRET9hcFpSTt2HPtQAxFhYXMC+D9oE4Mg9cdmoPebwIEohGHqvfcG1cUtzx+gq67hL5nnfmVtCm/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cyO0dDjGQ8YNpkhOtnfh0sLwo5M8qTyjkoRsOX/2DU0=; b=zxu//6c0DAA8f8IGirk8h3ul1sQsJMgzk2LfyHSBUxDmf82E7AzAvWU1O+xKkVmzAQaMYjvsMJAN6SLR7PvQhjUVcxlOU4o8FG6kDvccvTyz/VbkIYxVtblcN/lxRMxJm2YTC7PInqqn2oNTE3ztzxAvLelbf10ICRZYKQBkTSwtKidLMKYREMwD2HXUBPCBqY7yP8rFu8GY3kd2+UjT0wzILTcr4FKuiJL7gs4mMTlo4v/GbqFs+YWRf+dIn9vxEYTZXbOFNNJucNHSP5Kjcvbk0Q4OqrYQaQM/Zw0Tt2u7yDlHvXg/++QZWpYxF5q1ddE8zalOXCGGt3JgMmwoRg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by PAWPR04MB9837.eurprd04.prod.outlook.com (2603:10a6:102:385::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.19; Tue, 28 Nov 2023 14:24:08 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:24:08 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 20/32] mptcp: add mptcp_pm_remove_subflows helper Date: Tue, 28 Nov 2023 22:22:13 +0800 Message-Id: <45e57e6e1cbb87ded323af27a9d8eb692abd9139.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SG2PR03CA0101.apcprd03.prod.outlook.com (2603:1096:4:7c::29) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|PAWPR04MB9837:EE_ X-MS-Office365-Filtering-Correlation-Id: 210010a0-1256-449f-6d36-08dbf01daf13 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jzlVUKRXedH4KgcJgjWFNQbq3JAVtadumlX6Gbyu3a1/Ui/v4guLVQhxnyDufsW7jJEq236K1pwb41pFDWVdj3VmWDKU1TvWisUyx7ARe0122tXm9xTmYIDiP+ZIlpIG0lw9axw3u0tBTwi5b9vn7t/0eccQaq5f45txc8BXzJznSMGW1ka+qysoXnCwr35viGSpijT0nulXUpDmpphlETup9+ObCd/3eg8zR7kC/VhjwIHCu0yyR9XcadqpEjwVJSpiNxyXi6OD7sMzL1DXtwd+YsgDGbuV6qjwlYiRDxNaC/2+no5gW6BdIc0FNb2zkYrkdbf9WXcLsdVxnREQ+iLvEybaylAp35CsDMMlO32qdXna/W34fj7YQMGWzv5cdaoFq+xkMw5/KtS9WAxfMlUiE/cdCUSxlRRYUWd1GoKrfuC5NiaSAhLn2+2cIwp6IMjMswaf/2Wo7uVL+QkFFvG6hIRE3IAV2FGyJVaqu7AcfAPFQI6rf5RCedr/RNLJsvv7tdoz9BeRUKsNbPS6cC7Kvhzz9eXR3XgjEGrMYQE1vbxQOIFrh7Mv573Fi7W/ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(44832011)(8676002)(5660300002)(4326008)(41300700001)(26005)(8936002)(2906002)(478600001)(6666004)(6506007)(6512007)(107886003)(2616005)(36756003)(86362001)(316002)(66946007)(6916009)(66556008)(6486002)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Zj34khadI1xA8MMGKFTZFni2UI4+mZpuDfHnNOmnER+b5dFui1ZXYvn/EAWzp7TvGO4fLkZ3mEX1glL+x6dgdmDp/2JeDtlo3USq90zX4lGvZz+vkWMgW9DgSy20NjUCwOVl00JA9s1XJ8PR4YMl+0l2MvixPkrYlx9XjcqYGAFumvIxiEfe98pcTqcXPXbqBKCJ6XG9ZJU5ehFMOBu1LT1MIjIMumgS6U0vvMvs0F6Ud7kRse5lFPNQQLBeWQIvu8Qodm1wL9QtpM9NfM0MB71WGRpXeQUB36gP+NhjKOsYXldfUevXek7YstDdVaiYhrECpiV+Ji51kGCpxabH/AX2xmbzJCfr0hsNd0X26MlRnGKlroxE2dYpmcWeSrxhXtLmE2csVvNnkLZhmh4wJ7UPtGtUpFjMkA3qZPY3ZZYrTsP6su96QmJm7AufDcjss2osVz8hqQxpA+A9xu4NeHP/UG3Tm0t2aqDDWtcxxCvYRy4XTzAjR1D0xdcFZ5aBB/gKykL+crsKGX8kRH9Cqc/Rkxk40dys0S1MdiKpI8iGxj4KF6+nLhgU+JRVymoaOdCIzue1FKMH6Tmu+7m8htS7AN87/ps8Zz2DEqeG9R+BZT5fr+App5Ks7afpf8x8TEZonaACUmBAZQzh2bKTETNijuLk/Jlul2t9j4VyhINhPkNXzCPUwaudw1E0OsC9pV0WqlFSPLHjimVSYAkuSJLjF3jyf/1oHfVU2v7ukJLXJnx96DvkcHFxwWzu6Pzx6lunMVgDo8zFxbuTriU7RJ8lI4rAl5JTdd7LlwPRUnHgKo/NPh+tNx4tURMJPrCPJu1jOn+ZMPzXqgzKNsP5hnvUSFrOC0ADkimOfexpYtW1N6CvAHwn/X2W94piWmBnvDArmFNYppJfAQJlYSmnRk55QNbkPRU+44rc9AluDEn4nKKN2JDXUSAgrwcil+8EgV3D6DqcLZcU0xa+lElgNF2I2itukRfljumNrKezwSych/VZuNny57BfkJMrPQ/oCBpoHxeTXb5VotlYp/xru3VT0YAlqGwcdiMR7gXlSsVYDRxVIDDm8BpsXgwLlYFlSQgRUVfUc3DH0gwNHK5cwCdFh00KBFwB5TnF7YNR5R4o+iYYbdviOmsMTc/4RnxT47NlWLKk15dHUlBpPRiylu56NaHdH3wGAZ9Uab00lhtYWi7FyrWlcgATkd+5ThxJaa0N5/3QaOxcE6WNBVeXNpB7P2uKvAumQzoX+cAWjL2+EJwby5twzfPGxc1C5u3CAuum9kuqRe/59CysYIcYLZwg+cqanJAm0pmNmuflskWJeyi5t7Hp+DYCQdu1Zt5/R4Yy8xON0ijwQcHtKkI5mDkYRDjyk+TWC8kOBeprXI5/KNp1JCmfZ1OGgtaFrA0C90NWaIKyze6XrKRl+AHOPK0eTNvn63Sb0rvYwKFEUU71NAnfKkNVwnysnjNFKaCaVC/yO1kwNjabRH1dyw8DyEQVOyPOAUSb0VYJpDnTeqiAS3wFoVHyW4pqC7VTRmyUg3UGEGJ0X4eJjia6xjwQ7/N+4xZ0EHei8f0C68IyViCezh1se5vAIEimm2UGxOsW X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 210010a0-1256-449f-6d36-08dbf01daf13 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:24:08.6633 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6OSEe74XBf64g553Ikgq01gFSLQFLID9vuTsEqAOUdVPHpEHKIBpVwI1f0Mt/pO5WLPVgSkD1eGAZT9SB0kI6g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9837 Similar to mptcp_pm_remove_addrs(), this patch adds a new helper mptcp_pm_remove_subflows() to remove subflows related to addresses in the rm_list. Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 15 +++++++++++++++ net/mptcp/protocol.h | 1 + 2 files changed, 16 insertions(+) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index a510c7d56d0e..a4dc2bc8fb55 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1489,6 +1489,21 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list) } } +void mptcp_pm_remove_subflows(struct mptcp_sock *msk, struct list_head *rm_list) +{ + struct mptcp_rm_list slist = { .nr = 0 }; + struct mptcp_pm_addr_entry *entry; + + list_for_each_entry(entry, rm_list, list) { + if (lookup_subflow_by_saddr(&msk->conn_list, &entry->addr) && + slist.nr < MPTCP_RM_IDS_MAX) + slist.ids[slist.nr++] = entry->addr.id; + } + + if (slist.nr) + mptcp_pm_remove_subflow(msk, &slist); +} + static void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, struct list_head *rm_list) { diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 94126212da8c..efb24c05a7e2 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -941,6 +941,7 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk, int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list); int mptcp_pm_remove_subflow(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list); void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list); +void mptcp_pm_remove_subflows(struct mptcp_sock *msk, struct list_head *rm_list); void mptcp_userspace_pm_free_local_addr_list(struct mptcp_sock *msk); From patchwork Tue Nov 28 14:22:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471255 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2059.outbound.protection.outlook.com [40.107.105.59]) (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 0AEE435888 for ; Tue, 28 Nov 2023 14:24:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="beYpvJwf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QRTEW4REPW6XMZ38bz20mT3oT9iqVsCRAOAZSzi5AupIGCvD1w5CnlCOQ9YUZsgyoKflS9ly0OZKYwKy1OaJjHvdXGJjtXpYnYS/EZ7VW92SwN61pNZpTY56WCjus0moesWy7kMFBMj8ZJnWfclcl9URRH+mRr8Q/Sw3PZWeBrl8n+px0j2eEGVqn4DdV1q0nwpQyVxIa9HGhypBaD7VfpqRX6x+cglrfkOnJrlu8GQG15ziIyz2AwIcBck7qFo8OYkcT6+izrEbpi2kb4oj5j6axPkem69S89yTVPTRjwxN1qb5uTpDFuMJTx6A4o4qxHJIZK2+4R4P8MLyn03uyQ== 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=LFHe7S+Hy0deBz2+JZd2T4avlxaVx0U1hIAvevaw8cs=; b=bo0wyHVkUFeDSRMWOsN24GyQ1pRBUEYlwfOjJjf5VvXwXoGzj98WoTcOG7kBaTx84yvswgeZ0L8u8SD4ubUT/y0IXCGuBfVcIh0Z3n7d5J10t7D7shiHkBK11Pm0JMPTM7bwpXNSzW3/amA5i1PNcOiUlqEL9bpTQWoici2q/TcDlEP4tPnLEKzAr9xxPUr5odaQb0bevNYXEm59xB5ChX7Pq9PGjHoWGpJlh+BiNWp6wUyh4IB6xVEgFe1UX4Qxtv6htyiSrkOsws32rE1KPHH5zZPzr2SM4tQG8IRj9uBE9239ddHfBb3AympKT2ur33f2edyRCyYVQCuldo6k9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LFHe7S+Hy0deBz2+JZd2T4avlxaVx0U1hIAvevaw8cs=; b=beYpvJwft0P/viUjDhQH8D3bLyHKwtt743ooj/XRiJPOAeT1q0fcInf8VUWj2beps+tmgjVA9spYFS3XxuTOV6VpVh6yU6PIXN82LubGOVNPX74MGaqjZOClRrhce3bAUnm3Tx2t6Oldx3gJkAjD99IYUFQwjpItA8uhaHGx+Ckg2T7SvnD+TIOIxtS1/fRyJMhBDG77QaqRvtQXMWMLIJLuAx1mbmI64SqTWWMdl2X3vcGwrvsDJ3EwRYoN5bX3caHl56O+QihNMAiYAycAL4IKwiSLt1P4tQMEcWwO2853Hc5nZv5eMp8jq9SnGH01PP7Mw8qNxBBfhRYfYSFwsQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by PAWPR04MB9837.eurprd04.prod.outlook.com (2603:10a6:102:385::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.19; Tue, 28 Nov 2023 14:24:20 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:24:20 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 21/32] mptcp: rm addrs and subflows before free local list Date: Tue, 28 Nov 2023 22:22:14 +0800 Message-Id: <3ae3b61c487a73f3ed7f9b677a6278c401ad710f.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SL2P216CA0184.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1a::8) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|PAWPR04MB9837:EE_ X-MS-Office365-Filtering-Correlation-Id: 2e88ed19-854e-4bdf-1439-08dbf01db5db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +ivohtmYzLUXnf422fv1SrVn5Wjqo+wejUbE3LXKyf4dCqU1V/SljlBDfq/uGjF71lpnGWkUeGA4oQYZJFadIj0CfYVwGwOjnj4BWlSmgNQKYdRyZwuDn0vp5isJIBZZZ03cMjGQPwfOHGKgCTX+DfCgYdwLmmJbnwazYhrMTiBKc55dZ7XkSDA1gwi4M+q6JKINdTARbf20zDlEbXa4FyziVkA6nTSQnPMHK0V1PV5fwOkGYoVO5ZhIe7/3PErSc+j6ssErJuj40JiUElptvWC1r9vF92vB6e9QQxve2aDDrimgCj+OPxBGrrkgw9WLcvU8xRr/680N2JRre9H0SCnQalVY/s9RZtiYAKBiAB2KCE+ojicM8QpwlQ+4m0earWs6peIOVxPjhPh3rHKbEThCvxp6XoQDuzNbZ5eYujuw6bpQ22b9W4fPMuh9OkT1OxZihWRSYvJ52pmektX1EiuTaLw+na+rRqK7hpPC0j5+mhdPptD3Vzm7SGhvJIfJp6RWZrnoOnsDLZOJ+8/zZU98kXc2xZ5LbdVy/w+sa5FkBVhzWPytLJjzYPzRuZC3 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(44832011)(8676002)(5660300002)(4326008)(41300700001)(26005)(8936002)(2906002)(478600001)(6666004)(6506007)(6512007)(107886003)(2616005)(36756003)(83380400001)(86362001)(316002)(66946007)(6916009)(66556008)(6486002)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BTaV01kxuUGKtQuBExLTzEfP7oXT8biWejzm2OBG2jvlAp4h7monnxkoPlvER06m2jauYaZW+YmgQJfu+LWiD1iQWMepir7xzvrxnYZFb0xI1jH/emKVEAIyhImoEbzvMueA1WlS328A5rWGI9Qh5Og/Kwi/Vqzx+UklpV8st9ZeEkMagcdTHBHLEONxP1ZOJMEBTqO/3EatXkbbxH+t55+OiLoMfUvIg6FS1RH0eGpBWymZDUrcMls0U6ZJVhbFBD9PSnA7cVXW2eB/DXtfNXSt1/L01CQh0ri4M0n1lBASCJXSdHp8O4OQ5GoiGTFsyOQBrSEtx+KbtIdOj/ZycDY5lPSyl6K4HRhK1ikRZihQkU8gnytmymwyDPbv0BIz9ios+3qtVUmli8D+CEkiTsWx84Gm84cPRiF2RPZBlU4phWTINjAy0NRN4DIvKOGj4XazlI/hqe1Hd81+wqk8J6T7Yo44h1LWfYjcmxZF/YguA04nhIXyz7htJ4BDzPjtwjQzCSYv/w89KaoJg5Eg9y4qtBpL3MTYCrxPT8nmEAqH6YsHacG25w1gX4b6yks2xOCd3X5w68RrWeW3lPuPh5Dkb9j4YwcCdEMAyBnwd2LGID+39z8t0iY9jqTWb8kVfw7M5qTk/7C1NDiJYo42XqDYjE/texYAlJufU8GPVxHKFwoV+MEGVNNAZY4BtPHu9tev19TTEoLGa2XXIVcQ/h8QO1dNVQjRqWvWBAMlt9CJXI00aOEE9UIZjVjoe9HmQ5QSpI/xfAcTmdoLc8czN+4hK+cG36O8GK7C8nNdUJZAXLN6AFIEeEoJTfjDtkH4g7KjcPBKoU/1AImK43wI4eAbNnoe+/I8vEIB854cwME5srtkiH5y2th9kddrHL1xqi+/nF0uO5iBRuThd4LWsfnYFB8JaEbW1NRGf9UHvTsnDYPQbHlJXNKuh0mE06lIAFlMlufrdic55SRfHGIpwZ0EbZr4A3uGDTJQQnB3xOqTpyKsj6ScQdGtwIbB0l9JP+7MglBV554pgs1pMVeqBl7Iid5cU/esudg2Z38SOgNx6P/cmkxbDtPwOsaRfsEqJsrZXzj79Xi0gFdCX3Yozw/YYamc/4eYpJnuyxlVHvF3Z2eze9Dz80Ewcbs27TRiq9QQJ43r5QIziclrsxo+B6PBpkd0hGlDy4wkAq+62DGbZqC6pgv1udsz1zJybZTT0dwHWBQxCX8KVtlSe5UkWCGBQ1pLhTf4vmJRqn/bF2N3zkxdvGzCd351WHpYK6CMohGytcZPabCGZyDxAxT/OxSYx0FsbjH8Cz2c4zh4hkDZLgQOdvs1Xy92BqbcNn8L4CxtpqlRTUN8nS3Eh1pzz+663vFkySlDPlJFv42S5GFE3IYG1GqIGQleTjs0/pgmGDnJFWdbcLrTO5R/6fSVai0ywaboyWXeCym2usupVYoeFkKb2wWQOSrEl+oMIsFazwAj4uKKwNR33wo9W69DC0TstDqiLu48ST5drFanbc2s/VJHdUhRzOCgOqRrmYSCc1WKNBY795BXkK5vr5lPdVIP7mVYIX6dvkAwo/PsGqgKMKMew0cpQgeP1zlrxvCr X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e88ed19-854e-4bdf-1439-08dbf01db5db X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:24:20.1199 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Brr4Xg5+ffbsWYZTuSyBvrETVlbJ63y28f1QvbmUAnazyH1qhMlOqDNtlJ5BbgSfJJaj3UE7/aGY7bMhNB1B+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9837 Before freeing addresses in userspace_pm_local_addr_list(), RM_ADDRs for the addresses should be sent and the subflows established with these addresses should be deleted. This patch invokes mptcp_pm_remove_addrs() and mptcp_pm_remove_subflows() in mptcp_userspace_pm_free_local_addr_list() to remove the related addresses and subflows. Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 87cf27dc1d0a..674262face65 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -20,6 +20,9 @@ void mptcp_userspace_pm_free_local_addr_list(struct mptcp_sock *msk) list_splice_init(&msk->pm.userspace_pm_local_addr_list, &free_list); spin_unlock_bh(&msk->pm.lock); + mptcp_pm_remove_addrs(msk, &free_list); + mptcp_pm_remove_subflows(msk, &free_list); + list_for_each_entry_safe(entry, tmp, &free_list, list) { sock_kfree_s(sk, entry, sizeof(*entry)); } From patchwork Tue Nov 28 14:22:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471256 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2086.outbound.protection.outlook.com [40.107.105.86]) (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 2C960584FB for ; Tue, 28 Nov 2023 14:24:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="SWKVOSOd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LNQJR2+7vqZ2LU/T3uw/mYUZO+srlvKPO8coG7MzJUnCnTNricoKD4kVHtHHNeBQFiU6xaMMuf/bSbl7EOi/tR11UbxAn6/EGeUAkgxyKusXZZ5i/v/ZEmQK7FaFNcuUoZUfCcjRZr7vHA5u8+BNc2BDYtpytpKCkk9SSQWDZhV/O69HAThFR+TrQTGua4OOo3BIlhjpvhrrNvnoG5h4l5ytI4JtZGQCxRufMUmWVdFtTuGe2B0+aHkgk2chKmyR9zjSgMGrZAtuWWpcmQ6l0LJlLHaknUvLkJDuTv1WaN2KZSn+Ruiyf8ISHwQLgXFo9M5H63ZLxvPX9WzKoqbj+A== 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=sf5bQUbh5eEFZga+1M+nElTrKfqhdkRszfzsQuNXB3c=; b=ahGcGDb+PwF4JpoYIbmddC2i3phVOeQh1Tgdiephb2Zz+td6UmvzpsJbKVNxtcrdUzaDWMUP1frhmC9kAJMbJZWTRBRIOclhWqLvGIu9qz66U8RzSw6bL5BF8AYvnyoTSQPjPclp+BJht3Bv3aQmIoahlLGn0rXzFYGkQE7p2cYieNUpKe31Mf/AxpzCOITPKH15pln/n2xlrFxaA+dXXcBYARE1HvlFKsUFGND5mreo3mffPRTI2j10naJt63A710PydDSv7n4Vl3gBj6WNQ9yxf1F18E7sXmJuNQldwCk2Mi3rSfB2ckcQZbC9irfm8Vs6AxoomQa75MDdvkk1tw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sf5bQUbh5eEFZga+1M+nElTrKfqhdkRszfzsQuNXB3c=; b=SWKVOSOdis/LFgzb5xbWQJzvqNKLsxOvZrDc5Vfn+4aE6y2ygT4I0fDMofULwuggpWWVMntbln6+KZpqelERPSACE/BAn5rHlOQOZWvC6rGjx/QjYfTFrAPCD6CJo7MfsXJ5vCJRedguZpa3UVPMiFkO1aHumWqZcodh7fHmVBhdFwEQz9+kUTdqcKEj8ltsv4fuXrRm+Plb5Ac63p7zcdinvUWxgI369O2M87qzod76w7hNoHoEw8rK++XuUVA0ZLWczkt5nA5MuhHBjzm5dGJh5FFnd+E/Eutjg9JgbixVpGdF6/zcMfNmzU4aeQP8E6AGUNgXNBKeiWZ4c9fvBg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by PAWPR04MB9837.eurprd04.prod.outlook.com (2603:10a6:102:385::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.19; Tue, 28 Nov 2023 14:24:30 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:24:30 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 22/32] mptcp: flush userspace pm addrs list Date: Tue, 28 Nov 2023 22:22:15 +0800 Message-Id: <8206a3d8e4a1e2b93362e2a7c7e23adc15194544.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SL2P216CA0193.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1a::22) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|PAWPR04MB9837:EE_ X-MS-Office365-Filtering-Correlation-Id: b9b3a598-be34-48c5-66fe-08dbf01dbc34 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TlE47JzvX5pcFPpuYlb1nBu58fvIRSz8FSQm7uKN15N/Z89CNiXwToGwGOFLO2V7NtdegGXTMRtL/R69JKi/gzazgpMz9S+PxTs3NZJoiPQ2QXhGZRVW8FcDj9l9/zTzvTi4SL3g4Wv04Ul+mhm3OemZ3upKGv/CGwA9tSIniYO1RfAEwovk12pR7sHgq50P7lOJNpCCvvZQo/lu4LdFCDsaHts6VhgPK9FEn7aCxA4+M/6lKmU/o2ilrtOtfIfyUvuwFY3FLszIWkIUOyevaYqekd+j1yc8d8yNF6Rpvn4VHhft13DGbwgrx/bCJs/DpZvCJwtiCTO3kCc66xuCBA4/SD4zMYQXqZTeKvySktUBjfllztAckRx/Lbxw7KJvtJF8vTAEOoII65swjQfOXIzQJjacE/63c9nU/oqj4KcE+fKcgKjR3xLLAG6V0D/dsfbu+4UydB3u+4FO7FpsnKZ6zREDtFrJT8Bm2VwwtxDZIgop4GyUJG1ch1zfmouUnG2dp6kEzz6+clMT8QIPgi2eU32kq+gqKDRxkIpjaqeIndtH+htkeTC5yND23eGJ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(44832011)(8676002)(5660300002)(4326008)(41300700001)(26005)(8936002)(2906002)(478600001)(6666004)(6506007)(6512007)(107886003)(2616005)(36756003)(83380400001)(86362001)(316002)(66946007)(6916009)(66556008)(6486002)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hPqhl5Hp5BOu2oWy0qbsytjto5Re/BRYk5aE1FscFwHtij4a6WGSYdu8E4dXH9TC3igea8HJQWb9Pq67kHPrPGrw7n5lRtxjNUoA7jih0L5wDPj+sLcof7WAIKqe4Vw9T+RnALZGqovNEjjbwDaU78UUKcR3+6PDYmpm7GOvykU0GEMpDu9UlEmd+X5u+DFNB87suLJwNUTD1Xw6hF8oPRETyWbqoIFfeU5+dXzTD7ofR/nUcPPUV/iKkOo4p/ECK1jISYz6O8BRREgRkaBGZi3xBkn1NDn81Uq9sQ5w7fjH4Bys2m0RulcoK6DZEGnaJ04MYEwRbc9f/3KNQQjQ716RVzPOilFFWIhnE/ysIJ65wFCKsi/hZy2OztP1kOyAIvW3tCkgvv5jyOX2NF9jKtGGhRvVHngCUWP6bLJTLlqsK7k6hIeL+Bi72U1XD6TzeOBDYWcK8S6oGfk0K/iinchXMFMIf2m1SGCDsg4PUsg3JbgvrdV2q5XctmD3Xt+aEOwt2bm9KD55i7wwtmXqoBk2M7iShsJ1He/oLkmIby5MmiB1Qgr8PRclY63UpPVvlz6XGviLDltprELcftDE4ITQumZwzeJMvHIuYiW5/OYk0uaPSWmTUlMmJAuUuEPGLQtUk5TISSHDDEPZVy61k5G6HCzrShLhafBwRYWSarz7d0PQ3MMO9VOL7HAbmDZ7ym24kcd7Kpwg78UcufY3DtvKcEABRaQ22Hxc6++7jlI0oomrjed7lsL8r+E2euldl7bcc/AoUI4rez4fTNe5mKh6+QQM0aiCvKDG+dv6SVc70ZzXvaQ6xe2j1tacHV42zdmULGgx2JA4Y+xfme7jndNLbfTogPEw+IsDrOJFI7T/+ZmpOuJlSyuiz5uMsBo3DfprQYR5fHI8F2fkwK7ICS1ZJFRFFZPhCqhA/bMmZGUesP+EFW9JSDe+fgqn/Y9+NifXAWW63PskqbAUsjCwKyH6G3UJvWP/3VhJKfjtzvwG/BfeZLw+JaXJLJyYlN/8joTMBIqQZM8MKoF614wfvBWREB8Juf3EWac8MhW08Mv1HHHPDXke3PtVWz9FA/dZX0n9YWbIqTLrVcUSIdhDqCyJPIT6oUOXGt7HDi8S5Gvyiqy/+gaGRo43cfPZOwSz8VMrXG2lNKpvrPZwV+pJNzfQWAWpyvf1VRz8GftoxCEKf6RextHpYw+88Kob7YtN2QvQfYGGsm5whjjNa5ibX42F959nZVkn7Ycl2pmiPxDlqTqgeDv6fQ3+DKmak8hsWD8GXZdP2MbAZkmVFuficgTk31lrtXw3Hbf3a42A94Uq6fcvZ+OC4kqaZmYw7EWXppB79myI9krCDkyoN8uZpm4pSccBkz7KSfxHaxJjeBLOkcZOxpKO368sved0YkGCrMsFO1uajHBlRwIuCJty3LyQkzHSFYEaQ7P7gm6gmNqA6xTVU3lyH2XidXOuhtYHUa9izLXK+9QKK0t++rmPENV0T1ozAb+XTOcadkYDwNU1ak3fVm0XmsNL6SrEozh7UCUn14AwR7HOWz40t/ZcVOKA0k1eEXYykmcUJicAXfDtHPaOJui0yI8tfumEo85t X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9b3a598-be34-48c5-66fe-08dbf01dbc34 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:24:30.6118 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: M///WbdLJHsHWDEq898rJjQyRGfdKKES3ir19edOGIb0E/b7YWl8bRwZcZ2OZBkUFavu54Ya+rlCknNWRhuf9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9837 This patch adds a new function mptcp_userspace_pm_flush_addrs_list() to free the userspace local addresses list. Invoke it when flushing addresses from netlink commands. Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 2 ++ net/mptcp/pm_userspace.c | 23 +++++++++++++++++++++++ net/mptcp/protocol.h | 1 + 3 files changed, 26 insertions(+) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index a4dc2bc8fb55..6bc1a6b5b4f0 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1587,6 +1587,8 @@ int mptcp_pm_nl_flush_addrs_doit(struct sk_buff *skb, struct genl_info *info) mptcp_nl_remove_addrs_list(sock_net(skb->sk), &free_list); synchronize_rcu(); __flush_addrs(&free_list); + + mptcp_userspace_pm_flush_addrs_list(sock_net(skb->sk)); return 0; } diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 674262face65..8494d6df866a 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -597,3 +597,26 @@ __userspace_pm_lookup_addr_by_id(struct net *net, unsigned int id) return entry; } + +void mptcp_userspace_pm_flush_addrs_list(struct net *net) +{ + long s_slot = 0, s_num = 0; + struct mptcp_sock *msk; + + while ((msk = mptcp_token_iter_next(net, &s_slot, &s_num)) != NULL) { + struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); + struct sock *sk = (struct sock *)msk; + + if (mptcp_pm_is_userspace(msk)) { + lock_sock(sk); + spin_lock_bh(&pernet->lock); + bitmap_zero(pernet->id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1); + spin_unlock_bh(&pernet->lock); + mptcp_userspace_pm_free_local_addr_list(msk); + release_sock(sk); + } + + sock_put(sk); + cond_resched(); + } +} diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index efb24c05a7e2..7441e3b9443d 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -944,6 +944,7 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list); void mptcp_pm_remove_subflows(struct mptcp_sock *msk, struct list_head *rm_list); void mptcp_userspace_pm_free_local_addr_list(struct mptcp_sock *msk); +void mptcp_userspace_pm_flush_addrs_list(struct net *net); void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk, const struct sock *ssk, gfp_t gfp); From patchwork Tue Nov 28 14:22:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471257 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2048.outbound.protection.outlook.com [40.107.20.48]) (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 0F525584FB for ; Tue, 28 Nov 2023 14:24:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="RoUcMYUR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jmNnZNN5RwYk+0xKVcjN66pzRS9aUMTqNz/wuOBhiaHCHeUndjQry81ZAoMGm73cGSxH9ZH+RHEMbOnsL0Fy0peKCqbXeyKwLabJDiXk4Fxbqa6c2hiXa+YQPrKZK70hoooGZS1s7snaT9pD+BXsTtO0LHDoKaPVfPvRJlXzXnP8lyh3pB639ahOE4m6maHfqOhxW5fsd4T4rl/wWjNAb9GK90okKcv9UTdPr6QrbV77pJZNLfeo8cnLKGGNJWTxdC6kuKYpzjau8ICcbwkxtZ5jMYgmrU8DgNwhxrDMZnW4VNXRhx6ZyplsH1HFkRvPCxGRX70kOLcRlRnDz2OxOQ== 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=+P/My++4Ew84cg3VAoBU3wvbsMYWACD8uXgvo36a9II=; b=XCSl2x3k3kz9si09KWyW32I0fE0Re9wNfLSK6ZTrp34C/gcCi43QM5ZHPNWHQNy7VF+Lla8MU0UDrV6DWMZnpE6huaZY227WM1/IUrrdzPqodcInItqMZjMLtoLk3K5vUSkbL1lnXC6B5/SxLS1/5koEIxfwdSRCkPlADzII6HrM9yqol6Mg4dxSsaLpspDHbW08nCGXIcMKULLsBkfFvmUb+PUmOMoLOSoeFBuXyoMIK8GdLg/B9X2wqQ8h8Xss1wmbrwrVP+Hjkp7N6XTnS4z1E/3dWtppJpE98fjwOQWaxdcfRNKT0cWBamhmQlohbVEqDHbw9qkU5DFgEF+1+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+P/My++4Ew84cg3VAoBU3wvbsMYWACD8uXgvo36a9II=; b=RoUcMYURxmThnTmx0K/x0Hy2rCqC4OaowjHcptBw1QAS62MH8R925TG0o7ldBB6ZivfxSHP62mtJCNFREt9S885abMo6F3LS914PdQhNCIBghKgmSSnIZcJ5zU8uxCcbpaaOracsRxZ5IFrv2jIE3WchXrC8EA8cVu6nxiF29BTz6md1nCm6vpGgEG9EcCONMr2Pd15L7NZ6cHMl/c8xWlmhOxrYwN6NSV+oKgVNPW0pHJTad8bY3EMFeclFJFp/vXqf6TqKHgbXp/xOCLhUasb7//ihIDIjTnp6vgviYBl9OAP8/TE6aJlwjq0kSvYapKrbDHKsw4A6cEgygR8K3w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by PAWPR04MB9837.eurprd04.prod.outlook.com (2603:10a6:102:385::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.19; Tue, 28 Nov 2023 14:24:40 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:24:40 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 23/32] selftests: mptcp: flush userspace addrs list Date: Tue, 28 Nov 2023 22:22:16 +0800 Message-Id: <522effa606f2173fb6fa78755b44b7da75d61296.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SL2P216CA0178.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1a::6) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|PAWPR04MB9837:EE_ X-MS-Office365-Filtering-Correlation-Id: df4f22c5-ece0-47a2-372c-08dbf01dc22e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xpgjaQaTOvz/b8zbtObtFVXEs+qxAO7i5nrqkvdXndooaWCkxtUACyD+LRSvaK8Uz6195fiLSly1eARB+e8q29tiTlywlcCsWA7MInBM5MLxXwYK2E5xLoQJ/iCydbPiLvTbavHuydxa+SaU/7bdxQx/qvxLLHvcGTNE0QmRjnIqEaBLd3HdRwhSbUPpo/E+JJD1VY7P+/r/NkG3ICv+dgCCWg6DzrUvtGE/VqiCkbYun9vY2TNHI47ORttfGixjsvpksT5FX4W1m++EiO1pB8sN5mPzUCRLK5aehQeeg05fBaijJ06jjdAjYeAfwAr49s7tVYDohjMlUwjQ1rVNgr70k2mRlO3GrQnEleUUj5syWY7HCxbcf4gfv8cqB9rSfsEqXr2zEvzifaLWWibwEDR21n/p1nOb/I5wfvCER0CiaNYqH+HvguofgiGNdlhJgkgaXwbgTtWBRNpRJ47t8Q2QF3E6AeMn+yDWnZbIx+1L6ZsfWKxtYSdGA+Du3rIW6xfZIgcjd7wUtnPeWGo8e+6Y7kIFhLQCKMxnvACRaxlpHp/qZkuq2cHRiIpihP1X X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(44832011)(8676002)(5660300002)(4326008)(41300700001)(26005)(8936002)(2906002)(478600001)(6666004)(6506007)(6512007)(107886003)(2616005)(36756003)(83380400001)(86362001)(316002)(66946007)(6916009)(66556008)(6486002)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WD6SVz8SZkuzcYD7fk1Mj1/rKlIULCDfDJrnWQ58Zhk2ho56wlSicLZJLdJVQ2m1i56pYtzUZS0lA/MbT8shkBjw9PWnFDM3CFwU57uy2AnC33QmPR082TdMl9LpFa1wbPHz1EZN5FS095dWi9T8zHGSn+c4GWfzyT1Ph786DZIj3fuc8l92sFpf7YwT6f3BP/s5Dj4krSr5yu5woWXCLJM0a5YbwCGjr1XLCvBTgomtemi5KqS89ZQWUdH5FKZGC5Z/+6JzBtzhr7kFyAupBeLh+Sdw//hg7db9b4EKXXE1d4914kYMsGiYMGmZDl0oTGH3NcOWQ+4lq+6TAPCMk1xNthoNO6U6mTtRyyfpOdVmwiTbB8c/4efhYichtbrVMujEAWsYShtAWvvk4hg46B/OXGrbMagjr3bJUXF3KXlPP8+hrOzKRaqXM/9UgaOI08JamzTcm2M1XB5ded/wis5W/oWGzRvQaEN7MPschS9YVK6CLxCfCyPDWiRwr4yYzgN9euaDyJkayoASouiQk1/9O/r4wJqNZmDYL7gsxAwfqMil7TFEkt0mb9vzls7kMk/pUAUVZkAvA5a7+PAD1KxWIOpOAphgXrJVtBHT1I2MUV0Lkod5izvlUDHwp2tRCemSI/JUmfTPzJ/7qKHoQ3d686pOZInCl9eCbpuceHP3CAXIzh9z6r6DDuNBJRwkL+JZrNplkuCwiZVZmgPW3UFZHhQ9BuJZOhUEBTGe4Gemc8ig5DXS/M0Au5DVnytOMNKrBzWkDhLRvNEXuHdFDBcvv0MqCbj+6aY0eV/y9FaXnnOvfFxT63ArrXkLFYnQ/APov5ZyQji5McmtT5xAE2qRiVTZFeE5DwLDMoCPcloxYqx8SE+wVS1IS6Cj58hZ8ekM/PKhz+5xyBCabfZRKAr0qv7zAh/5ZiUXdfLDSUu4QD2316lCGzjEGS7+BwDAXDCZseDP1ayyQZp4CC2RnYnSrjhyQbe/EBlyfzI57ciWHJLwnfHS/sfgs3qtsG5INrfH42bxzCXPjtxG64Z1jlOk/gzYXsMGNR2jYOEOo/wVO76Wnlr3Hm2B/y5ZuMqPcrofYvOt9ZYnxQ3g7u+eu+hoWhB6D/2GLJWKml0lodficRcxRLActIClz+/eZh3nr2LFuamW0m6cOhGyKunLz8PbtHMyG2lHKBQLFdtb09QIxB8tb8NaFHITcnshlbR4FUh5DeaZChDeLTK/oWvTpN0DrH8A8QbPQ/yW5aevkzx3Htgzbv5ADRDro392Vp6M8fp6h2lV1ld392P8jsc5IislMbsh5vE1yWVWWc8KofJsmgbQQKtggonQJY8k+dRzbhjcU2GcA5iuiG7LVeEHuu/q/OzdPL1ZAHq36/YKgzsJoGuveui+vaFWGP6O2vze4ttJgvoDHGe4D/vwSvVansJMXd9Xp5Yv0tcofJBCZ6SN+bVpgY9kfJwq6vb6vcN3CoiCczUjYzJLhWLtXvIBsjzsYHdNUpgm3zoB9n2B5As41P46u+Ue29VCs0UCvkzkddNUOr4ev5myY7DKNnKZEozGta7wSmkYvIJspuo4+e2kt8V9utLuyyZWNxHJCu3x X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: df4f22c5-ece0-47a2-372c-08dbf01dc22e X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:24:40.6383 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uVKhvNwxHvMpqEv3e/FMhdxFbUvfvljB2HqnHajis0Ybg8sytLkFjDRk7/ZxHrdB+I0NNWcx3JNORfX3lHe/0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9837 This patch tests newly added flush command for the userspace PM. Add flush commands into userspace pm dump address and subflow tests. And use dump commands to check if the userspace pm local address list is empty after addresses flushing. Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index ce5b5b71e508..a2baae49a451 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3513,8 +3513,8 @@ userspace_tests() wait $tests_pid fi - # userspace pm dump address - if reset_with_events "userspace pm dump address" && + # userspace pm dump & flush address + if reset_with_events "userspace pm dump & flush address" && continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then set_userspace_pm $ns1 pm_nl_set_limits $ns2 1 1 @@ -3532,12 +3532,18 @@ userspace_tests() [ $ip_mptcp -eq 1 ] && dump="10.0.2.1 id 10 signal " mptcp_lib_check_output "pm_nl_show_endpoints $ns1" \ "$dump" " dump addrs signal" + pm_nl_flush_endpoint $ns1 + mptcp_lib_check_output "pm_nl_show_endpoints $ns1" \ + "" " dump addrs after flush" + chk_rm_nr 1 1 invert + chk_mptcp_info subflows 0 subflows 0 + chk_subflows_total 1 1 kill_events_pids wait $tests_pid fi - # userspace pm dump subflow - if reset_with_events "userspace pm dump subflow" && + # userspace pm dump & flush subflow + if reset_with_events "userspace pm dump & flush subflow" && continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then set_userspace_pm $ns2 pm_nl_set_limits $ns1 0 1 @@ -3555,6 +3561,12 @@ userspace_tests() [ $ip_mptcp -eq 1 ] && dump="10.0.3.2 id 20 subflow " mptcp_lib_check_output "pm_nl_show_endpoints $ns2" \ "$dump" " dump addrs subflow" + pm_nl_flush_endpoint $ns2 + mptcp_lib_check_output "pm_nl_show_endpoints $ns2" \ + "" " dump addrs after flush" + chk_rm_nr 1 1 + chk_mptcp_info subflows 0 subflows 0 + chk_subflows_total 1 1 kill_events_pids wait $tests_pid fi From patchwork Tue Nov 28 14:22:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471258 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2081.outbound.protection.outlook.com [40.107.105.81]) (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 5B1FC584FB for ; Tue, 28 Nov 2023 14:24:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="GAuIDd1C" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F9oK9Oon8VmDG+wYRccYvgmOmjHEdRCRMHPN1IVAHmJ5rExgYdfySgQ18Cusfx7+nITd95lHFJJJ/DD8p+u0htSMK04BubTQVA8Rszpz31qzadG/wxqexwn9d8F6T0OcUaNZUakuFrdPd6+31fK9/JEZpBRPvUbplIvIdNlx66yK0Y/VejbaxYYgXdEHbLpighfGsfRs2Vf7gJ7MCkvS9L/3kqpDa6/yqiE0sGGoAaR2KnS8tQ4LhZ1C18YyOc55Sylmisy7RTxleBB1gIjOZVEXeq85OPdgLk6UjTuamBTYFLXi0y+iKGs38ln/T+/L2hDk4mO70VopNXl0gXXyxA== 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=0pniVddLH6ts6xok3y2xfxjPsHWnK8WegizqVMsEvsI=; b=YrrR7JSgmYJ2YBqGFVTTLCCeqsfa+SZdeRnBZ4a7qhmSGY7TAhgP4SzxXWR4hSS18hWvgmicShPkfwNkEzK9jpUgDgzLDU3n90mtICqOAjLo4tUB3RiCSDOxYmrIE2Q4uPcINXrB3ZenrFU/TW2zLdH9/OjC3bHsneMi6/Lb+FrXPLAZXvGcCzY/I9aThNw9eC+3SmECka/9iwn+/P8p99X2az+5uNsQwNel+qiiH/HZjWstDWGPIboPw0xCbwmpeLtdgoqPj0ZC2qMQ3heK/RHrSabJ8+Z9dY6WIK55FbYU1RKbBsFSg0tRtkNvdTlBjeUsW2RKswOgEE06OyZr6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0pniVddLH6ts6xok3y2xfxjPsHWnK8WegizqVMsEvsI=; b=GAuIDd1C2zRJb/WDy12GDrsh1TGPqwCe0/jS8PoWKPetqVAJFVSWhB3hO7xnYeyFzAGRKvS63EAB35KcIGyfumc21FqwmZJxkUsGlTwPGIDAmzqhJjxKwGojfjnn4ma4ILJUPOXpfTNJeV4SwIrKRaQHrDucCX2WcEEeXx1C76LINLMRHhOvAfZZ1ynlXFHh9MA10C8DXl1Mf5DK4XV56iSlfiih+jr+2UwzaePnhs2fC4BgZXe19MCRSVy48HB+EYoCwyosQnuaWgW2DKa+gIdFeWPqXwYMLwheCc1IXvQhbNpMzQZ5NPUW0Ktxi1DBwwvYTRp5QWA797bj+IxtUw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by PAWPR04MB9837.eurprd04.prod.outlook.com (2603:10a6:102:385::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.19; Tue, 28 Nov 2023 14:24:46 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:24:46 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 24/32] mptcp: add use_id parameter for addresses_equal Date: Tue, 28 Nov 2023 22:22:17 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0015.apcprd04.prod.outlook.com (2603:1096:4:197::21) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|PAWPR04MB9837:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c02f5fd-7dc4-4a5b-8818-08dbf01dc57c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aHQN135lEO7FtLCges5ksCPawGUJ/6WtvD0XJUTGVQ9CDTMZyrru4baeK9V+jMvvVIWLqU/rVGyBL/rOJUP/rOGZQANS1BBSyRqkEzftrNypUyPlbozPrqa/OjfIti9zgUOK7I7AU4gTGP/CmgD6D8kqAbpoMIm2bx4dx/fGBNEiLMwv5XIkFI+sPPRR0GIEkffDCazrDqKyKWXgddTTNU35pZ9VseGRO7OgF4BBbun1KKwld9ukvZYgA8C7uuz0jUB+4ryWF0BUyUkqqfSbKiF6HxuCel7PBANEQVdHjX6x7C4NQBZ85KkFaoZX3vpL6Av4/BNsJy39o4wUcYSOFaUVGxxiUd5wKVkmlZxSrVHW+IJLmf73UAGzn2y77o7C4jX67pS8lCt+x9+35f2kgJWcFx5vbEZWYEigSKRs5UxCHB+Z50rH/sV1pSOVC6sRL4lpbYKRdltdHJ7uw77gl3xefS+pFSb4YCAH+B7Y1727+RwCI2o95FcAJfc9yJQuRlB8LP/70tCsQza5jfKVNAmeYZuZZJFS+IldgQw2w6NIATSCkBLus5yfTHx6X0bm X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(44832011)(8676002)(5660300002)(4326008)(41300700001)(26005)(8936002)(2906002)(478600001)(6666004)(6506007)(6512007)(107886003)(2616005)(36756003)(83380400001)(86362001)(316002)(66946007)(6916009)(66556008)(6486002)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 666EpNEBMvJ1oQAFqm/dstg0QNfknr36BS9AVhnOPEAIpBkJmz0a5qY6a6x+0IZTGai0GWzUAwMDrnTXKoCsPAdtx7IPEg1tsFhPyLnkgLxPxNFFD01Zsp462zOlZTtLY68xbAQelCJq4BiZR5vjHEQST+SxB6cwivV4WSrRIuGHWbMqR5HWhI4TQ6Up5fS/oVPYCHa9eZDxQywa8hc/0KCYwfNnon8eUUUvbUBBZLnneo9k9mpKNYnOxJxQYPHVc7ENhnZla3oJzuR68BPz2wqOlTzbpoX58ilmyO/LWehCR3a3D4DYOrUCZcLL7ntruE5LO0hU6C1ciJNALCrTeIQ/8Mz64VnZADMuc5y+clZARgmsCDSkt+W9Vu7Fakz3bFMNgAey1tQEPL3IRT0iiD0J/Z1zc2MJlX+/4TZxq2hpRBxg4wXAEtcrDVdketXbwb62B9b9qsnrgLKE9uqvrdKLlKoa/4PE34GXnS27jhnX8REduVWzv3HZPr1XyGXGRWR6ml9eYgI4EMzVDnKc7OcYhdvnB2t5yLZl+9Cq9291OYmKIMtMLEoD1ZBdHD/ZXnPG5ex/KB3chfyeFCzI0jozcaCl2T8Zxjx5OyHLptFDOFDiGAx7hukrLO3/B+BSSR1hsTMiqA7elSwbj7ALf02G530Z4BWhhFPYe7QDV9jNycOu4Uqce2MORue+eTAnJH2GzQSM0wNS+ox2b7giMs2CRLtuuFFFwGOrY21TW3iWZEfGi4Lu7/0UAYPZGarrOvlut8zucaPiRdo/xXgzZbKrBCLgPnR9psg8WHt9NulPwkvh1Vsp5twnZS9em6Lk8tkcGN5ZIfyp5SIseeRc5knxswaYJFvGutVuPCN5SGwMep16NRbAp+V09A//KP9Vr6F4rt3PQrf1qOJVZbz4Oe8RvzwH2DyRihCnSd0l0iuuFjrlsfsyEwnN6WELKYv2eRdr2Lapb4ZpePgoshY7fODs7PJofKRy9CtzvBlJd56CSLUenmDCJZPnQudYCmWBEzQlG3CzTCv5KTuJemJkohtehOJGgvj20NmxzPO/zvkoF/Ab+RfyTb+vuDCtAC06nChM7xE6sWfllgl+nr+CicYeL/TgcsWaQon5CoKTcA6+yg8Q38JGwasnLOCIFNGCWU0Xk2Uy8CL78ToMvAjNVWRn7OY3a0WpI7x7f2RrY1zoV7bBzuluwFtYJrytFzYPiDk6kLpH+eOIDWfgutLBFq1PMFjhykKKCxM6GrhCa2//OK2z4sYP47dLt5FCTPyxURTaw+3RFZLbtdusqafv5VfR7RqsFvy5ITRgF0VpQ8vwrJuk9u2vbPT0wZXOD6YMYZPufBACmJWIetPkQcm5suCANhCYQ81Cn9Jk+Uh9k+do/AAGnbwMCNDsfI2OUumV9ZBpgmKK587W9rYp54+CDLxwZRflJh0pfS01NYI9aj9Jbay03RP/bUOG91bz3wawlp/c+0ti7JVgXQZ0TDma0FCT4PRWVmcyC/cgo2UJ6Zs9UpMjtFrTtqgvcynZSB4wLPm5osFDF7nkWWUcPL9zyDTG+QvGohMifS2D/x7BEs4uvaFwsQ34LOgt7z+vZYuZ X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c02f5fd-7dc4-4a5b-8818-08dbf01dc57c X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:24:46.7339 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8tFydtgc8Txbt+nbUGqpNU1DRuo2eWHojZQZRBRcBrxGlOhuSf6uWo52GD2SyWasOtcWT21+oTq6gLZyk1WU3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9837 This patch adds a new parameter use_id for mptcp_addresses_equal() to test the address ids, as well as the address. This can be used to test if the two given addresses are identically equal, they have both the same address and the same address id. Signed-off-by: Geliang Tang --- net/mptcp/pm.c | 2 +- net/mptcp/pm_netlink.c | 32 +++++++++++++++++++------------- net/mptcp/pm_userspace.c | 6 +++--- net/mptcp/protocol.h | 3 ++- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 48ff7ce20890..77a0e859076c 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -420,7 +420,7 @@ int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) */ mptcp_local_address((struct sock_common *)msk, &msk_local); mptcp_local_address((struct sock_common *)skc, &skc_local); - if (mptcp_addresses_equal(&msk_local, &skc_local, false)) + if (mptcp_addresses_equal(&msk_local, &skc_local, false, false)) return 0; if (mptcp_pm_is_userspace(msk)) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 6bc1a6b5b4f0..6ad8bb2f32e9 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -47,7 +47,8 @@ pm_nl_get_pernet_from_msk(const struct mptcp_sock *msk) EXPORT_SYMBOL_GPL(pm_nl_get_pernet_from_msk); bool mptcp_addresses_equal(const struct mptcp_addr_info *a, - const struct mptcp_addr_info *b, bool use_port) + const struct mptcp_addr_info *b, + bool use_port, bool use_id) { bool addr_equals = false; @@ -68,10 +69,14 @@ bool mptcp_addresses_equal(const struct mptcp_addr_info *a, if (!addr_equals) return false; - if (!use_port) + if (!use_port && !use_id) return true; - return a->port == b->port; + if (use_port && use_id) + return (a->port == b->port) && (a->id == b->id); + if (use_port) + return a->port == b->port; + return a->id == b->id; } void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr) @@ -110,7 +115,7 @@ static bool lookup_subflow_by_saddr(const struct list_head *list, skc = (struct sock_common *)mptcp_subflow_tcp_sock(subflow); mptcp_local_address(skc, &cur); - if (mptcp_addresses_equal(&cur, saddr, saddr->port)) + if (mptcp_addresses_equal(&cur, saddr, saddr->port, false)) return true; } @@ -128,7 +133,7 @@ static bool lookup_subflow_by_daddr(const struct list_head *list, skc = (struct sock_common *)mptcp_subflow_tcp_sock(subflow); remote_address(skc, &cur); - if (mptcp_addresses_equal(&cur, daddr, daddr->port)) + if (mptcp_addresses_equal(&cur, daddr, daddr->port, false)) return true; } @@ -205,7 +210,7 @@ mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk, lockdep_assert_held(&msk->pm.lock); list_for_each_entry(entry, &msk->pm.anno_list, list) { - if (mptcp_addresses_equal(&entry->addr, addr, true)) + if (mptcp_addresses_equal(&entry->addr, addr, true, false)) return entry; } @@ -222,7 +227,7 @@ bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk) spin_lock_bh(&msk->pm.lock); list_for_each_entry(entry, &msk->pm.anno_list, list) { - if (mptcp_addresses_equal(&entry->addr, &saddr, true)) { + if (mptcp_addresses_equal(&entry->addr, &saddr, true, false)) { ret = true; goto out; } @@ -463,7 +468,7 @@ __lookup_addr(struct pm_nl_pernet *pernet, const struct mptcp_addr_info *info) struct mptcp_pm_addr_entry *entry; list_for_each_entry(entry, &pernet->local_addr_list, list) { - if (mptcp_addresses_equal(&entry->addr, info, entry->addr.port)) + if (mptcp_addresses_equal(&entry->addr, info, entry->addr.port, false)) return entry; } return NULL; @@ -704,12 +709,12 @@ int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk, struct mptcp_addr_info local, remote; mptcp_local_address((struct sock_common *)ssk, &local); - if (!mptcp_addresses_equal(&local, addr, addr->port)) + if (!mptcp_addresses_equal(&local, addr, addr->port, false)) continue; if (rem && rem->family != AF_UNSPEC) { remote_address((struct sock_common *)ssk, &remote); - if (!mptcp_addresses_equal(&remote, rem, rem->port)) + if (!mptcp_addresses_equal(&remote, rem, rem->port, false)) continue; } @@ -884,7 +889,8 @@ static int mptcp_pm_nl_append_new_local_addr(struct pm_nl_pernet *pernet, entry->addr.port = 0; list_for_each_entry(cur, &pernet->local_addr_list, list) { if (mptcp_addresses_equal(&cur->addr, &entry->addr, - cur->addr.port || entry->addr.port)) { + cur->addr.port || entry->addr.port, + false)) { /* allow replacing the exiting endpoint only if such * endpoint is an implicit one and the user-space * did not provide an endpoint id @@ -1022,7 +1028,7 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc rcu_read_lock(); list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { - if (mptcp_addresses_equal(&entry->addr, skc, entry->addr.port)) { + if (mptcp_addresses_equal(&entry->addr, skc, entry->addr.port, false)) { ret = entry->addr.id; break; } @@ -1404,7 +1410,7 @@ static int mptcp_nl_remove_id_zero_address(struct net *net, goto next; mptcp_local_address((struct sock_common *)msk, &msk_local); - if (!mptcp_addresses_equal(&msk_local, addr, addr->port)) + if (!mptcp_addresses_equal(&msk_local, addr, addr->port, false)) goto next; lock_sock(sk); diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 8494d6df866a..06fe6c65b4f9 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -54,7 +54,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, spin_lock_bh(&msk->pm.lock); list_for_each_entry(e, &msk->pm.userspace_pm_local_addr_list, list) { - addr_match = mptcp_addresses_equal(&e->addr, &entry->addr, true); + addr_match = mptcp_addresses_equal(&e->addr, &entry->addr, true, false); if (addr_match && entry->addr.id == 0 && !set_id) entry->addr.id = e->addr.id; id_match = (e->addr.id == entry->addr.id); @@ -105,7 +105,7 @@ static int mptcp_userspace_pm_delete_local_addr(struct mptcp_sock *msk, struct mptcp_pm_addr_entry *entry, *tmp; list_for_each_entry_safe(entry, tmp, &msk->pm.userspace_pm_local_addr_list, list) { - if (mptcp_addresses_equal(&entry->addr, &addr->addr, false)) { + if (mptcp_addresses_equal(&entry->addr, &addr->addr, false, false)) { /* TODO: a refcount is needed because the entry can * be used multiple times (e.g. fullmesh mode). */ @@ -145,7 +145,7 @@ int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, spin_lock_bh(&msk->pm.lock); list_for_each_entry(e, &msk->pm.userspace_pm_local_addr_list, list) { - if (mptcp_addresses_equal(&e->addr, skc, false)) { + if (mptcp_addresses_equal(&e->addr, skc, false, false)) { entry = e; break; } diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 7441e3b9443d..d132a8d91d10 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -645,7 +645,8 @@ void __mptcp_unaccepted_force_close(struct sock *sk); void mptcp_set_owner_r(struct sk_buff *skb, struct sock *sk); bool mptcp_addresses_equal(const struct mptcp_addr_info *a, - const struct mptcp_addr_info *b, bool use_port); + const struct mptcp_addr_info *b, + bool use_port, bool use_id); void mptcp_local_address(const struct sock_common *skc, struct mptcp_addr_info *addr); /* called with sk socket lock held */ From patchwork Tue Nov 28 14:22:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471259 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2059.outbound.protection.outlook.com [40.107.105.59]) (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 16FAB584FB for ; Tue, 28 Nov 2023 14:24:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="kp2XscB0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kES8psbT3OLy6N/4wIka5jDRf0MNFuX22E7y5slKEUZw+vYSmgfT/2Ympw1htD3WhTpJsgX4IThsmX3UFS07fZayguHB+yu//GZhMV15mJm3izhYtRboDlGsGF5wZHZBPVmlTXhGX/fSumkqAmTK3Eq8OJiBJTIYoJQHYqqHEO/hLbxn0VlLMwvZnANHJwcP8tiO9EIyHhXj611aVcgHxQeXheORXnnpEjAZzdxbbgSzN0b1qYE9MKeKIfU66ua32hht1CY9qOfaPPMxAgAoSItj5je4QiPQMlxUfaOQOjDx5a1YXCX3Nk5XblneXcAfXctWS6/xgNPBKpQGDxLuzw== 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=1C+mGleUJvXIa3Wci6uvGa1nefJUd2Vo8WcldczX+lA=; b=MyteF5K9V6doOCH/VpknSY2fnSXwd+p1qCrZi9Kq83Xu0N/k2KiLes8TF3dINN/QvKpVrRAvpaz9YopHeycA0+VTzeozCUzMvJPKQb/AABFkgsNTsef+puZ2Xi2xoFe450flZO+FVwKouhM4e/zkPXFB2PY7lue65rDZNuHjdY1ww1K1q0lvhehuhydXP1Dc9k+r9M5ulWWIUOstPSCl49jaPPXcsmivqIT3atXhWWsoIw1JeDvDyigfrPUV6MkXHDurwRMxNl6XR6G1POuaItOtKdbQRMh+KBuIcoapuMM5UCG4ezJDRicGCQv2xmTwN44Th6+Ye+pFcDHuKob/hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1C+mGleUJvXIa3Wci6uvGa1nefJUd2Vo8WcldczX+lA=; b=kp2XscB0zTCQkJQJuGuB2yy845WtpcGzagGMAsIgx1K1mgB+my7jmSBzdU7pnFoUZKW2VlOlwy1GKt4ECuGwC+rUtXG7WDfypCTZygUwnp2I8f8HZutAVN2JIEK7LIn1qHesRFCqzPZ6IRjnx+rOEubv7glCSqqEQwTFAYgAzwQbMskJeoR7Qm1I/nJVs1hDy7weUu//6hJuD/D7wqPuFrDeVCWExbcr+AaN/fx8UpFoSzRmV+EUaLOvt4Ihhpj+zBgD7TZOHNq8dA/7NsZ8X0OkDyIdyb5LidaPvvIjWAzDHeYOf1wpHwjztcP8SH9ZwpY6y73Cx777ZBhOONaqLQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by PAWPR04MB9837.eurprd04.prod.outlook.com (2603:10a6:102:385::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.19; Tue, 28 Nov 2023 14:24:53 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:24:53 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 25/32] mptcp: add check_id for lookup_anno_list_by_saddr Date: Tue, 28 Nov 2023 22:22:18 +0800 Message-Id: <24d967e1dadcea8c2a51e4a19f9344a3c7a1ca37.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0008.apcprd04.prod.outlook.com (2603:1096:4:197::20) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|PAWPR04MB9837:EE_ X-MS-Office365-Filtering-Correlation-Id: 17e069e6-39f7-4e83-0647-08dbf01dc95a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3Lx/1JPpBmHa4pAyPtduCiQ+Lt674zZ0amlVnQ7cphXo6yqWtutzQ3X+yA1e4E5jwJCVhsl1rxqpwt0iZZV0UlKNpZtJCVAu50Q3p2x9B/6lojOQPKXyydh0fynrqPYmA2p93sdLqzX1AHru9ZfKnjPTPHkkdrqJ2xZ6xEJuFQpUU9TmCRy2LLP0kWt1glpA1fgY0FydZXftEWbeIiUAXXnx73qUcSQnHUdOj1sv1GL2aCnM/9VggvKJ3pX/x1lbZ0EKEarOZg7qfPA8FRwo8oBLvrOjl2ij5xL4ojx4bGHd1IEWQtUSy493z9WByk4SpxsF6fZ+e4qHvTWSGbjUzUTHr9L0xYCfaMEGbDsT+R6FBU7zpDvIhtFZ0wIYjVKKiNOrL1P2yrI2w7On0UhohsIaZO/WU8tPcRoAYVVOulWcZSPNnJ9JAJNDzRGKSytGoJJENLsxNkE1wGv370hTiqREuHZRwd6dHtg1rPqJXRsiUM0HF6TzknXcU+Svv3bNP2BxRn9N3gQOFK+tX2Z+L7x5HW7WiwKGX+t+uGV3yNNdcSiE9VuvcagepGOrFWkc X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(44832011)(8676002)(5660300002)(4326008)(41300700001)(26005)(8936002)(2906002)(478600001)(6666004)(6506007)(6512007)(107886003)(2616005)(36756003)(83380400001)(86362001)(316002)(66946007)(6916009)(66556008)(6486002)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m5B68DngTr8H/SSaF4cKM/fsY5qbfbLbqfcw6neA0pKavV6LrmVwSNEjplAOh+SF0Hb/jjgBYahGQ58V3BfMySNZGj3bpM/CXloCsnSZAQ7G6gvJTHbY5donvyyERu+rpflt3s/mwc2NxP3zv7kTF4OrvtBZGhh900RjqwZH8dJJDWlqI8ruEIndThXpk6kQkEWqc2oT53JsXN9dzzBUNgF6MSFscbrYS+UzeDCPAyEWnXvchHBRmF7SKTCo4QptwELShqaxA+2RiXcOhVlbZfkhkFHikhwmd5iJHU4/josnX0OM1pg0/Lf1kD5ydUOFU27tqNUhgdB1xeVwMVE8AVn9Y3oZEEB3QpfXytL+yYDeKbCVNaUnirmJCnGZR/5qInSLd2l2q8YVdKkP+8FqEr3av4qUu3ojKbMfNwkbG5I/p6/FtyQqRk0N10Rox50I6c1sj5r6h55khl7q537ZCFO3uQo04MwULwFaw1I7PmDjO1JKccqpkR6KpvYSR109vkOlIixLMstotv6wTb/+2yXAwYsiCjsBMBhDx2PiHLwKd7/jnaF74dNdFlcGTIYp0l2HUJTyyAORG+gf6bK/WMjqxfU7zCmlXeACFSRqfWHa3zAMhkbEkB8VJtZSo4L2SS6ZT/TV+z/fkcE3Hn5j81cVqeVzEbN1En2lYkLfgvIjFtO1DGUgnb4fbeX+OQeden0GZ/wcYlx92yte8I1d4dlNWSxqsQmN8oknGTHiUBnX8wU0vS76rSbVW1uucnFqpAIWnOji5KzvAJ6r5ul3dT3adFleo1Slrpnq+tIIBxdkQ/1t3ZigR6eg0KAiSt9IPkakvP7z4GjC7QJg4uhYMZFHRAd18gkf3VbPc3AVQEGYUIaOgJPv7lV36AuI8Vbg9RTkp5BwjrgUbOkP3ioYqfjyzlvQRZdVuOmAmKdxPdaHiIASrTVfA5l5A/0Fgfr6fhAKDVQrcdA0JPRRE29wMO5ypq3joroSKE8EyzWxbuI/Wem3uytf50OFiZ5M7G1MBi8qJOYUSpbWMAWBpMbsw/DT8YWyugLBJcQOPRzb1G0EZsmeB83vvW/L+Hxnw/VcAEMMx21q99O3hY5C/XrZHCl8cshc3+ulvJaqKgCpusBE3gQnv1AQTJORosQeME1uko5sITbqiLZW0mzgdVEmW2N1GDrfxtLZUJwMCC7C6QxCTzNiRlYlaFB//nF0Eh0MBrZW0ZTW2DjXx8BUADinGihKkV4isGX5tJlo9zxXhg2zgaPoX3H1tI0vMWC3Y3Gl9b1o2zGRAX8MdeSPIeAlrN3jZJh63TfmmsDN3kXI2M/1327lELmVwXVS0V2bua+vnikI8kMvXWw3hlBCt7eE8aTfD9Zc3x8JkOCbulgIlSdqWMuvu8tgCRZCccPe5QW7Nt8Dx5ol23zYePh8mcyz3SJ+90hFMsrV1WAJwAevgj1bWPFD9BxT8SrJWiZEqSrScMVdpV6ohHxksybEWnwk+4UKPJy8lN5TtMlUY1w9dmrDe/NWEOBx/bqF36RjcG9EZVOtnD9soJnCj9om1Lf++k+WdQ5KfJygHWebKan6BqDlPbe01NGskosukUx0xPxK X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17e069e6-39f7-4e83-0647-08dbf01dc95a X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:24:53.0631 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EQcZO8Wihw3gp3YdcPZLdxl0CnRxXDQlD9OX9bzQaCTziMTz2uWcPva/2seeNQpjIiX0wbdNJVtyVuUkeKI2Jg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9837 Add a new parameter check_id for mptcp_lookup_anno_list_by_saddr(), and pass it to mptcp_addresses_equal(). Then in mptcp_pm_del_add_timer(), the input parameter check_id can be passed as the new parameter into mptcp_lookup_anno_list_by_saddr(). After this, this condition: (!check_id || entry->addr.id == addr->id) can be dropped, only test if 'entry' is NULL is enough. Signed-off-by: Geliang Tang --- net/mptcp/pm.c | 2 +- net/mptcp/pm_netlink.c | 13 +++++++------ net/mptcp/protocol.h | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 77a0e859076c..d5ae2e775059 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -259,7 +259,7 @@ void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk, spin_lock_bh(&pm->lock); - if (mptcp_lookup_anno_list_by_saddr(msk, addr) && READ_ONCE(pm->work_pending)) + if (mptcp_lookup_anno_list_by_saddr(msk, addr, false) && READ_ONCE(pm->work_pending)) mptcp_pm_schedule_work(msk, MPTCP_PM_SUBFLOW_ESTABLISHED); spin_unlock_bh(&pm->lock); diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 6ad8bb2f32e9..c141ac8ba1ef 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -203,14 +203,15 @@ bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk) struct mptcp_pm_add_entry * mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk, - const struct mptcp_addr_info *addr) + const struct mptcp_addr_info *addr, + bool check_id) { struct mptcp_pm_add_entry *entry; lockdep_assert_held(&msk->pm.lock); list_for_each_entry(entry, &msk->pm.anno_list, list) { - if (mptcp_addresses_equal(&entry->addr, addr, true, false)) + if (mptcp_addresses_equal(&entry->addr, addr, true, check_id)) return entry; } @@ -290,12 +291,12 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk, struct sock *sk = (struct sock *)msk; spin_lock_bh(&msk->pm.lock); - entry = mptcp_lookup_anno_list_by_saddr(msk, addr); - if (entry && (!check_id || entry->addr.id == addr->id)) + entry = mptcp_lookup_anno_list_by_saddr(msk, addr, check_id); + if (entry) entry->retrans_times = ADD_ADDR_RETRANS_MAX; spin_unlock_bh(&msk->pm.lock); - if (entry && (!check_id || entry->addr.id == addr->id)) + if (entry) sk_stop_timer_sync(sk, &entry->add_timer); return entry; @@ -310,7 +311,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk, lockdep_assert_held(&msk->pm.lock); - add_entry = mptcp_lookup_anno_list_by_saddr(msk, addr); + add_entry = mptcp_lookup_anno_list_by_saddr(msk, addr, false); if (add_entry) { if (mptcp_pm_is_kernel(msk)) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index d132a8d91d10..d40e29419c04 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -920,7 +920,8 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk, const struct mptcp_addr_info *addr, bool check_id); struct mptcp_pm_add_entry * mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk, - const struct mptcp_addr_info *addr); + const struct mptcp_addr_info *addr, + bool check_id); int mptcp_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id, u8 *flags, int *ifindex); From patchwork Tue Nov 28 14:22:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471260 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2082.outbound.protection.outlook.com [40.107.105.82]) (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 195EA58ADF for ; Tue, 28 Nov 2023 14:25:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="LZVkCgaK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aPt/awfmux2UB9Sh3WGE4Hz7F8tH2XgLK5ZTn+Km+b0/ifBN5TRK1UGoU7AgfIXcULN2HemalwX4lxk7C2Bwd94bUYb3yTpWz9t/E6KLvh8hDqGvzkWj5hFsW/xgsw+pOVC81HMibGY0L+lRNJ4QAbdcd3OoOHz7JrLt/gJReV2DjdPYVHZ5b+omGDQ25rSaz/cwV4lsDeXTzttCH5rUBkQuqSc1rKPuiU/vGQHYFaAkSwIFK6uOh/pXjrMZp3yS+Wr54SAAxF0VaAKXRkDOLbAz9WwfODnHhApkuHwqMdoEnOKfjClscGQdyIv/Cmbun87dyc7eJX7H5Z+2+pnr8A== 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=XNtg0ENlx6XyP55fGgvTpB7mqIxaNS8NhC8buwqnLKM=; b=itFdqRKTTr/GxIP6FrX8uYtl3tFOZK1l3mc2JxqFyDd1pMEMazyNtDbFoi6EvvqFWOqGMvhzpW9PBHsZXp2S2H9IEeDxkkxihLLuNKZFwUrblrOavQX4d8CpW487V59cNat4e9+DFKSymUANQGit8/ZtHZ69/pKazGj8BmcUNMpRZnYUnBKygYQwed27Z7TcaVmvTUpyhGyi4Iuc6w26eXHopUfBtNuXX3ZRRrfJIoDU4pnGug9hpO2m0DSf9Uuk4ix1czFx3ea2w7ZqkjCSVFZVsd8jKg2SllWJcLmnVgFqbJ40DfISQeEjz/U2tdk24pP1tM7gQf7YBRphggqBFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XNtg0ENlx6XyP55fGgvTpB7mqIxaNS8NhC8buwqnLKM=; b=LZVkCgaKUjXVeD0rqMT1+kGgBYDCTB25BfApX17KFUmlxRstlELL2yXp/zDHgwlkZQ66UNqo0jmc9DL+0aQ/fVvkxpP12mPD+fs65BBFN625KeLYXkzut2wxwT7qffhMNDk/H0wKdcgb/CN2h+K4n/rkcxToe1KCyGgrAiTwD6xBYu4tPN3nk/DjMnJTAQXxbX77N5zdLlv23OLJ4iHyCvppSXA9O2ZJLSPeeRZipcDRq8ZKUP/nMotWKF1dQ7F+XEGvHMr5WTzNfOp/t0HzfS8Jihaj6yCQk0Kdyqkl15xuliH/lmShpVqx2l2GTOMDoz149MkJKtcl4KCuOjY6LQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by PAWPR04MB9837.eurprd04.prod.outlook.com (2603:10a6:102:385::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.19; Tue, 28 Nov 2023 14:24:59 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:24:59 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 26/32] mptcp: add userspace_pm_get_entry helper Date: Tue, 28 Nov 2023 22:22:19 +0800 Message-Id: <6bf532642cc007e930690a15b66836cfd525a78e.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|PAWPR04MB9837:EE_ X-MS-Office365-Filtering-Correlation-Id: 2d4daf8c-2553-462c-b220-08dbf01dcd0e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PnmJArUqI2IroJ/Iey9DFbKrMX2HTOp0K9gHouRSfyObeuihIaLqTnmNc1/YtHYxQ3VG/Py4LdMNoh1xR0m3ms7HO8aS/SgGmeAdpg/ONTbvdDvNEVXfdMouPg/Tbsg7SA0uULdSP8MBLF8zGTR75cUwPK1BLYcctsiHIlv7jMOWF0N+kG4PfbPBosd4awMxAJEcDOOktI5kw2KyLfp/QylIX4lM8GVdHoIfSsduRxFJGmSfnWhwNYMGE+4+D4Juoqx40TRfA0Ei+aZo8IpN/HIJVEx86nQcDTL4xzHbE4wcf37BOgTaNQH6DfnPtch/cEi5cHc82yfUlpxRS4/YGKeFmz+ZO9me8ku6GsQDVbdCcN3/NYjXnTK0q5eJqtLfLvmsjcFpv3PvVGiAy8tJcPl1yfQ0sQlcH/Q/8rGsstq5KjjljDU7xXuGzrXwyWzk50RDuBDyGaZj3EZJoE5Cg+jrooAVZuFC7Ztvl/e6l5QuikcOuU4xM0L1wNfSlxiLCNLn6DQoEzWsZfHwWhAErkGT+PvcMvcfFxdZLPF69HblMYJgZt4ziNMBRuOH995M X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(44832011)(8676002)(5660300002)(4326008)(41300700001)(26005)(8936002)(2906002)(478600001)(6666004)(6506007)(6512007)(107886003)(2616005)(36756003)(83380400001)(86362001)(316002)(66946007)(6916009)(66556008)(6486002)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hQfcfmuuuI7S9OuUkfcsnqHnmTXI8Q3zU8EjpjiCoLBseqGgwCLRmQJ0IyJk3pIYwcA1ik8SDcS+svvMojnaLJ+o7O2z+KgL4teaAM289otWT9pQiN1yQ7Ir2HDLuFIsw+JnDmttwzs20ipJgBkMeRzf0pmrngTElOEjYTfXw4x2GRfu9LJ1PUoBNiFlLQ9t2TFWZ6tN935wxnluVlAZy2Q7CyVrHiYzrMlEgirImsym5vZDJwLrCKX/ZSUmR797f3s7m/+8kdbJDnzdr9QGCY06BjEAYQyUdvRwt6XHqeMRXSUfGqCowtqqI4tysPBLsbEYunAuXcpiMvauEr7gRYbq8Ej0EfDrqiFPAZz9fTTrqByhYLAxsvJ6CBLQqq77O1ohYec2KIenmbL9HY6Wf9yp9t2gKgotBQzcwk1ZUU+ojLfUcqjs/+Q+YQH2mRqWhK/TZBpW2avOPQOtWCzluQGW1uhfJgxAwZ7B/zK2IlfyFUrsDoieGaN19cCVq8B4BqN9NHJ2PorigTpKEVdA5oJ8A++h0/hWtuYxCDOVyP0z7InHFKB8asSjw0Xz6GQeHUNYRfQXVBH89K3/mSnrF9ua665uQ0W4ivWZ6zAjdvzST3KNdE7fyzen4h03QC0nuoSaOt1/yL3O9yeGmuMAswsucALjwkulgMsGe/3XiugovEkvWgRYpsY+kvwLW+kqpNs77QAQVw6CGe99zRk6gY74F9wWM4a1FfcsfuYWKv9eoW63oau9SoO6WiwCFik1rYRGsr1BRaxuaFTLiIFSt8JhVREuOwwcAO7cuysNS1e+lZvpCQk2U5s5MBAF4gLEx1ZYRBzObw85BYyGvBqJEvU9wx+PzmOowPtHFmwyvySx+l9nJbFAr/9rP0hzQIseRKJbZawuaG1yyn0yQKKNrDWB0TOJFen5ZXbfqIRzwc+e8xpk9Qyimup2RBZNWYSklNsQ8LBoydhew08gRWRtJMxGjq3eBK9j6L/YN+dY2MwDGRZUjF3xPUHIrM586wrFdasowbYmYGx8Zq3ihNxOxQxBDSoF/yaI/Av6EcKSaTDoTojbGzCh9SYdUNU2xBI0cALvFroProS3F3mN5jfFW/pJwNUBjg8csVd0JsVmiuMr55KBfpSTxR/ToOJ5QrcjRHFwpXL4R7QsD23BtVY/i4omSDb6iB4RTImf/MJ48mi8uG4ZGsoVvmD7WlRNO1csoCSuIl07OyPa988B1jJnINydy0AeJS0lidkRDwqK0e9yfag/tcIBT1f0npJh/Z2V8nSrrlE7TBJCvf86mU3ieHUJJ/hFrcM1GXv0uUGaDSKRjM7Fo+sc/gAFUt1Nx3zrjfbQiEBWa14jWnBqp86hXUs+UGWvDA5AajOnzmdjTZROeMj3XMN7qABt3rAbz/UfKaq7KK1JmLT7p5nCdqMrAkrgo+0/c0V1NdQ+XKsg6KsyZVrh2vlW3/e6YktEDPmWLv49wDOOamfpISTJP4mTqWCIAfqr3a79FkSsmuAa9nS2B9P8qwGky7FLw0hS02pEIfLUeie5fVycbGo0pJwda8eBJccvdXBIjBPNCgetVxndheRepiwDWdL5FkwfWw+o X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d4daf8c-2553-462c-b220-08dbf01dcd0e X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:24:59.0862 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wVFB6OOW0tSve91FRLacG1VOR0xd8qS0YBuz1HUeuwnKYQFQTpd5XSTpqRPahkMlS9i7kOInRBjed6IL8DnRMw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9837 This patch adds a new helper mptcp_userspace_pm_get_entry() to find out the address entry on the userspace_pm_local_addr_list through the given address. Use this helper in mptcp_userspace_pm_delete_local_addr(). Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 44 ++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 06fe6c65b4f9..8c7553d7ee65 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -40,6 +40,20 @@ mptcp_userspace_pm_lookup_addr_by_id(struct mptcp_sock *msk, unsigned int id) return NULL; } +static struct mptcp_pm_addr_entry *mptcp_userspace_pm_get_entry(struct mptcp_sock *msk, + struct mptcp_addr_info *addr, + bool use_port, bool use_id) +{ + struct mptcp_pm_addr_entry *entry; + + list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { + if (mptcp_addresses_equal(&entry->addr, addr, use_port, use_id)) + return entry; + } + + return NULL; +} + static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, struct mptcp_pm_addr_entry *entry, bool set_id) @@ -102,18 +116,17 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, static int mptcp_userspace_pm_delete_local_addr(struct mptcp_sock *msk, struct mptcp_pm_addr_entry *addr) { - struct mptcp_pm_addr_entry *entry, *tmp; + struct mptcp_pm_addr_entry *entry; - list_for_each_entry_safe(entry, tmp, &msk->pm.userspace_pm_local_addr_list, list) { - if (mptcp_addresses_equal(&entry->addr, &addr->addr, false, false)) { - /* TODO: a refcount is needed because the entry can - * be used multiple times (e.g. fullmesh mode). - */ - list_del_rcu(&entry->list); - kfree(entry); - msk->pm.local_addr_used--; - return 0; - } + entry = mptcp_userspace_pm_get_entry(msk, &addr->addr, false, false); + if (entry) { + /* TODO: a refcount is needed because the entry can + * be used multiple times (e.g. fullmesh mode). + */ + list_del_rcu(&entry->list); + kfree(entry); + msk->pm.local_addr_used--; + return 0; } return -EINVAL; @@ -139,17 +152,12 @@ int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc) { - struct mptcp_pm_addr_entry *entry = NULL, *e, new_entry; + struct mptcp_pm_addr_entry *entry, new_entry; __be16 msk_sport = ((struct inet_sock *) inet_sk((struct sock *)msk))->inet_sport; spin_lock_bh(&msk->pm.lock); - list_for_each_entry(e, &msk->pm.userspace_pm_local_addr_list, list) { - if (mptcp_addresses_equal(&e->addr, skc, false, false)) { - entry = e; - break; - } - } + entry = mptcp_userspace_pm_get_entry(msk, skc, false, false); spin_unlock_bh(&msk->pm.lock); if (entry) return entry->addr.id; From patchwork Tue Nov 28 14:22:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471261 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2051.outbound.protection.outlook.com [40.107.105.51]) (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 DA69858ADF for ; Tue, 28 Nov 2023 14:25:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="QtTzjT2Q" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oM/O9t4KpqQj7HXEaykq90WBO9sGrYf41I8FMXX9lRGPgh5nD7rRbgxsJjKKqdACyWz8ROlPM6ha0GzBsF0c31im+/uWvxF7XW/9vvBdS+cn0YBihliIvpdVFsf75mdOymQXO/MVNNdZ72129c8zz4Gz34NZA2u6kzHOaiBoZqkH2UcuFs5WfZDxo0nsKjJXPeVzmrg7+6AI0Ns5x/FW8+v9vElOwwbDZSmOjJJHWZBTg1GafYrQcFgzY+Q6uHUiJqd7DS0+RDpFL2TZiZoiVPOHSyxzCT5yoQuAeIhnWl5iWK0pzKkD5ig8kUuqRQWTO/7DgtbCnBNq/7nbJDFjHQ== 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=X6MGksTFx+t4yzf6kvysgft7dLwKH1cppACIWDAADlc=; b=epNBsud6pzn176U6o/JA6EesF28Vbi+h+98wBMKRxPjk67WFGDm/jPnbKFkP9HquMXxvckSQzGt7uQHHZg3+Ea3LnGZZzHPq9awb9iC4qRK9C5Ii7gPIr2KxxOnf6fPMIoKX2BZtaQi5+uim92toDHosencKrROMDwCnTWXE8wnJqvJvEC04bF8Fy1Lz7S/kX1AhDJdmM+mZZxxOGMO5OoU0kuBcgXqhRA/j33/vUSTKJvhmfJ3yqH0jesMiRmc4wVfvts4e7Gp8W5Wrgsj841YyLAdkWNM/HyY0+ohg6qiYBeYFWVWVjWPfZ34zauovk1u3xDYSrzOl1deAVx+qbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=X6MGksTFx+t4yzf6kvysgft7dLwKH1cppACIWDAADlc=; b=QtTzjT2QapedVsVSb/gapvHKE0uQLGmz0A6Jes5Y99NGqCRxl2MzvGwNoIFaimCo6gnf4NFaoRidVM5Yk7R/Tj5WcOSzugpM8yjXcWSahYYdxpwZyh0WQAbO1gsinf33BsioHQrH2q0EEW7voDK/w2L9HiY4aYtH24NljpSBS6epjEMGuDEcPNKxFQ7XHhtFZusQIcK3SJne9PFI2JZ6sa9mrUgtH/WZJNwt17EsvnVMmLKZmmCEVVKM51oDFrXXsxFoyqhR0vxCzzO8Y0wJdOIzuvBO+Glnpey0JU3xWqL7aB5lXZb3fJYnJfzuZOo3Nlg5dRSVw4RE7uDuxjVaMg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by PAWPR04MB9837.eurprd04.prod.outlook.com (2603:10a6:102:385::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.19; Tue, 28 Nov 2023 14:25:04 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:25:04 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 27/32] mptcp: drop addr_match and id_match Date: Tue, 28 Nov 2023 22:22:20 +0800 Message-Id: <273333bbb1fdc6a3e1ed3556036594c31338a953.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0048.apcprd02.prod.outlook.com (2603:1096:4:1f5::11) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|PAWPR04MB9837:EE_ X-MS-Office365-Filtering-Correlation-Id: 80017a5d-a503-4277-5284-08dbf01dd059 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XbLZJjsJp6u60itfvUb9lVWIbMrl3tRsWapBBPX7HS9ZO+EoE9roXjKxV15Ao+s8Na8I9nJx8k2UKbeNpGSq8fsYqS5SIzqK0LxJ5a/xJcgD75tEkPeXmS8E8p6wF//AhqypQ1ptBPd/SZrLesy1XbtZ9VbKFau7W9ksKX9DDsjFQ/koNB/CKlOZebgpJC4hqCvQ4ZMImWCqYqkRnERn3f88x8Flgnx9c57tY/jr1UVAJuoSl3j0Q6c4Xni8gzj+ojQFb+4JiP1hZTWz7MXGOtJoJPXqdkVG3ORxn5msRmZDv7iKdq3/5wgRYhOro5M96IFj8K5LZU2WFkRPK8vPfu0YMt3iVtwxG0s9DULKpdE90qO6H4d2j+zkU852B4jMk6VuqPZ96mG/vxFdzgUMCVwVYfslKVNM+KGXtVyALJ8eoKMflESQoQtyo5a0/On8BhGjkxcU6xGB4PFiBdR5pvX90lqN9nSiQdc4a2q0FP30ftSwSYAIYe3WusSoVxjkJKOzj+JHPRZ9ORWvZM+VQZVQ5asALRjRfhN/YSSGl5MOhPm1yjyO1ANdGVg57MhP X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(44832011)(8676002)(5660300002)(4326008)(41300700001)(26005)(8936002)(2906002)(478600001)(6666004)(6506007)(6512007)(107886003)(2616005)(36756003)(83380400001)(86362001)(316002)(66946007)(6916009)(66556008)(6486002)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qHK6pFvKuO6mcN6Yujq9dVoLcch8sDra64vKO4OuJ7ffOGZEu2xRcD4ZRrBoxI0+xkbtBGvYxhJrbcbpINN1LSFA51Iu9iiBDfq3CDDFDxCdSeiCuM6MQiz1DsNefwHl4qKlnhse6n+u5ZYjhTlOfMMr+cnjbcFqlzJUg97mBi+cEqFbkq//cxvsRyrroDcA073M7rwkuHrwlCZza4PakgMJC+1SGj2fppaxuo18asyWUuZs9QKyPQwoKY+rLc6sx+0mMBE5gMfcEkxmRS/ql2plLY5+5L6j0hSK8auO0a5RIZanIASoo+1HL5TGGspSB1uRhtQ20mQdROOnac296FNe/5oNO5fyoAVm2MN3s9AL0HmXgYbv9YM/WjyGL/J9gjH3kxvA+JOERcdL/apCLeKdphTQHctO9EapLiJ4WyiVjnBjYnaY7RyfdGJN7FX9PaZnudajP0UamRu0pbthipqqSCiv/6WJaj/MetFfFczXpcxrTPZdX1XNnlaNhKQuYCs5vfuAuS5V/OL71eSKw1QJo0j4wEYl1f9Wx+Y30wL2NVs9jQitqVbxEiJ+Rgl4OnsNGyjk+4VfcZRSG5e1aDbgvLQkFjqYssXCnQfIEzpRo1sTMnqrC5vf0GzSGOpOdc9Z6TtNFv2CUF4DGlfXYbTkR6c0lmxKWKnJpmOsqYdbh6qbRfcC6ogwSe01yTS6jQjQhbAB1v0PPd1+FR2tGjxiltWpdWiRzoZ1aFhbQvN5sry0OS5pFTurkdIF3YGZPdYsH+ClAy5yyddZ8G65gGagnvWW1K1IYh5ZoorD6owYdgTAlXmQPjxoPjMQ9KUJdE9n0BhEQWfiQb4BnPrNIQaI+3lhX9plnVPLkf6BAzTUg6jA90Pn61LLBbsu+d59ogyfGWqzV4KVoos9VkfvJEt+EzS2S59liEllQZwPC84j2b8atiAq+7ix7aWZ62kPgRRQGQWxeVuOPMzLgx9K4GJiffiV4ia75OCu3MCGHJ0Lr6Y5WKim7IkN+X5PthKztCzToG8t/r78bpHbVfjKZTc1UtuAAaEe5QVQQ0eZhlrKFq5HU8AZspUsrK5EQcszX2t0u/47VsBZ4PQ2NHkhQsA3Wqlu4Gi4kuGTLodaAh++jzABHZZEVcD9pw4LdUiRziMXPgzY6LC/UIcnE+fA5Jr0lzWklGCLeAGTsI+C+CO8fCQyG4+D8Z6CnIugyacv78vUNrwFOdoXiZM7T7MwFVez+mCWUjMqe2zjsCNrtJ9Xl1izAcGQbUjKPVrvMuO7JkOuOK29K5WrQD81g8y5vAkfRGtd9RUmIoPVWFyrW5TkDcXoDsz4M4AnVLczYRYD7KAC1pTOyYK2+pEFuGDtcJ1RBPPFgSWUdwF3AajdpP22RaBMWy1oEZty5dsa0AGGAi7I65MQWburFN8GLSU2O15kbc7oGV/y8cA5WXX4fzqrznf6LgefWmXJ61avHRCANIyqh5se3tsWwaE/bzDFuxbBjRW8+nKZ79kEvwP8hxDFXeu58tclmoDvqUfsZeXv2XgWS7tX5GI3KxtSgmQSm0GY4qUKHy4+zHWNBwlCdRDPkQLdtEYoB92n59kxcyxz X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80017a5d-a503-4277-5284-08dbf01dd059 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:25:04.5112 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tHq/vzU61TB9BVjDyKq5mpcsIGjinT6T7yNZRfFw7svK7IM/52dYLz2rM9b9HX1fc/wY9XwRbgDyNf48DJjutg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9837 This patch uses the newly defined helper mptcp_userspace_pm_get_entry() in mptcp_userspace_pm_append_new_local_addr(), and drop local variables addr_match and id_match to simplify the code. Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 8c7553d7ee65..a608166af121 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -61,26 +61,13 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, struct pm_nl_pernet *pernet = pm_nl_get_pernet_from_msk(msk); struct mptcp_pm_addr_entry *match = NULL; struct sock *sk = (struct sock *)msk; - struct mptcp_pm_addr_entry *e; - bool addr_match = false; - bool id_match = false; int ret = -EINVAL; spin_lock_bh(&msk->pm.lock); - list_for_each_entry(e, &msk->pm.userspace_pm_local_addr_list, list) { - addr_match = mptcp_addresses_equal(&e->addr, &entry->addr, true, false); - if (addr_match && entry->addr.id == 0 && !set_id) - entry->addr.id = e->addr.id; - id_match = (e->addr.id == entry->addr.id); - if (addr_match && id_match) { - match = e; - break; - } else if (addr_match || id_match) { - break; - } - } + match = mptcp_userspace_pm_get_entry(msk, &entry->addr, true, entry->addr.id); + if (!match) { + struct mptcp_pm_addr_entry *e; - if (!match && !addr_match && !id_match) { /* Memory for the entry is allocated from the * sock option buffer. */ @@ -99,10 +86,13 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, list_add_tail_rcu(&e->list, &msk->pm.userspace_pm_local_addr_list); msk->pm.local_addr_used++; ret = e->addr.id; - } else if (match) { - ret = entry->addr.id; + goto append_err; } + if (entry->addr.id == 0 && !set_id) + entry->addr.id = match->addr.id; + ret = entry->addr.id; + append_err: spin_unlock_bh(&msk->pm.lock); return ret; From patchwork Tue Nov 28 14:22:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471262 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2054.outbound.protection.outlook.com [40.107.105.54]) (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 EE35F58ADF for ; Tue, 28 Nov 2023 14:25:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="mlJ/p/QV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VBBv3rdUpN2bR5bArQPhZjaRlmdr5HomkoKW1C8MszR0xhbbS3EncJ4B5Lga5ke6XAAEP3OVB9vxxP6yNZWXcOR112BnEyUrtckYI46InwtGpt6eOZZ4oM2jcO7vWDO3G8oH6QpUEQCoSPtjAC3Ed4pyhZdTZKW9Y6T4bhM3rQA8JBCH9uG0SkprNv2p7OG1j1Z3G99fg1TXGFBJKDHGySHOF4QvU5702WG6aYJ9MwF60H4CGqe+nKQSXJh8v3IStp9pVsRtq5yNlEWGZTyFhhcFZTujmMtxSNbLdR4/tfGImf0N0rg2hFWJWT2XF8dsN0U7mt4wfurD7J8sZ73B+Q== 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=cxjjzLZ6kHF8UAV+cJ6wZQea+75Dlq7CfTcoZPopX/I=; b=ZTZT6aqFoq4QTvBWW5pdsxJCcE6Wtg6aWUxJgHJN44hl7d6AMwFpGwowv13/Po6tWZNIUP/Lz7KIiFc6NucZ4TIB15GWtmvE9cAH06IT2igvdT0WuRilqNI64as3Uuo34AGedkvCCY9Zh1swSABmk7plNiw7vAE9u5xb9gtB0TquGcuj/qE2rDwAgzzzNAs1+hFK3zt4gk7bTUL24UgPJHeuuoknoF0hJ4ohWkWfqEjEkHqni6kme/HAo0wf5nC58Kadztn2VDBYcbATPOyY1BVIj6q+VHIsiBfjjOipskDcoDn5z8v6Q7C02ZcYvPQPbo4150ZDn8ddvnq6YwYdnw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cxjjzLZ6kHF8UAV+cJ6wZQea+75Dlq7CfTcoZPopX/I=; b=mlJ/p/QVk9gT4AaOXRw44/U3WVM7iODnx/gvQ4f7xZ4FTJN08vCVqSbEoqG5mtzrtlF7ASA2W3GAjOtpR6tGp94zZvDCQnnm1yynjJ1y2TQUGAdNSf2Bpd8OLVQh2IJmH4U/hI14oIXgk2SGDNyFjy73KEvifgxM6+W3g00PxVABUUmV32ZFG+uEwZFhejUMDvZyv/fKm6uCEB51D0+p8KXh5siW0q4azltfY2RENVgUadJ4/RVLG0EkmYPZscEgEOgj7huh742KgTTJNIWIxrtNcDnbrsi+rra8rnxcVNcQKg3fDXrqXQfspJr451NadyK9xe5YZzRL9ZX0t3r7gw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by PAWPR04MB9837.eurprd04.prod.outlook.com (2603:10a6:102:385::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.19; Tue, 28 Nov 2023 14:25:11 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:25:11 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 28/32] mptcp: dup an entry when removing it Date: Tue, 28 Nov 2023 22:22:21 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0059.apcprd02.prod.outlook.com (2603:1096:4:1f5::19) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|PAWPR04MB9837:EE_ X-MS-Office365-Filtering-Correlation-Id: bd45b36e-fdf6-4ca2-3cdc-08dbf01dd43e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YXXIWBNiW0DXHPYJRGRsbG0EabAF6Bkx8KIUo/wemvPTqDI08U2gwg89KJuvtyAj941MdSN0oBCmd3dPszfRg2wmuc1bdLucfw6dVOYUDMi6x2cep7acryNfICYDzyAbhf125rixi3/eJT/sSULDp1X00rq5R8R7KpbHPU3Xw6swjPB3cv4e5ouxm6i+SyGVPYxySyS2RjGALuoLSY09LWZOdSL++sEDqL1YDF2hn9WV7Rac2VjWkk5UDXSp5CZ2QLR2VOBcNzZgUoc98E7N/+PdDVZTC7ZmCEljqOfXW1LhhOjBQlSUYvVICZaBUwoWHIyUdr/Lhb4TIfQVfqtreYL/qzmbIwV/T26W+n5Y5vUtaAG9JYEevvllLtY5iJGtEM6Wkq+e8PYmSDlEbFmtpm4u6SIAi7P1XpvaSMioKeU/ilKea9HDOIhs0RHbSoN8wJ/KHBdxlSYYHMoM7yjnqN9HyBOdPz1mXesWssyWCLs7QIi9E+5CJi4j0n+lAEuUSJisw48NLHv1qLX3twirHb2D9vngD1WpjWB7l1+v5MfxOkJJBPLPdVno21Pz2+Rd X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(44832011)(8676002)(5660300002)(4326008)(41300700001)(26005)(8936002)(2906002)(4744005)(478600001)(6666004)(6506007)(6512007)(107886003)(2616005)(36756003)(83380400001)(86362001)(316002)(66946007)(6916009)(66556008)(6486002)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Virmk2yc4RBW89/9nqSJHUh2nIZr2PSX3XB/QX/FCNRr/W2xLpe85qaBrjXCC0/E2aKh9lJIBlx0SxA3MsN0hsgou0fvqkCNRNVIp1mnXnBDXmtO47DmxOmb5Z4DbnNNh+1MQalSGJL/2VL9FPj5yKcUI4CyXol77pzyhX2XOQUJZgy+K7+/ZB2NxjCUF1+5XSaLubiEXbvJI8LnzH/rS1CfQeBYlcC1HJg0GKUTKS1dzAq2RLh7wV1aEU4SB9tHWaaefZwlyr8eAPGmKG8vyUvvXRzr9hul78gyUWB7P+mJnB50Hlbh8NlPKjB/9r3Xcz0QO6C3lK/mmtQZrpIGGswXDuu1uCI7Q1fcLVlzE0Z4uaFjP3Psb4edPo+FHdmfKMoMsCwMEd/PMEL48/g+GK7m4kYEZsLbR7F9BGxyN0KLwJZW3YgpyFCKchlw6E+NytJhaGakUYoOGnMFQNL6swszCUuqEa4A2Avt60KjnfDx/ndJttegm2DSCRhDjkNc0HVtBp8j9iiaB4ULdTe5bXX++RCJaVAm5bPiRAVqhuEXpigl6RhnP1qLCMobPWccZ1HMSVOJU2bkDyxAFHHGF69ZPIkq3lhlNvuRBXT3zoCoD9LYMIgfybSuPNEuRX9tqMrBpFj11V3xaGYzWrE5/WZ10H+Qw4HDuCcLRRSfH1R4A6Zh06LzJ4Kia2R54B42uu7Gu3SVhW8SO+M/JQguqBs5arkKrAL0vBCHd9aSKbIHXD0zzFQUK3aIGo24k56jk4YVJZXKGZ8E1XSyF8aVIB+V2oST+VSXsuYnDwFP99sySWKdx4fzutUsii0Fsj1s8mWRoTlS/zYaq2Tv4HfGoqXsOUESsKSAvF4K2I2fHZ+hLtMw4T0NMQ98v/aDrCgrOY9LLAvJk3LzOn7W95Ox5X7LC+2MNEZhmS8JOB4CWAR33Wtu959T0L38r/fxCTjUwy7H72PedvEQgXj2zqm157Uaqnm/4Ame+DTs4cQ/VUCbkqPROZhZQKcaLpSZ+0fpqy4M+5ffJEU96xHeKysiNdZI3JY/8jq0BKJNSXoczwCB6Rd83PieV8iMcUCXeG6qAeTVQS4dYcfIv6O8JN6udodHc0j3Q8BGCJmyNzAMpBU8LUYhW8x4vKPpFtjaclZoFCh6s+BBemSKvo7mDzi5Gjp8nHiHXavchtukva+DqvaX5oR1ZV7PSL5VLNyQHfEpC7bfURQbwOzqf9hFDEbPYBfQI6WR/73w6wp35dXFkaLKF7On/r2fSGcGN2I9BorEm0l1MccVysDxXseMEGbK++jRRMZTjBwRissa4tYaBo+ohw7mUuhmRMfeIPQ5v+Jq+OKLJHyk0ZZRgg8Eq8N+GI6n+Bhdhitu7y3wimu9KEgshvVFQVFNISmZ/XyU36dMNjou/sSkRbnpKVLvgVXqaN4RR7njSCqP31TnIlWqBbv7RHLSsFZpBrN52SXfMLiYjtBlpM+8rLX1JCsIlNpEHEpl9TQBrc+QdYmL8wcwWb44nbC9HYrNszD1gYYAEldzdngnPvvTNbD0e4xRnuc5Lr9G8Ff2MeW5NlTANNaZIh2k3Zd8nqEd5hLgZmKgfZz4 X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd45b36e-fdf6-4ca2-3cdc-08dbf01dd43e X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:25:11.0070 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: q9RDzueqM77/t0Q2qs7GHRA8FH1EImwkCGvboozuTLUNnBQ7QL0irbGW9uOAjwbvNCA4atWDj9bs08Qzq0ST2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9837 In some cases, the address entry doesn't need to be freed. This patch dups an entry into the free_list to separate removing an address from freeing an entry, so that the refcount of address entry can be added later. Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index a608166af121..99ade938eef5 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -312,10 +312,18 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) goto out; } - list_move(&match->list, &free_list); + entry = kmemdup(match, sizeof(*match), GFP_ATOMIC); + if (!entry) { + err = -ENOMEM; + goto out; + } + list_add(&entry->list, &free_list); mptcp_pm_remove_addrs(msk, &free_list); + list_del_rcu(&match->list); + kfree(match); + release_sock(sk); list_for_each_entry_safe(match, entry, &free_list, list) { From patchwork Tue Nov 28 14:22:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471263 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2072.outbound.protection.outlook.com [40.107.105.72]) (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 0E0655674E for ; Tue, 28 Nov 2023 14:25:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="qJWMwwnx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TgFoFYrF3hQV7BLL5Oyiapinv4jOVZ9lFdS8XRp1AQ2SoaH/FIXQ9Q0cGpVk7cNudCfbOd0Gp9BNEVppUTBfCH+addBIvWuNaqoB2zlZkho+ddiXvFo1B2VwvNGGPYDFtmNmzVRMochkyPBeuFi9kOUvTFPaMizxDj0betrTaUE/jotUj/1duv2AD3ZVmNU6mdfgosxG8QVeNUDDPgoa1178DsibRPeqwMcby+0akVCLaKqrT9xbqJk2Azgltxafk0QSGdTy9Ps6iC8KYvX2Sx5LaATvGgKukEzZV5LLcSTVGZc2WQUXXComf8oXr4avtlEvZrsCijUIMXx9K++Baw== 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=ETTaZDMPn8hsI404iQqYPKTi3rlDeB9A11y9pe2W5Wg=; b=ZNKVVBZd2qL5ZD4wwBQMg+cPixX2T170mW/YtUUWcKz8UDNRHTxbYf0iaeQv0JdN0of/U5mFhChjV5G2p2odcLgrB8TbksxqZRTR44/n5p1/Tyq6q1V7c02beP0EQrOE7D6DwTf4ahfjMj/TP8ttJkF9DnqsV6h+ZhTJOdQn45JBfKIKm87HkY0jVRkeHSofXGqs4KCB3qCzZl/bkQchTRLKksbzHDYXGeaI8Ke+jFrwThx9XBWT1ekPguDfnOQrDx4VrvJZbpyW/mExkLdYq8vnnRSFUiCnXXHrfKL0lRdsvj3c8D3VWNpEsS/PHoU+UwyajDm8m8r9BjisXGNFSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ETTaZDMPn8hsI404iQqYPKTi3rlDeB9A11y9pe2W5Wg=; b=qJWMwwnxWjPSk0Tu3PVdyNQqKKKH1LxOc04lgW9ZOXjQjM7ZLi35A8jXrQQtK+q5Yi3PJgXL0XkRjy/bwhuI5ChB4lUE0W+2RnKGa5n7QumZTGyi25GdjJqTleIXuuarnX2acemRpr3Fm3aqLuxy6SNhWxSPKxnY3Hr0C/i2vF7G+Zbyuqfx1nMI5j6smQEUtZLDVqod+BwLD8uTHa+9W/NKMAg+EYsJcg1MnzOxnVRSfT6nGXt940YGsRroQlv6tHnuZs++Vb7w+uXHmF5rIqZiOZqr1Kjstv4H0V0sZJkcfG78DSvK8WcXqDx6LW1cWTLAR6HEbh2CRNYZB4P1Gg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by PAWPR04MB9837.eurprd04.prod.outlook.com (2603:10a6:102:385::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.19; Tue, 28 Nov 2023 14:25:17 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:25:17 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 29/32] mptcp: add userspace pm addr entry refcount Date: Tue, 28 Nov 2023 22:22:22 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0046.apcprd02.prod.outlook.com (2603:1096:4:1f5::14) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|PAWPR04MB9837:EE_ X-MS-Office365-Filtering-Correlation-Id: baec86f6-4bc4-43db-7104-08dbf01dd7db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5cnRoflGFKYDoWxX305YCks00iWpHzDrdvhl6+grk9USwIgflHykOKBmLP4OrI8FeBax/IWzH5DNExLUR9XxYIs5DG9pkQ8r2AboFNDw6XyRiUjQLUz97Vdk2PW/zLp4B+dcK9sHgPvtcvHMJBzsAlN+hk4c8ttgGJ8An7dKEP44Se2jDB9y5OcXOsAVUL9wBQ880AP89pO5MQOTtwDNOg7i+GMQl2dXoqCg+cG+65zUpyC4PhWMnPFlibFF0CV3y1+JcTxkV/b7al3K2bMlHTJ4xjVaJW8JdgVjHbgkAS7iuTI0kmEifeGs9bYpMpSRSUnvCqFsVXsnKNZPFl5ue2zzWgmKf000zP1ACdvw4wNR2dIfu50sX9VI2XSsyepvCP1X6l3FHn2dvIQAdjgAwmq2s8X7PRStAMNcE2JcwkpfeLu1AIg1sLiHQqAl+KKmywzJ49jPcZVz33RtMzUkewS3al1u/s9XR8/JK3/zHW4d6TLaGpy0MjG4Lq7Q9nMSUtpRSSKtaxOExykgnD8gk1oQY4sh9QBAHykNww1GdtQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(44832011)(8676002)(5660300002)(4326008)(41300700001)(26005)(8936002)(2906002)(478600001)(6666004)(6506007)(6512007)(107886003)(2616005)(36756003)(83380400001)(86362001)(316002)(66946007)(6916009)(66556008)(966005)(6486002)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: b6q8mSMwfvFddaVLXuOmfOYrAE+C3dJf8CRJPVworwVTiVvrsKkw+mZSQ9l5qAG9Og0zx6Hrl7xup8YGuV4d0fiKfxYMy4jqenr5MGNfERm3EHGjwwgbNbEtNG7mGUJyiBvIsmxBCl9/1CuuY1RqwzX7rtaIoRx6HKdn9lgiQZVnOCpfmfA7IUDIBidnAEBc2kOnc+GRt/SUiuNjLkgC+WWkUg2BmlFTIEmDAnYHOySXoXQnZw/IJtNiOAuZOhIWRBmZU9Jf8D1jhZzph3CkCnu6u+I9z0zFsRVWv48rX9XO7nugzVFoD8R1ODsWPKMCLOLErFiKvkesJR6QxLgE1NvgswR9lEbGtJbSxqtIGHHLLSJtN6sjPURuzWk/XoDeQDIP5F490N6vPt2ExQVRIQmg5gCt2kTMDbPzNBr0wL3M69hIsTcFO0X/V0qs7xq8G6Wug9jR9rWOwUheXu1Ucct4WHdv/rI3FRJHtec1HJISgB41z2B5qoW3f5Rnqu6DT1x751NUjFQcI3EKD0Yed1RCYXUDxNpF533bAcH9PUfAqPDpt0WertaDtAejV+P4onFQuuBIkOaDQ/RsjFaoz4/6lWZvl7tvu2aVjxDgcyvYgwuFXej0bPuRQPiLh94j31pLOYKAltDczKtfdpbolee/gRp3G+bPg2DqyYVOGv9tT18S2IFvZoLIft3OuvUSq3NP93KgK2eKgrK6VjITzr1Qday0av+oHk+5JDPi7FeguJXZG71Hvz/26MQtzaB+wVSAQj9QWpbP7vvpLaZBki/6Rnk4o3WX+bWtKhQm9zQDEQwfPFV9AwHhjBBHGWO2dr1HTscH1iN2AcNtvHmjmbu7Elzv/pVZfTxP9qRrUkM/sCMTjZ5liNOR0g1dOp3Bz4bx8gHiirWeeJ1G4Uz9/b5gap7sqiA2GMs0/kvNvZdGnerXJr46KaBY6bvdGewLKhzv8jVExg9XO6mn/9PChqsEBDlIwH8t8XZQgR4F30hEINtoHjmqUiJIsBABnQFDCbPO85K4GhTb1/yQk15SB+ABrnloF6IRNzxBg4yj/AOsPeUEliYqqcKD9Rlv+X9OyPy6fduj9lecRElaoVnOQsy5kHhN5d0diism/FUGCz3CiVdB7yooCgsxrDcFH1z+ccuG1sqm3/FIt96p70TuJvq5PHLKg9AjJjtndi2Rl0USoyRV3TMXWlOD3ENLGPKFhBFO+DhyvRWnHJljhOh6oUUZI6WWRFNLWHXbd0Z84s7R/ahv266gEGTOgebC9YwEzoCP193oxOwfToveOHSJxh93+KlVz7L3v9kgvUgTGUiVTIwfiQYGV9RffLSakFuoMfOZy54MGNUsU9pBa4JB6M6UDE1zjCU5bStSrXevlB4wwMRTigHzMuYs/QOcyWcpIKzL44LtS4AAEuWn/gecqVCZN7JbPN31sNzFHiSnUtPhxWOqAv27ezB0mI7Lyk8N98RQg4bXVSVLUzPwzkxbVwif7Y+JbbbORjTUVhhy2gZXMCRyet4tADqQox2thxdOEuZo9YeahUUIzsvyQEmypqMjuZ5CXGfUmbH/qLj3RGyN16RlRhAbemOH/QZR/E/X X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: baec86f6-4bc4-43db-7104-08dbf01dd7db X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:25:17.2688 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RFnHfatqRDe+YP2FgPP8OwpLaVN9bkwn7WtHaPqrSZqOsyEuVvEPn9XPX06lqVfS9teIzTSgezzkd6i6xrPTww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9837 This patch adds the refcount of addree entry in userspace PM. Add a new counter 'refcnt' in struct mptcp_pm_addr_entry, initiated to 1. Increase this counter when an address is announced or a subflow is created in mptcp_pm_nl_announce_doit() and mptcp_pm_nl_subflow_create_doit(). And decrease it when an address is removed or a subflow is closed in mptcp_pm_nl_remove_doit() and mptcp_userspace_pm_delete_local_addr(). If the counter reaches to 1, free this entry. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/403 Fixes: 24430f8bf516 ("mptcp: add address into userspace pm list") Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 33 +++++++++++++++++++++++---------- net/mptcp/protocol.h | 2 ++ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 99ade938eef5..43a1217503ea 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -85,6 +85,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, __set_bit(e->addr.id, pernet->id_bitmap); list_add_tail_rcu(&e->list, &msk->pm.userspace_pm_local_addr_list); msk->pm.local_addr_used++; + refcount_set(&e->refcnt, 1); ret = e->addr.id; goto append_err; } @@ -110,12 +111,11 @@ static int mptcp_userspace_pm_delete_local_addr(struct mptcp_sock *msk, entry = mptcp_userspace_pm_get_entry(msk, &addr->addr, false, false); if (entry) { - /* TODO: a refcount is needed because the entry can - * be used multiple times (e.g. fullmesh mode). - */ - list_del_rcu(&entry->list); - kfree(entry); - msk->pm.local_addr_used--; + if (!refcount_dec_not_one(&entry->refcnt)) { + list_del_rcu(&entry->list); + kfree(entry); + msk->pm.local_addr_used--; + } return 0; } @@ -216,6 +216,11 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) spin_lock_bh(&msk->pm.lock); if (mptcp_pm_alloc_anno_list(msk, &addr_val.addr)) { + struct mptcp_pm_addr_entry *entry; + + entry = mptcp_userspace_pm_get_entry(msk, &addr_val.addr, false, false); + if (entry && !refcount_inc_not_zero(&entry->refcnt)) + pr_debug("userspace pm uninitialized entry"); msk->pm.add_addr_signaled++; mptcp_pm_announce_addr(msk, &addr_val.addr, false); mptcp_pm_nl_addr_send_ack(msk); @@ -321,8 +326,10 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) mptcp_pm_remove_addrs(msk, &free_list); - list_del_rcu(&match->list); - kfree(match); + if (!refcount_dec_not_one(&match->refcnt)) { + list_del_rcu(&match->list); + kfree(match); + } release_sock(sk); @@ -408,10 +415,16 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) release_sock(sk); spin_lock_bh(&msk->pm.lock); - if (err) + if (err) { mptcp_userspace_pm_delete_local_addr(msk, &local); - else + } else { + struct mptcp_pm_addr_entry *entry; + + entry = mptcp_userspace_pm_get_entry(msk, &addr_l, false, false); + if (entry && !refcount_inc_not_zero(&entry->refcnt)) + pr_debug("userspace pm uninitialized entry"); msk->pm.subflows++; + } spin_unlock_bh(&msk->pm.lock); create_err: diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index d40e29419c04..3fccee77b739 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -8,6 +8,7 @@ #define __MPTCP_PROTOCOL_H #include +#include #include #include #include @@ -244,6 +245,7 @@ struct mptcp_pm_addr_entry { u8 flags; int ifindex; struct socket *lsk; + refcount_t refcnt; }; struct mptcp_data_frag { From patchwork Tue Nov 28 14:22:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471264 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2066.outbound.protection.outlook.com [40.107.105.66]) (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 CEA6E5674E for ; Tue, 28 Nov 2023 14:25:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="spgLPWtm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XXVjLqjxcJRLu86jCl2q1TopAoiJIeDAQBr+B+QOrxdGrChwP39o+V01/xLzBznwrny7eBhRHWSQoOa/rs62xjANybPm3JoUtK0SSIDJIERIQdtddJUOv9fCQvEuGM5oLcpjtdcO8NuavyJ9XUH8Pf5lfQ+vRF0WkEluEMyV6YXn5Qw/aYtKxFPyyjDCky9+TFxuykLomRA3Qi/4Rioh/O5vaqUXMD74GQK689TCf5UK3NbM2yHOZo95LU6TlFrHFAQMm9ZbmiH5c5lM5zVMMjl3tFOrCZn3RWWtO4evCcWHiKOlYFHjsO4T6/uy+VwikV5YVnqj3KSllj7t9PPfFg== 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=VveZjxe3vGPdKEro5YHMRAiW3CWK3pSQKoMd3qOIkUQ=; b=TxlW9VMVYryxZ+tQOFzhjpYkOz5E1Xiv/gA6FsCTtzdnsEIHGhW8KkkvAw3eYbPnaigoCg2O0ekNs33/mEVci3sAhLxeUPJaV0cP8fNOJeAV1ucr7xrHWppHfAoVHP00rq8COAvtzaWoB0emqYK5bhmcgxysddJRqc0gV6j9610M0ZnwfmJO6593zC2m0G7ZANW3vH/+OlulFwZLA9R2zXB0lJZAuqHeGzMBg4I/GZaDGMULZ0eBu1zfg8k/9OXigm90kMQ/KQjI8d7WlZ33XT97ekEYhIBqhc4wwQ1SM/trO2gD6lsDTj85rqNsuvVje/j2xUepPhPeS9CcQOMFKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VveZjxe3vGPdKEro5YHMRAiW3CWK3pSQKoMd3qOIkUQ=; b=spgLPWtmHGf5LVCmUVAABrksnpMuET1K+ConYIet09R4qZfoiSbDD2Ky4xiyI9VeZgfC9+5FgFOo/i4ZaTde3H3TtMGw9pVThKCuQFmN5laryEcaKKSyAHHszAqYSNlwKfJrNcqeXQM9isHk9Lb2pS5+GUMob0H9yWrdcb+JEWzKrTUyyhK+5ERxVN2C3ZvI0Csi8Xox21tV7mCnxYXU39aLzfTn6V+EID79MZtUCvT+eUjtog7hNJT4px4HHMcisVcKwlmpbdMGImOJOQCXGhrai8ok2QdQYn/ZTzVQ19WcZsRARK5cFfLasu44CB7AEyjFxp3ZcHViZ/kSTja+aw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by PAWPR04MB9837.eurprd04.prod.outlook.com (2603:10a6:102:385::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.19; Tue, 28 Nov 2023 14:25:22 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:25:22 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 30/32] selftests: mptcp: rm userspace addr with random order Date: Tue, 28 Nov 2023 22:22:23 +0800 Message-Id: <3d66030ea94674d652210cf82fbd707015498d99.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0056.apcprd02.prod.outlook.com (2603:1096:4:1f5::7) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|PAWPR04MB9837:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d746129-622a-4f92-094c-08dbf01ddb13 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fAp8XQ1yA+jVh60hFkT0/jvLxNJIJV0aLslxQ9yW1vKkWdOKj8FLcxiDK3FTvt5W3xA+w6OGwdCUTSXYaq8RD1Ut0TDifp2YcnhAZGxhSFi+WMDhKmr7w+2mOYOU+2+WbLy4x8eRUdrkhojcNKJSQnBm3ytDtwlZTfD66QwyjEBlGgIP0+7iReaG/pS+ni7dX/p+9zCS2urxt1j9/4AF9OKxU2YFuRdwtTmlBd9ZLaIbArFSIHWIa/fSmIsaMm1qUPp7ntGhMWDoHKvNPK3r2InPxaO4Ibv3NGQ69zvtxSEGY5k1Ni6df5JZ+cPhKVmm20P9JHYRZ/R8WQTMlngbQs23Rg763m4dV+Qfoz5X6JlQKI4bHfOnYcR78NPPc1RV7VxmZoCY+8YRLscgSde/GdEFLuCp1Ot988dRv/FcRQS0NqAfcmswNzZcNbLS14SsZQLapfWkH33FKdTEtCTTxqdwVoLbsxWITNVpJVhTG5zwVr1hwYjBAuMzETW4XFh0HRqCOpgeCo5Q8nXcKlNAkpDBJTMEsE5tDk++fLLT8bBQWw30yxubPoN7oDccR5NN X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(44832011)(8676002)(5660300002)(4326008)(41300700001)(26005)(8936002)(2906002)(478600001)(6506007)(6512007)(107886003)(2616005)(36756003)(83380400001)(86362001)(316002)(66946007)(6916009)(66556008)(6486002)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 69b6tztmzoPAGLiAG7Lxfm3TI4h1y9W13xPPf94oFpECCx/0XQPT7RUoWit+W0ZEiRq7Fj6vEKOnJEvZ/hZDzHs3Sk4wW51guq93P/TzDdLa5VzhR444Fls21N1WNKYq6XCvbosa4EJ+C4a9i4V/r2rJyw71pQNq4Hi5gOSgaRb6GWGHuzqSqRDmWcvLMxWP6AKO3wmQCTKtQBSkhW8QFmvMYJqMTLOzd7k6RT3kX1Ty1b/+iCTRyvTIKEnK7lXZe28+CdgbpEgb9u6o0cEgS9ySBgeHsyC57txhV0yc2TGcSqeJWpiUSmYHawxo4RiQ0h1LZJuaGEhtRHPLjOvbq4bSoHZ4FWi/phF71jHmzl1cOViX/b/r+aHmt3I4QolardnZDWI+Xx/97qdWH0qjtObcg0LPuOwDZT0Ctj6tna2W0MuIcpI+wgJOTYGE0dallv+Gv4himD0OR9KAJ4rSbsDsBp4dDwVSDHm5desfUkIINj3w0xxBYTlP3xmmGQgMpjKZyzN4F2Ywo449u763AQ3aw9q90XWdcQCFWrSd35Sn2zAs/oD5t/AmuDM8Pxldqy843YePWa9LcTwWoHEY9yza1oIJAjtnt0AtU+93GUPZHsY3ca9nidNzopHCLSL/iFVTj4X3PTfuovxqNDf1bsrgrEmbxkRq11OGA0enLuigVhiZf/fSr5V58hkjaszzG8eU40CdLGoEPFIMQb5SyTLlLVx/9jHGcQ04gF5p5HaQfKNGg7HM2vd8VJkpLKpfZLkFMmUJWC1afsWPttlt8GDALi1/63jJQ6+EIur3UAPi8O73dJXz7Hog16eQNf11+/mdp/yQKqp2qHHSog/AcaJ2GuguY9Sw62K03DoaRydBKGyU+S9XVk7I/BykF8rQ+rORBkAlwGOp5pHfnA3vHOpzDkHsvLJlfz9F/zi8YjvvdcM/YxgRp9G9ldY66f1ftnzSW5VEWH0wMNwp9dhU4ivb9RgKgIJTsrv87Oj77x3dmkeDI3pJpLXAxO6KA5XDeqXD9Gp1dlaArK2zgd4UsffMNKEuO5xUVEGsl01hn4j+51ac6VueAvAfHsAzV2H2MuWnxa8XUComrubP+2pPNYr6Ii833uG/xOVkz1P7qZoSVT9fUI1xBV7CiiZsULlCeZKWfUYgZ+tb1eB/7dqSMGKwUxN9RAVY0yeUbV0VCHdB6eF4Lon0Lc3BPNYuEypXeG4zFXnp49xBCnPy/bn0Sicwz75s77CqLksXIrBOMEtCy/tAyXpYKusb9zUBYek5JROyNgOee9MdZ1W3UUJCgDutACvfNqB2eT6tdEerFaVtMnvLFTynjpSTteNXRFENZMsXCdM/a/oY64wJWU0P78vHKa7/LgcvuYDZfmUj2NUqFfHm8wz7RSojCs0SzKWslXre/5AbGBk1PQMklkGNoXdPMwtyLFnAoPVWL3fkkOrcQZue2aKwvSzm9zsPMJZ7VotGyG2ka2ino1k056W2ehRAGSV4o802oT/IZYNLgEB+VZFy0OzUs4wFLwU+oZGiSqC6KpRqK8OQzw4Fbj0Z42oAAwaGm/QPds3Epdc8u1h6Znwjf02ubMmkM4LFpSfc X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d746129-622a-4f92-094c-08dbf01ddb13 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:25:22.4280 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fFcY4e6mEPCnjAQh8KOeVfDRK1L8u9nUNhyNYT07mvAZbENmJ7MxFsQ9zN202Ck2IvZyHWtUMs86r6k3jkEw7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9837 Previously, when deleting a userspace address and subflow, it was necessary to follow the current order of deleting the address and then deleting the subflow. With this series of changes, addresses and subflows can be deleted in any order. This patch uses random numbers to add this type of tests. Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index a2baae49a451..ff8c852a9b45 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3411,8 +3411,13 @@ userspace_tests() chk_mptcp_info subflows 1 subflows 1 chk_subflows_total 2 2 chk_mptcp_info add_addr_signal 1 add_addr_accepted 1 - userspace_pm_rm_addr $ns1 10 - userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $SUB_ESTABLISHED + if [ $((RANDOM%2)) -eq 0 ]; then + userspace_pm_rm_addr $ns1 10 + userspace_pm_rm_sf $ns1 ::ffff:10.0.2.1 $SUB_ESTABLISHED + else + userspace_pm_rm_sf $ns1 ::ffff:10.0.2.1 $SUB_ESTABLISHED + userspace_pm_rm_addr $ns1 10 + fi chk_rm_nr 1 1 invert chk_mptcp_info subflows 0 subflows 0 chk_subflows_total 1 1 From patchwork Tue Nov 28 14:22:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471265 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2060.outbound.protection.outlook.com [40.107.105.60]) (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 B3D055674E for ; Tue, 28 Nov 2023 14:25:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="SBnl3J/5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NXYwQNdTpiJg7V8faQtFyj1VOtWBfprEne1QmHwVEXWRo8HCGiFtwUbxTIQ+Y8RwUZps/GdSRb6y+6B2/xZSiE0MtzSy8WczdgxEParH4Btqsp37gY+btC/wvERfUQ8Ra7ucrofaTWPzQ1VGRYGO0c0b0J1IqWsxLP2SI7HZDpwfqO/qTaOsNJDVKN89oQj+RktFmOAhKqWhF2cW8tARD5TnDCV+UCS5S/S27GHKHLldWUBcQFn9Gk1l/NxTYN7eK5QerUkCtOH8F1wYma6xFLYngx2rZ57zy0CfMZBhEv1SXAcGPiXB6Iy43jk5/3Uon48RKyeiV53fm94o1h2h6A== 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=5XISrvyZEEk7+Q58Cv0jrQ8umI/FxldAYsT0aZv7KBE=; b=dIVYsvpmK9AePPgetOjDEKxxFoiTcdMjdeu58w6w7xBCy5xkmLQ1ilc9571sRhN1mJMmJvm2eLjJm5G2VapATVYesJm1+3fhdtKpel15J6AA/bRtgmvvPJ1kHuM/Y7GmV22zMxJdcC1XTWaUOccZHug93cM9ASgZxjGLts4RoqjxsXoO+SWaGu/3g0dl9SiGKdEdHvRydrfRfdGqM2yB2nmIG7QOygG6vckGBYetPSd4IBYtLGpOL2CACE+Spak94nW93M9bR/RDVFoadev19jYWwKltBOOWgkf4j45zuZK2z1mhx83gHflCdQjz0lCNZzMoQRjHeeXs11zFzDQg8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5XISrvyZEEk7+Q58Cv0jrQ8umI/FxldAYsT0aZv7KBE=; b=SBnl3J/5W8MfoZEs66JrhQ/XbLP39HbK9ihKWVje9V7SEBwIt8quZPulGEhpHQQ5HeqtKnbxJsTWKm6WITgpjX1w0yv+U5KPz5KaHv9V5vLVHkQaWzHNaOJqLh2ZWBTpOmQlZQ9t3/OajR8FPMUDmswp+mviFuw/O2Md27w315nvNx3XCLtqW9KMFUrZq6wczRikABCm9sC8nTgps2dcWlhvpIR8P8CxF+IZByOrcHT55KrLhTRovH5kNY5muzOfgLJxarW92pUZpRY3g68DhwhLT+GB7w8NnL//pdysGC1nhaK10cM72nqoXodd/cwBk+3YMafSPIFRAoZ5MUa56g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by PAWPR04MB9837.eurprd04.prod.outlook.com (2603:10a6:102:385::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.19; Tue, 28 Nov 2023 14:25:28 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:25:28 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 31/32] mptcp: map v4 address to v6 when destroying subflow Date: Tue, 28 Nov 2023 22:22:24 +0800 Message-Id: <48657f917c3cc536ff123b673b0de5b3330fe8d3.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI1PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:1f5::20) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|PAWPR04MB9837:EE_ X-MS-Office365-Filtering-Correlation-Id: 450e24f3-3219-46da-1161-08dbf01dde9e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZJ3Jm6gwXmhP0GHYotyzPlePm8hr7bLIxZGacuF+VUae8ox+Y8yFBxvkgznuY9skI8S2hSyhOS+2jB6PN2ORsC1cwY55RHf6laEIGKncuIjh5vWGbkCYDPEdkUE4vAdrhLp5FCAeFdo0untKzqjl4FyDuoAuu/ERJmEq6D2sDFFpweVhbWTLBdVzP9ifQdG8jzWgjTpn45xNnRbnMUmZPbMCKO+QPZV0MEr2c9m2hG+hG4tZaT2lZ1bfLi8z+O1JkrGX49Aug3J0/VD86WZYForj4lW268hD0nrhqou8Waeu4qrqUJd5uMRpWQp7wkfyjRECIdlNMM7NG3iSTY9111aQ4GOdmtX5Jl05HDbBNEBUttSYy02CHOU3rBX8dxrvmBiyPUszGDwQUECusWLnqhkGI6p/y5M9nUF1YfCYTk4amXitHncUrSq/rUaLsEvDpsPHoz83uvLhZ2SEBH0+rVXnUxVouqz9dvFCsMZKOln9j0RTQ4bTuvFniWAeCNNmMsBrskWSzPssMzvdxrw0yfAEKkQmzIvi3yrsxFRgOVh69oP/9kKJq+G0pANgwOdM X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(44832011)(8676002)(5660300002)(4326008)(41300700001)(26005)(8936002)(2906002)(478600001)(6666004)(6506007)(6512007)(107886003)(2616005)(36756003)(86362001)(316002)(66946007)(6916009)(66556008)(6486002)(66476007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4F7Cf7BZjHxr5z78FjmcvfM5ldZxeqa6ZPAfbE5ygM/wr2Ecb4lnx6Y2a7TJ8OpiRB2u6Pl8Smn7nZ+PofpI0Bllw+ZI35cmZpoYgGbzT2uqFgd6t+LW3eg5RbJbfrxHjlQywxmcEr5/aEQrhOBWHu044voUo2Colmg3JiTnHW7ol/qFM/zWdBwB3jOfbTQ13cbaeDZhAn+EZLguaRrw2cLXrAWjT2Jqj46DMfTrYm4hxC/6M6AuV+6hcKVw6jgPOtT9mLD3MdvQHeZtothv4r4D8brHyKknJETBZc2Jm+42cl5uuGuC2OvYAcgwaA4satsS+igihTAXQKdrBA6nPOd64o2pJHrJLGVvRj2W1y4tbJTX/hPSn4+ZMK33qbzsvqwxyiB77aMmMtx2S8slfiIIy5eVnDhweVyaZ/WZkfkXgYkg5DWFq1UPljFBWxV1I2/D2gJ3Na+0GzIhHYmLynhJnz0GLpGCMA0hixQMeOw7CRSH8yYQFO5XGaLna24ZzzCc4RxROaze0ZX0RlMICh83S1awxSPSTdjetj/9ghnrVQylGe/JYoZ6nVJtJ6k3zIA5ophdtrval/Mls7d10Cunz1NykbcKNEW8HGFnANiK3ayBEYBSo2OaTVhMO3kOej5SE5DNkFJOny9j3Ikfr8ezgoLsD5K0fA8GVckon4cdc1HY185rg6ykuyqSpaB8z9eieYnzKQiK+xsU0R2NCmh957cZS7DYb8+jS1tcq/zrmp0zmAhHGgGRSBIpI0bRTmUmDF/wn9nMjZ+jxzaiQphR5cHo/nBz9rVXm355Rkd/g3FE6UownTiliPjEMwdauZ7UVRB5o9PnC/hG0pgnAJLjwvJsXrUxA/MNaRgbCmO6SfXHu/4+eey6ytgID631/Sc3wv8Ijojc64EDYtH8xrHJcl1/Cb9rDOqxRwK6igbQhx29KbuPrEWHHaoBnGMQhlUzv/WUJAY/CFz534SmGNRmpM3MO5vcd5lzgNRDt8XFhEyE8RIi2exlhUzzjGXCO4mqNl8HGD783zakgS7SWDdHWZUkGhNp569vVuOb4vG6yFwGdvK+SR2Y0f+0Gs5imcHWw+e4fZDmiHy4qJEECYtGxaca+ncIAYpnX/UYGYeu6B0R7zg2NCvIAS8WIgbSMdMR1X44w/w13DjVxsqUvSeaH0snBj2nBwEB9iAzsdB3299msk9oBFpcXBIcUjK/hwVn3UqOdXU9U9+eWY8X8Q8lUlA/LKMwCo4HTNrs+RCa8hNCC+kuZkInrwLJq1fT/d6bcm2abi+mLnYxshCsnW22Kfa0jkQDVLXFkkr6f1reIP2eNu29uLdTqoio0qEGBvQTDCj5o5Y4qWIZG7KTZuJbW3T+krJJ5cOZigFx9pO1kmZo+PJsRXLpknQk/yknJgGJjNqBAa1XrkZ99hada6jD80cq/mlMjV0kv9+I1IReS6kRFxNhU5pNrrCMCIFL2iBdUhtldWVizaTCrmko5zRIvDvQA6Fk0vlvuJr/JuoKUIDd7T4bZw90F+VbcMQOkfUZQN0JjbS1/kO7DtynwFO2Yd5X0U8+xJGeQopFGt/zqLxmSj3XfTiW5xjBSXAB X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 450e24f3-3219-46da-1161-08dbf01dde9e X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:25:28.3544 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NBmtcbgauqEkkGrrq9WQgJVraWQXhQvOpx7UgD8mYOMOChysb3dxXDSQt/GR3NADLauP8QiGoRb27SWnlMmf6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9837 In mptcp_pm_nl_subflow_destroy_doit(), before checking local address family with remote address family, map an IPv4 address to an IPv6 address if the pair is a v4-mapped address. Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 43a1217503ea..a28197a4d0b6 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -524,6 +524,16 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info goto destroy_err; } +#if IS_ENABLED(CONFIG_MPTCP_IPV6) + if (addr_l.family == AF_INET && ipv6_addr_v4mapped(&addr_r.addr6)) { + ipv6_addr_set_v4mapped(addr_l.addr.s_addr, &addr_l.addr6); + addr_l.family = AF_INET6; + } + if (addr_r.family == AF_INET && ipv6_addr_v4mapped(&addr_l.addr6)) { + ipv6_addr_set_v4mapped(addr_r.addr.s_addr, &addr_r.addr6); + addr_r.family = AF_INET6; + } +#endif if (addr_l.family != addr_r.family) { GENL_SET_ERR_MSG(info, "address families do not match"); err = -EINVAL; From patchwork Tue Nov 28 14:22:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13471266 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2046.outbound.protection.outlook.com [40.107.22.46]) (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 8EE43584FB for ; Tue, 28 Nov 2023 14:25:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="tY3Atvgq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G11MlQ/+oStcDfFX6/ahJpYGBxNUpX/HaTU3kdxx9/er60nshB520tBSAyj2MaX2j3GeleqzfvObBYD4FEhsgV9gtP+H3tDWHb18Yp8MU6e/uzSuROhOkcP7u/3ffCTcbJIuOV5hxU7Z3+QQX4PG5k9F5zMoWnuYavRWkabG3oxzvFdUEH/YqFRe9IjmSIuuhdRlaxnj3W3PfnUq0m2hchu//ppXQN0mYV+lMZaQF3PQTLYPE27dApRQCsqTmW3HObAVM3XkV51ZPCQF82C3nerXnUly7geciDvG8XhEIJOX9c3zSwt6CTPfYg3+Pn7I4zqf+05XUfJWCaDOZKvLcw== 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=zdxkGwsXwu5i5ssV6HnoYRUJccqR3ApVuZ3iWlXG7Ak=; b=AWIUagfEyiOooe23f4g7ACHKa9Qv9yXhVec3h8pHvXc7YcXddmqxhv3olW7zeIfajndiKYxJzlmu19q7yGwiwM3HUMQIzvVBR1PfBRiPMfUWEJhKS93Swi6YIZRfkAaOapvvjSv57/yX3vcJ1KK23qDYRoTdZcQ9t5gE+9/j5sB2eMG9SxTbRiK4La1A2pvUN7ahtl/MMYZ4SC44rxDyVFUPPPx0vs3W8y1VdlW0ZTWKbvOIK5qzC+E5gcHsA4RbMPE+Es8gGneJNJRfqJ2rJe7vQlA9yXEouOoB8e9x/NjO2ljuKhMaglhzKhqBuPfXlu5cP0Lz2r2mb2rvVsAThg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zdxkGwsXwu5i5ssV6HnoYRUJccqR3ApVuZ3iWlXG7Ak=; b=tY3Atvgqu7QPvGqm8RvJGTSZViOWWZI7ElG6OWiQzFSwqE2dLZn0TWY4zv2QvbUXTrESdhu4stbd1ttunOsVzRTeFlQALg46u1qJ0cdX0zL0wUjHfw4zfq989NfcS/bJDbPTh/LoUz9aPer09kyxO5P0aUaKEXIK6TvqJG+P5XZUpZYZf+Xo/W62zgg7MGmCjRW2JOLu9rJEuw9BXUIV4kIx1l5XPn7ud+TaAKj2k6aGeIegZHC2sdbdtczkmDcb/7P8jtNg2UgRR6vX2y2dsihvQT5pLIebczUXBreMgxesflplgZ8WqdHHK9AmDf0JwNLFg92wOAZk7EwBjFIyAw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) by AM7PR04MB7045.eurprd04.prod.outlook.com (2603:10a6:20b:11e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 14:25:35 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::7102:259:f268:5321%7]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 14:25:35 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v13 32/32] selftests: mptcp: rm subflow with v4/v4mapped addr Date: Tue, 28 Nov 2023 22:22:25 +0800 Message-Id: <957643abf70bab8b5e0a79b7b93be7a32dc3e324.1701180969.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0020.apcprd02.prod.outlook.com (2603:1096:4:195::7) To HE1PR0402MB3497.eurprd04.prod.outlook.com (2603:10a6:7:83::14) Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB3497:EE_|AM7PR04MB7045:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f43ec5d-23d5-4ccb-7ced-08dbf01de29a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gfUIpwhnsMPQXyI8En0wjQWbvCBktGsTYmD8is6zs1PC/A5HBSGySvd3uUMJW7bdSdoeeLBlAAwoGsbwA/FOsrubi492FuL7IineOdphbAawb1HvX3Lxrb4MKSq/DS3xeCEy6Rr3IoioohkhJDu/K4lkXCp4TdsTh7jQ2sEVH4n6AfEqxs9tolPsIFHpq/LI/3QG6dwRDV3qmPOpJQ9dxAXEVfiOTgiTgiyyUoze5yyT23eRtpKYwoc48lreJtzenMHQ18GGrMoWN73W3i8V0Mz/T6xxXmYkdQJ/NgX/ZNtNbwnI+V+rWEONlBOm6qNCkXvP7WdJUVJ6uaiV/5xcXwH8GC9chga+aMq3mRdV0u53GdDe1oG2/L/vZpZSUGDfCMVZy551MSP7R3FLWqcR7nla5pW05aJA0L5bBeLNFS49rnmTzs/rn2p9BSMGr56bohklHDgntdfCnteMIu3lJTyEqk/1N+iEBS4MYzaOxOXdFdxtsN7K77SSOqNGg6e9mAGfpLh2U8tBBCzZXdfbEuWTJDB9gg6g52rptgDiALLhoVCHlXgWwY6M7pcphZTO X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB3497.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(396003)(346002)(376002)(366004)(136003)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(6916009)(66476007)(316002)(66946007)(4326008)(66556008)(8936002)(8676002)(478600001)(6486002)(36756003)(44832011)(86362001)(5660300002)(2906002)(38100700002)(26005)(107886003)(2616005)(6506007)(41300700001)(6666004)(6512007)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HSx1LHiwFANBX66q9RKqUcIJqC+dve4Tef8DE93VE1eg8nrcyUafE/WxdgBI9h3EHdEMO2dBCHSU21x3aW9ZUdkYpxFraNP5BBBEah5qP8CjXEmWiDsxws3b/C+zzWOiBiJ2pmJORto1t+jCh6vz9nutKkcoEY666PvrpARpEIbWu3NLOfNjfIMR4PyU037PGsKBC4A1Ll9P4vnd3Z8JpQHRmDlpHvBb7T/kQAXvPUN2g6eYxiHdG0hem2+w7JcNmjk71vGyGidw6FmGRiXXmDx+tHTAMEwpVKlmgQ7vcuWOFve9LP8/gJZJEZQnfxifxXH0sXNXlt3jugHBxVkO+lEeEoxEcqZ8x/5bf/zjP3PfKTeBBcBVgOH187A7x0Hz4jR2Fau1u23vBKToqDa0HF3MAU0RaJrBK1GWva5Cw3CnkGs4ltvlom0NPWCQXxVAs5Ud4lamgZnjEfgTBAC+D+Gt8KyNcBq3LDauXsZQ1UptoAyGq9Y8xmMm7/C1DiCXnW61ui46K5XwAuxh+DEarP7VLOI0NjmzAu1pKdg3Ej+b8eQDuw9g91p5w/BQvSG8htXQCphtCYbyNFreoZGiVbC0JEtxrh2v+ArNb1Z5wcu5vAwPp2Mpqs5Huv75xufyli2G3HCuqEbLmrq+vSxQSPRP5VYAAi+B2Yr13NcGfJS1yFNQINk6RqJRL5RELgZXg8IsJswql8/4S8CocLeF4D5BZiropsgFigBH5RM6b0uu6dMoUX6V1ifhWDFbwuEz8nwwGAJyEZUiOwdpm6DmTSuXpyW2TUWc781eZL/PegIgirX1FlBOafSUVDNdOFd3KXSMCsKMA/pabtql3EVAoQCKj5YJTD++FwGNffM7eObqKmr+gMHmDr6JePkdo4gdBlBHXOsCm6fimFo6hepEVtykvUaCCHjYb0+sbk6vBcLeQXGAarOp31AQxrZLFp7rxADA1vc3uxsJ8vC24TyyUHMUZkmlYwttDvymsyRTN5T2Kdatyi8Y7c372Kmiym9wDLmMu+oDvx3ODhgRToVgdYscgntNLiEm7+V96R2qbZRjsDddrirgyPqK0uRIPWyJzVmF2VQMNoBZRXqnWS4JdQC3Kj6nWkKIxifvbg2njz0Gznod5JggP5ZXP1+j1BeQ2VtBb43sv+py0ckPmpcWBi0cGytm9E/dG6fToxcYNaPjoELAbiQg7dbZxjwHuSQQbc6DxQYF2kIRmug6LceF/eR76HtlqC3x8PKNcZMH9xC2P4QsCmf0fO6LoMOHr9leZvWAvvfyKwSJETsZjyjuebWwwdsnchIuro/FGmDaX52mXl++eoGd3lw/pA7y3ZV3VIaIBSUJPGgtJ2JfGhdGxCNtCCHIc6SQmoutFJm9RMnvdhqzr8qvymt7CW5s7pOxk4+Ob73dqThgSH0nPyIU2TkH3O8hSkR8IEQdJxAkkRP76ksGA7scxzQKRy0SljHE+kdHiE4Jwgak0gTJiPfcRbYB+w9E5qqiYJXj2lZo+GElWZ4PtapMc1DW6eXMuMNdbUjsAeiTviS2wXuJDaUhRY7zED41rkIIiuBhifNrpOsDnZcCUTSX4sPWmrvAjo/p X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f43ec5d-23d5-4ccb-7ced-08dbf01de29a X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 14:25:35.0684 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rDto1dUb4wFWCHNm9Y7KmD+3QQJKWLd6v/jZX3S25zMh/ChIsrygN0NLZCrTOLMCULaoTL2gEbGuwkIJMUNGOw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7045 Now both a v4 address and a v4-mapped address are supported when destroying a userspace pm subflow, this patch adds random tests for both addresses. Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index ff8c852a9b45..048ac0084765 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3304,12 +3304,13 @@ userspace_pm_rm_sf() { local evts=$evts_ns1 local t=${3:-1} - local ip=4 + local ip local tk da dp sp local cnt [ "$1" == "$ns2" ] && evts=$evts_ns2 - if mptcp_lib_is_v6 $2; then ip=6; fi + [ -n "$(mptcp_lib_evts_get_info "saddr4" "$evts" $t)" ] && ip=4 + [ -n "$(mptcp_lib_evts_get_info "saddr6" "$evts" $t)" ] && ip=6 tk=$(mptcp_lib_evts_get_info token "$evts") da=$(mptcp_lib_evts_get_info "daddr$ip" "$evts" $t) dp=$(mptcp_lib_evts_get_info dport "$evts" $t) @@ -3415,7 +3416,7 @@ userspace_tests() userspace_pm_rm_addr $ns1 10 userspace_pm_rm_sf $ns1 ::ffff:10.0.2.1 $SUB_ESTABLISHED else - userspace_pm_rm_sf $ns1 ::ffff:10.0.2.1 $SUB_ESTABLISHED + userspace_pm_rm_sf $ns1 10.0.2.1 $SUB_ESTABLISHED userspace_pm_rm_addr $ns1 10 fi chk_rm_nr 1 1 invert