From nobody Sun Dec 22 05:58:28 2024 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2040.outbound.protection.outlook.com [40.107.8.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 08F73BE7A for ; Wed, 24 May 2023 08:03:10 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eWUyljeiPyubkCW+cagd9sH4AKofkGb0qfKDSUxqnAENwIE/ga8sLOnZghjqpE5TodL7rmmiohh3EBfv0d8rQJn69ZGyeoMbyKmmvlQtMYs7JLaHSMlJZH7HtJ6lnKt5Ngl2DwO9Ktl/iZO4cQa+bmMoUo7UKWSb9jW9py3IQhJvtC2BGSh1i1wEN34RZnJUA38kC8IjgR/8nIggzb2nlJz+nWYWzUAtoJtznOaiQVDkncGWTR3KUpHxbfZaRi+Va7xHZQIyPrzrb9Fn6sWp80ldifUxdPNo4eA8nebrYYACVmpoD5fIRhN1gaY05rEVaMNsERj0kTGI6yM9kBhmYA== 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=wR2qoiELcjQIGq6UdlKrMjbLs1/ApsUMoHnEypGU1UA=; b=eUX7FZiQp9/c4bxZa13/s8sKpFzXiEpEmh5mlNA7HthFxVJ4+L7spa9deTCWA39KPqJH9099CzFXgrK5uZ0gx3peVRq+zur/4rBp8EXpQagGIK5fOmyFH+jpjjHLKvDT+nCtISg/zUnFs7YWTvA7kj6CgQadUo3V1GBOCyJTPrUvdYhGSZ0p/4WNfGVSSvIzzkzl3csZUg8jGkyS7demD82FHwv0Fey/itk0cnFe22d2A2b5zfQE4Duo9zZxbMFwuHB6/Gp8opMjFCqKM+MWlkTUoK1D0OBSs7GE8gFwFMc8RV/GcNH4uNnMG+Viibg9PqtIq2Io/aA42uYTPAVZ1w== 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=wR2qoiELcjQIGq6UdlKrMjbLs1/ApsUMoHnEypGU1UA=; b=a7Hhpu/ubDtdRWDiWGVs82cPRqcWL47e2/zVuDaHXLRhiADwIxcsn8CRpRGjLyaiMluFxe3qJ+4ZcK0QymhXsd2J6scNWE3EYGAZ5Z7Xj+sK0WTAH9dLxCeCO/dkzF3TFcwsSi2vv36z61SQv4B+TmxNVlmgz/53+7RXvO+vW7i8MDVOh0E1NGLK0Am+L209K5eXPr7GcOnE2Oyj9Rz0nCHUqhKaKj+gj/iyEVeTymCRLxVqostmZPhQtlmWARJk/iv2/ZYdAmdsRFupq/59PdCzG1DRBfP3SQZG2Otn2Y1ypEg3/J4TITPIulPW6j68ZznLeYE8pxsm2cabJkRvww== 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 AM9PR04MB7714.eurprd04.prod.outlook.com (2603:10a6:20b:2dd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Wed, 24 May 2023 08:03:08 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::423a:a30f:5342:9d35]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::423a:a30f:5342:9d35%6]) with mapi id 15.20.6433.015; Wed, 24 May 2023 08:03:08 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v15 1/5] mptcp: only send RM_ADDR in nl_cmd_remove Date: Wed, 24 May 2023 16:02:44 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: TYCPR01CA0012.jpnprd01.prod.outlook.com (2603:1096:405::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_|AM9PR04MB7714:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f43a670-2b2e-4ca7-67f8-08db5c2d4f78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tk166DFdURIFU+rCWFNSNRQENU9DUxISXGIdprSJ5hjfaWyAumDsS14K+3lnow724AAIxwkuUS4j29gopnoP0z0PLQacvjY0i+d8R3NbH5hVhPCuefEfNI2YtrXrHSFLVS/tONT/beDV/Enoa0eL84hHJilD9bFxaxpNJAAjZu2IffN3kvB9SoZbnUZw1qcdOfBlTzTNGCfUL8ihcmrHT7bW5vgPa5eUWUX0oWhUvvWvLcecg/CZ28gjqsJTcfEaCCaLhIXkZALlvB6r+TRv054SlqAMvo0T7yIUk41m7gxgocEhOxekU3U2wOvpy8YP2DiWVSwjU9sL3goBEDlhtaHf2sJtUNxUjpe2TrjswtalSa18PtOaNocrTZ6yDwlE6740zbuxsRfzwUFBU+4f/5uYMrKKceT5AFFrmoHj9RALcEYHyyaPEc7C9ThMjbgyqoX0EOOQZQ/7u4LN5Q9wPVj3i5Dx44hLRUYSYUCUnVyq9E+nEkR78S1mlJr1azcpHvIVlimTWF7NMUKFkPauTLBMahlR32ZRmW75oLjYhOE= 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:(13230028)(39860400002)(396003)(136003)(376002)(346002)(366004)(451199021)(2906002)(44832011)(5660300002)(8676002)(8936002)(83380400001)(66556008)(66476007)(66946007)(41300700001)(4326008)(6916009)(36756003)(316002)(966005)(478600001)(6486002)(6666004)(26005)(2616005)(86362001)(107886003)(186003)(6512007)(6506007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?H2Hl3heJ5wnXx8p2yNNsgDRkE0HnfdIQiOU9lQMF/wi20pNFTQBvZ6Wd+kFb?= =?us-ascii?Q?HkDS3GOMeqm3rwQlsqEZGFX18Dwfzi/qJtnNFtwXEtqhCHKTOvYh78aIY7lH?= =?us-ascii?Q?AaJKqppepDD5uCEAdSmATTwqVYiQ+QeOco/QGC0rFiVNsETPdjydkkuLzp63?= =?us-ascii?Q?X4hLP0vWg4fWVApuKbHUivt3fY/tNN9XlvXKrrCHbNqXL/k45fNvuhPgXCJj?= =?us-ascii?Q?ApQSBdO3PhDuGVCTqGfH4rFgVEe2swtrSd7RGqivqQZlQtQfJiMo/KyJmg3O?= =?us-ascii?Q?GrDVHYAUe8M9KsowjdOP2lv2jf5WXGN2RVuD9pM+InRPEKtq+C79DMbODi7U?= =?us-ascii?Q?8SMqwiHthobTgRokKh23qJ09nzBxlR0qNdjHuONrYGS6M67rcvD969E79oiL?= =?us-ascii?Q?2LpdbKbhlLvCNSvoSuv5yaEm7Hpai4/4aEurwx60ICEIKPRkpsEqplJUHHep?= =?us-ascii?Q?vmTP7jLE8g6hmAB5H7qTFhowlxIg7GZQwcDV/zsMB0iQ7jcw1LtxYlxlFVbP?= =?us-ascii?Q?IDSBHlvc659UGAInn9L1VslFtFO1vK4HWA7r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PdOc/kZE/FB/orgp2+X0vWr1XFAvDhoGyC+Kr5nOUgCK7V6OQWz8wnQ?= =?us-ascii?Q?EY8YVWZts26GvRkBBzOWYZ1vTI8pC0bzAZASMdvWDeGbtfXDfPLoDJF5z0ab?= =?us-ascii?Q?GWyD6I/+6bQVjVO6D54ne09L7bziOao8Wzpo1Eb6?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f43a670-2b2e-4ca7-67f8-08db5c2d4f78 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 08:03:08.1995 (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: 12OUBo2IZCADI8lJjCqnMwz756xj26RxXXfHe0wofJK2yGKtvnqLyvepCJs4jzHqsjHGEDg1EyNND3y7P0YOJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7714 Content-Type: text/plain; charset="utf-8" The specifications from [1] about the "REMOVE" command say: Announce that an address has been lost to the peer It was then only supposed to send a RM_ADDR and not trying to delete associated subflows. A new helper mptcp_pm_remove_addrs() is then introduced to do just that, compared to mptcp_pm_remove_addrs_and_subflows() also removing subflows. To delete a subflow, the userspace daemon can use the "SUB_DESTROY" command, see mptcp_nl_cmd_sf_destroy(). Fixes: d9a4594edabf ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE") Link: https://github.com/multipath-tcp/mptcp/blob/mptcp_v0.96/include/uapi/= linux/mptcp.h [1] Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- net/mptcp/pm_netlink.c | 18 ++++++++++++++++++ net/mptcp/pm_userspace.c | 2 +- net/mptcp/protocol.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index e8336b8bd30e..ec892fb8d85f 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1555,6 +1555,24 @@ static int mptcp_nl_cmd_del_addr(struct sk_buff *skb= , struct genl_info *info) return ret; } =20 +void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_li= st) +{ + struct mptcp_rm_list alist =3D { .nr =3D 0 }; + struct mptcp_pm_addr_entry *entry; + + list_for_each_entry(entry, rm_list, list) { + remove_anno_list_by_saddr(msk, &entry->addr); + if (alist.nr < MPTCP_RM_IDS_MAX) + alist.ids[alist.nr++] =3D entry->addr.id; + } + + if (alist.nr) { + spin_lock_bh(&msk->pm.lock); + mptcp_pm_remove_addr(msk, &alist); + spin_unlock_bh(&msk->pm.lock); + } +} + void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, struct list_head *rm_list) { diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 27a275805c06..6beadea8c67d 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -232,7 +232,7 @@ int mptcp_nl_cmd_remove(struct sk_buff *skb, struct gen= l_info *info) =20 list_move(&match->list, &free_list); =20 - mptcp_pm_remove_addrs_and_subflows(msk, &free_list); + mptcp_pm_remove_addrs(msk, &free_list); =20 release_sock((struct sock *)msk); =20 diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 1e8effe395d8..a4bc937baa91 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -844,6 +844,7 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk, bool echo); int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_lis= t *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_li= st); void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, struct list_head *rm_list); =20 --=20 2.35.3 From nobody Sun Dec 22 05:58:28 2024 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2049.outbound.protection.outlook.com [40.107.8.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 074A1BE7A for ; Wed, 24 May 2023 08:03:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HkNR41rz2Hmsra5QBb77a07AFqj+WLjJjLTdUo7A7PqvDlpr7RvGGNDLGEdOl69ly5PcPPKNjFB6gT+h3t+WBLzvCouvfq8frPBvLsLtYF++uzS5xQhu3eVqgwhSyqOJ87LfcuYwFhs4X7u3TiTQDMcF+31md7JtKSyXCjPfqWwi5XFnZkuo66p5N98J1n1HwGlrvgSklHibcS7R6n9OvJirCty9G2Wda5QUrxTB0rnjEKWvyNcArCyfZCh88cEy0vKb/Ww6KfgrWiorPzad43gFOBgTkK3cSbhO4nlDIiHBMMScl91TAVBdNFw6GScoOs8Iu2glXfvAvR/ins9fZw== 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=TuuVjmvT0OwFVCrz+yOVkWabcMUgW/VJoBN0urA9XI8=; b=K8CRkCtpciEMbwfsgnNzHL4MMpF73Wx9gIxm/uF2+OysAi8qiieBfM2K1O8FZlU5ZbppIWmMOcGLrOXbtgAWAI4uuWH242ya9lfvV2njTa+9M+xWIdHa+ko3ajX4pDzwUYpUfYK8/yoCfhwL9dNvrtDbhYykY9ZIg5bGTILZQ+/sJR7t3I1GcA+4DMQGnU9g4WhxuXCXsVIQCcwxa4Ty8muMjrP2golQjQVKRtVPO0b00q0NlK3wJG4tSRvqe4HZ3/EIYYEXEKG9LcTw/PC2O1r+WBHj3+hjqVZIF7ZG/wT4jtoJDuPZmNiyT/M7Ruk6giKKwuOhfUrN6w1AatZcTQ== 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=TuuVjmvT0OwFVCrz+yOVkWabcMUgW/VJoBN0urA9XI8=; b=P/oRFU8eI5LVvD2LyYOKZjzSPlenjA68pfhWTTDKP9ZD3IpZgQHYbCLO5emEPkKWktksWzAjyHwJfGxAakIOd4xuN2FSKk+4I1J8FrXeqcjUDRTbEY/aCRbBj470TEW86GRfqMQnDVr+hOLtqOWobZve93s7l4S3teHsA8fCEhsWFJ7oO5gYJbdWjICHiGVW6yz1Y81zk1owlpNd7io6YPwBq9zI8e0HhLdMc16ihl1rYcQ500fm8Kn7dBXrEHZtFrQiFPmgaJwfMLNi3IuMb5M9Q0BjmDbemwaODw0xYI6bpl4ktLT3u535eo/Z0K9o5UslIoh732XVw3MeDaJ+4Q== 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 AM9PR04MB7714.eurprd04.prod.outlook.com (2603:10a6:20b:2dd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Wed, 24 May 2023 08:03:19 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::423a:a30f:5342:9d35]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::423a:a30f:5342:9d35%6]) with mapi id 15.20.6433.015; Wed, 24 May 2023 08:03:19 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v15 2/5] selftests: mptcp: update userspace pm addr tests Date: Wed, 24 May 2023 16:02:45 +0800 Message-Id: <48489d67d3de857c2fa4d3522a5466f103601f8f.1684915182.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: TYCPR01CA0021.jpnprd01.prod.outlook.com (2603:1096:405::33) 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_|AM9PR04MB7714:EE_ X-MS-Office365-Filtering-Correlation-Id: 494a3245-3042-4aab-0a3d-08db5c2d5615 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8m18tYlz9zefl7uR4DBd/V0RU6jPeoHGWOEedaoiLGug8qnJVhGr7eT5IOOxPMQtnpbDkilDaUbFjXJ1jZG6KJGRXTfW5QMn25pv99lmQkeDTLLyyu+u2w8CQb1oLjueRhpIGfjS0AzzKJgpfRL4frEeWadRlU+HgdCz5wHLVBXuvK2nkboHtPGZIPFzgaKnEix9M705EPYTwx5rrAzOaUOA4JxtzLWJJpaKpFU//UBvTVQsxTG2sGnPYFcR3Z7qgbxCk0o13iv/Kp6tYmt0nVSPMwj9lumPaIJqL+fx3RsaPpvXRJiZRc3mbEegJ5AX4sMyKfcat+EZhbnTFdrgHqGfHIDofYCyTK662wdyIz83touML562T1gMwOduU2FIIMny38KcLwGRy4EcVtXBzQdPNrFyKSZyh0HvrySrV/4eNykxSxgG0aRdwmDCybakOSg4pId82O92zF6kv8ea/1O4VjWAJxb+9TZouOGCEpeqIsGUd+5t4OgggeRd/YdMqm+jE5MNkpkagpCqNzzOJQPFQBVUVxRLW7bN3SElzYbNmuDf4VnYhVUGrHp3IRHY 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:(13230028)(39860400002)(396003)(136003)(376002)(346002)(366004)(451199021)(2906002)(15650500001)(44832011)(5660300002)(8676002)(8936002)(83380400001)(66556008)(66476007)(66946007)(41300700001)(4326008)(6916009)(36756003)(316002)(478600001)(6486002)(6666004)(26005)(2616005)(86362001)(107886003)(186003)(6512007)(6506007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?DAZMrIAu8/27Oi9EahOfVG5GwqtXMh8QWaFuJ5D2qS0Nc2qFLWTQ39ORYIJ0?= =?us-ascii?Q?WI+brTWAA6OkgGRDq0ssKGnr4b0lJntAXgqwGOsyYfTem4sOtMWosBV5TLMy?= =?us-ascii?Q?7GA6A4vYdyH3gYQu/E1srARwsyIKwZYGBfiKk7kwAQjW7ZrW2yb0f1Rd2/XV?= =?us-ascii?Q?m3GnD2MTSYuc9IpnVbLbccGOI3VSPr50pBDHWWLqa9JCUqZ/3ad9nFVmHiIZ?= =?us-ascii?Q?XfWqCSIWvH6c4TDApYCzLxDRchrrM7dvjcVHyOXBK1DtzkThABFGl9DtoExe?= =?us-ascii?Q?WwCmMI+pfSw1MntFWE7HBaTvryGbQw5Pldi1b3RlofLp3BF44kokwbIo2ina?= =?us-ascii?Q?Fd3tOBUI33zBIpcvBSZdbwV6pgYIqai4ERdar+pyxW3Z9mo1dWEb9quBBxWb?= =?us-ascii?Q?D/ARbeF9wJkQqs2OKwLQe/VfEz/kYY/IqJ2X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EWehOhVVzDnPNb81kXm0Yb0ERm0m1UrUmgZYepl7W00JECPFZPnAkDjT?= =?us-ascii?Q?ymSnMHPjaO87FsEELoPWAmoB3QNTp0o1PWf3MES3VAvbIfTWPRG+/UcxDpfR?= =?us-ascii?Q?+oxAyV5vLh+LpHyA66gceByET+N5a7SUl64kOpCLBoJgxNlnZGhnm0PrGHmI?= =?us-ascii?Q?QogwJ8Zp32Cbq4LA3ZjMOTXWm2zj0yMtJ3b+kNJXpyOqzkcL3sQ0oCYX11bT?= =?us-ascii?Q?26elxyWSE8aiwdGUYptflz8asXun+l1x1LGKPVbR?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 494a3245-3042-4aab-0a3d-08db5c2d5615 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 08:03:19.2665 (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: ldMywh/oZrru2dzj7wmrZkcTsvpxXeimzycTdzizTbtjzvh7eCAtzcE+dd9xCjSsuVOkFx6cXVXFCSizSG3rjQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7714 Content-Type: text/plain; charset="utf-8" This patch is linked to the previous commit ("mptcp: only send RM_ADDR in nl_cmd_remove"). To align with what is done by the in-kernel PM, update userspace pm addr selftests, by sending a remove_subflows command together after the remove_addrs command. Fixes: d9a4594edabf ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE") Fixes: 97040cf9806e ("selftests: mptcp: userspace pm address tests") Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 0044d87556dd..a42745e60976 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -863,7 +863,15 @@ do_transfer() sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q') ip netns exec ${listener_ns} ./pm_nl_ctl ann $addr token $tk id $id sleep 1 + sp=3D$(grep "type:10" "$evts_ns1" | + sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q') + da=3D$(grep "type:10" "$evts_ns1" | + sed -n 's/.*\(daddr6:\)\([0-9a-f:.]*\).*$/\2/p;q') + dp=3D$(grep "type:10" "$evts_ns1" | + sed -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q') ip netns exec ${listener_ns} ./pm_nl_ctl rem token $tk id $id + ip netns exec ${listener_ns} ./pm_nl_ctl dsf lip "::ffff:$addr" \ + lport $sp rip $da rport $dp token $tk fi =20 counter=3D$((counter + 1)) --=20 2.35.3 From nobody Sun Dec 22 05:58:28 2024 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2071.outbound.protection.outlook.com [40.107.8.71]) (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 DD010BE7A for ; Wed, 24 May 2023 08:03:31 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CAsHlUUWo/3SS/BhghSMp35ckk9q2nSgntDMeQToMVoWKhGGUGrKBSb9R8cEAD9IweQR1huz9g0DN2FhM+ngCc46BMLlwEaTVi8Kvk+3dWYThyJ0AVFsfzNugdo0rn+8xIp7f03rMmTWY4NhLXvSXqKHeeNPIMOijha4vAa1bdTHXyMuQG7D2G39eJY6zwcv/GH+DYpONWq+fm5YxsnwZWM1EX10D7ori16/cU1arA5qUoSfHWg3WTTXVYbEUyyvKtyUon8MKqfil8rHotQUUgpV8nxuxNyZiOmIl2WAxp8AKhfdsY9QLRdiod1M590q4IPTjqzEkpgV6bMielz/JQ== 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=mR2KUpNL48oe2dTze/6T6AaIf85cSiltBjkg202IAYk=; b=XMlQsfa674I4zHEM9u0kLI3MKx1gutx1cFrWypEyfyuZ2Rg1hCoaoAQI0dpbwh42xJt/7xuU23sbHWB53ITakp2ZMNP6t99AMJzS2y8FruCrZOT0L0PfmaNBBf/ytiFewFpZJtUh1XenXA82FSMY9uTHmwzTYhk56Pp5+k0fr+GM8CLZIXaHGGmViGhjjmj0lmvVSABLZCKjGC+cT3T5CZjIHyIPJkD8fJ0IP9Spfh5bX6RY4dTE0MYyiBohNCca4qVh0eBHTbRfU0Botjh1Fn7oC4p0aeu0qeRxSaF3c+KK3pqFi0V4m7jublE/xlQ1/SnbSbk2utVS6lk9K2fT/g== 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=mR2KUpNL48oe2dTze/6T6AaIf85cSiltBjkg202IAYk=; b=XwY3XXLNSrVldXfGBCn23JyM7uki+hyDZ664s3VGLs2yqVGZDxRdDaK8BX1adbUYX9jIvfsu3SA/99feToaG4dSJj2R1YwnBGUixXaAafze7iLAxK+CKD5FVO6Fg1GOrqS1Fm5sbl8I0JIrrVXBZ6Ddxwg0fZMu8aOUM1seufQ3BaqfMQC6VlZTLxZkEROqFJuqkV+EN2+6WWqCTTjepDYnhp79czSMWjpXQ2eXOXS9YZ7S98MaUnQZNYGyDbGA6tPiGVfjKJMk0mnCDn4X4k/pBNhETL7c32PuLXrseKK4dcoN8tipr9KSSC+60MBFdeh520lOFIQtMlkoaQbzPdQ== 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 AM9PR04MB7714.eurprd04.prod.outlook.com (2603:10a6:20b:2dd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Wed, 24 May 2023 08:03:28 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::423a:a30f:5342:9d35]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::423a:a30f:5342:9d35%6]) with mapi id 15.20.6433.015; Wed, 24 May 2023 08:03:28 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v15 3/5] mptcp: add address into userspace pm list Date: Wed, 24 May 2023 16:02:46 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: TYCPR01CA0003.jpnprd01.prod.outlook.com (2603:1096:405::15) 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_|AM9PR04MB7714:EE_ X-MS-Office365-Filtering-Correlation-Id: d9f5bce3-1c1a-482c-964e-08db5c2d5bb2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SmwxKya4yZoxSz1nIdPwATIbYyqt5xgrn9+BZYvyBmUaY3t1nucrpIuXuUhrUbwyV8jHvR8dY3xkLiMtyp4cEuqnZKXLMyd5qRFQsFJJWvf5OH1AHc5XWfqWLjNAjn5opfpTQfPyLPr2X9LUixbXLZC5MbfvjZXKYZbxqV0ub290g+EcUBPRFSP+jpyd1wP6GWkHiq92ZkdA/122yb632XUxfT4p4OKpigT7MmHyBVHPb3+a8SSVbf+gFS7gB917PiVapvGoz0SN5WfbFAtsoCR8U78qt32xIpnAaNzRNjxJDqr8cQONBn1/8ffUZeDvXp6QxlEGYWU4DO4fYzCO0/r67MKelXTuuPMVTJGeytNW77UFbkarvqhP92Oup5a11lxLQmnuy9y3djqbTYtyM68+0uWyrPy0sFCGh8cpWIvAjz0wS72YB+OUo9x7FgxcLMQH0tE9AUJhhKQZFG3Z9voBvwQynejeooqVbM61aJD74RLe5kZWxbQbsjOC/eJ8/sDQyMt14AdjUdVC/19QzaJq+O5GJ9epLB2U8TlxCFY= 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:(13230028)(39860400002)(396003)(136003)(376002)(346002)(366004)(451199021)(2906002)(44832011)(5660300002)(8676002)(8936002)(83380400001)(66556008)(66476007)(66946007)(41300700001)(4326008)(6916009)(36756003)(316002)(966005)(478600001)(6486002)(6666004)(26005)(2616005)(86362001)(107886003)(186003)(6512007)(6506007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?cznSYk4HHJZVmOohNxfzligb2mW/Ctc/sIKXyg0/n/GN096dwdUt8ItvE1LI?= =?us-ascii?Q?ND4HVMkTslGkzigwYNomHJlc8mkOEYwRyArSqKx+nVnJrFtm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pijaiCqcelt5qDZFvPHP0xtOJechWGhIh0L+8NAK0bAC0MfGggzFOQoCh?= =?us-ascii?Q?3/prBk4zd4atAjQREFvonZzVGd+voFtchjvzucuKJ9auZYuX8Wxm7OsyVDR4?= =?us-ascii?Q?aT+utSAj9qdq98TyX85e+b/m6FLU319SIizlshhbtW2dJpX0KK/Mgf66F73U?= =?us-ascii?Q?bLbWz/PKO7NP/fqBirF/MUOWyLT4CCZPjFUtEYz9p2IaxCB8b1GSRpxsILxC?= =?us-ascii?Q?0IGkWb1E0cyOoatdacRsw4jnWMYCgE4REzwnAzRRcgfLECUI9lWrO8TizhDM?= =?us-ascii?Q?NEIE/F8h2TggXeWg9Rh4asrcruCGDVJfsGHy2U+1wd8S7gwMo8lxcRZVkXxv?= =?us-ascii?Q?sP/4bhHmFBL+EwxXynjMtIs8N6bDa2zfl7/TgMu/3Kz9NG1ah+/PBtnNW6qF?= =?us-ascii?Q?RpnGfmH5ge1JWcvbjW0wCU9ClwA1XD6fzinjb9FFgK2eW5vQNEbKEJAOFYFC?= =?us-ascii?Q?ghIUJF0BmfGeBRrUwrwpczQUaFEKyH8sasjlA1Ma0sWhJI9e4Pi6qpOdSkVf?= =?us-ascii?Q?EAQIqnOUsRxG4DGdrndYOxMgZKYgCHLAKMfiWb2Npyjo/JVjae5iQNUi7mj3?= =?us-ascii?Q?JCegIqfJPajYbex6M0+u605aO1Iwu9jWS78NCz3l?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9f5bce3-1c1a-482c-964e-08db5c2d5bb2 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 08:03:28.8519 (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: jwi+ZJiw0ahOITCGdXdU+9xkYTsu1equRQ5BasSmjWYE3ys32XxFJLwpz85omlAp3T1pKtLIxoizwAfzsC4/xg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7714 Content-Type: text/plain; charset="utf-8" Add the address into userspace_pm_local_addr_list when the subflow is created. Make sure it can be found in mptcp_nl_cmd_remove(). And delete it in the new helper mptcp_userspace_pm_delete_local_addr(). Add address into pm anno_list in mptcp_nl_cmd_sf_create(). Remove it when connecting fails. By doing this, the "REMOVE" command also works with subflows that have been created via the "SUB_CREATE" command instead of restricting to the addresses that have been announced via the "ANNOUNCE" command. Fixes: d9a4594edabf ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE") Link: https://github.com/multipath-tcp/mptcp_net-next/issues/379 Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- net/mptcp/pm_userspace.c | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 6beadea8c67d..114548b09f47 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -79,6 +79,30 @@ static int mptcp_userspace_pm_append_new_local_addr(stru= ct mptcp_sock *msk, return ret; } =20 +/* If the subflow is closed from the other peer (not via a + * subflow destroy command then), we want to keep the entry + * not to assign the same ID to another address and to be + * able to send RM_ADDR after the removal of the subflow. + */ +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; + + list_for_each_entry_safe(entry, tmp, &msk->pm.userspace_pm_local_addr_lis= t, list) { + if (mptcp_addresses_equal(&entry->addr, &addr->addr, 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); + return 0; + } + } + + return -EINVAL; +} + int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id, u8 *flags, int *ifindex) @@ -251,6 +275,7 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct = genl_info *info) struct nlattr *raddr =3D info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; struct nlattr *token =3D info->attrs[MPTCP_PM_ATTR_TOKEN]; struct nlattr *laddr =3D info->attrs[MPTCP_PM_ATTR_ADDR]; + struct mptcp_pm_addr_entry local =3D { 0 }; struct mptcp_addr_info addr_r; struct mptcp_addr_info addr_l; struct mptcp_sock *msk; @@ -302,12 +327,24 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struc= t genl_info *info) goto create_err; } =20 + local.addr =3D addr_l; + err =3D mptcp_userspace_pm_append_new_local_addr(msk, &local); + if (err < 0) { + GENL_SET_ERR_MSG(info, "did not match address and id"); + goto create_err; + } + lock_sock(sk); =20 err =3D __mptcp_subflow_connect(sk, &addr_l, &addr_r); =20 release_sock(sk); =20 + spin_lock_bh(&msk->pm.lock); + if (err) + mptcp_userspace_pm_delete_local_addr(msk, &local); + spin_unlock_bh(&msk->pm.lock); + create_err: sock_put((struct sock *)msk); return err; @@ -420,7 +457,11 @@ int mptcp_nl_cmd_sf_destroy(struct sk_buff *skb, struc= t genl_info *info) ssk =3D mptcp_nl_find_ssk(msk, &addr_l, &addr_r); if (ssk) { struct mptcp_subflow_context *subflow =3D mptcp_subflow_ctx(ssk); + struct mptcp_pm_addr_entry entry =3D { .addr =3D addr_l }; =20 + spin_lock_bh(&msk->pm.lock); + mptcp_userspace_pm_delete_local_addr(msk, &entry); + spin_unlock_bh(&msk->pm.lock); mptcp_subflow_shutdown(sk, ssk, RCV_SHUTDOWN | SEND_SHUTDOWN); mptcp_close_ssk(sk, ssk, subflow); MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RMSUBFLOW); --=20 2.35.3 From nobody Sun Dec 22 05:58:28 2024 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2040.outbound.protection.outlook.com [40.107.8.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 E31EFBE7A for ; Wed, 24 May 2023 08:03:42 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gBp+6aRaay42+Ncz6+hHGONtqJEPNL47yH1rltEVxDEkPKZ3V72DP1qOlwA905f+2+wrQ0oeC79xzJFjFV0uFBIWl0EZzl9h1Xum9+SNMAxONTaS8/f4xWpZCM0/K6liOlloLEzxPyADgT0RWcSezC09n+p3AdvVsf+Y7+TPWk/6ypLgzxTf6YMCl6Oo0DsU4+d8/wTcFlsFH1pjIAN4Xdblegr9L+YLx/U/vSwc/Lp9A7+BLe2buNaQwoEXlUetWff7rkdJF8Bz1L/GN2eLiyLaoJCqdx1P6S4wXDxim7t4ewq8tFVVNTNF7I5Mujmsc/8F89AME1ABPq1JAYO7Xg== 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=naWb5yZU+WggAwRj1faTjPn75Tc79Vm7WklZ2xBjhs0=; b=YxMUUfCrmjNqCW8CMl3syMlV+6gzY/9sosHRcczFMTxa0PqSaKbxVzDoBvtrnWKLankPypUjwIdyK9ipymo5fo8JnicNvpViOVq2ioapv66/oINMxHZ/nKZjM9ORcpi6ckiLpBwIt9p0pON4FQAcuXSQ+WBkJHpG7CcrV+LVGH4NSXsABZgHMDpnlqHctCIAl2VfZRsdJm6bpjZnEaYRhKAmh5WcS19lCFpzCTVc9/LpvVtfoYNxKJNmfSUZ6SUZWAMKoQYZqTaye2q9P0bOGU4qdwYv0ULX4NORn3vUY6xinx3oLGdiD1737qQFdA2rLfOr19SDyAl9NdvH4B8EBQ== 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=naWb5yZU+WggAwRj1faTjPn75Tc79Vm7WklZ2xBjhs0=; b=SbweHPx3tKqpBr3isL39Uj+VPiWJgQs3O2ijXmtyI8u7fMZs2LRWcZR9CDmp2HHbLxxY2W4j+yZvECMl5N+c5Q2FltYTFQ6BND70UG0QBKiFD6LQNNj6nWp0lUp0X/OQdiJwcolLNxfucMf/t2oOaDLWXRV7Rpq2x299qg+hRpBWJRXAyjn9QvvgwgZuyih0xw/aaFIFHu6vaUwcWcluPpMX2i2tqtqAK7ejJJuoyio6GklUKuZX3isW4+zdcT/D+iPBn5D3Z6fFNDfKGmWYRbH3oVpq8EO9EwtA461xd1dLll6BnMM4bnZgrI1NfD1vVPkh4XJFhlGi9jZobqms4Q== 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 AM9PR04MB7714.eurprd04.prod.outlook.com (2603:10a6:20b:2dd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Wed, 24 May 2023 08:03:40 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::423a:a30f:5342:9d35]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::423a:a30f:5342:9d35%6]) with mapi id 15.20.6433.015; Wed, 24 May 2023 08:03:40 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v15 4/5] selftests: mptcp: update userspace pm subflow tests Date: Wed, 24 May 2023 16:02:47 +0800 Message-Id: <5fc534f21c576df3a1e71efa1902a3e29f21f3a3.1684915182.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: TYCPR01CA0004.jpnprd01.prod.outlook.com (2603:1096:405::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_|AM9PR04MB7714:EE_ X-MS-Office365-Filtering-Correlation-Id: 70059285-f0eb-472e-4722-08db5c2d62a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HvN5HR9mGcbOAAHuUCjke0sqQLzqz/Jpicic+amtriKMsMaHCT+uHPLuIfDmg4ABa3kTLQ/qNHK/MsW+1yLARpsuC+eFTGkrvQHZME7bsSQ/WmtNY0RcKuEbe5oSyb+V2tw/YLrmSfcvJJeuiIWvwj1GPiyI5QiZNOpND/huoNPKoX3RPRQPxWrSRWhxu/Lm4omtXDMSsQEoTDKNPsl+2d+viHhmmjrnfHIBGy9YtJfX8PguPCb0haLrnwSB3Rzo+osbqSN9FxYNg+keO1DNJigVKwdAUDoSxn5k6ofL/mkKNS5XENtP2kKPr6+w6CAQrhC0RgWARAcCAmtZdhky/0IahHXUnvkk4wCta4bTewkqWSeEx2ws2OEO7J8o2P98iFjp0kDBIQ+dbIVzaVizNQfaQUEj7PzYSzf7pV909zcUVNgsTDgFy0BhEc7pkAtvJVkw205kS6/hfkonsHLVbIV8G4dSVDIMXflB36U8jpaI6Geb0/NIGFijDVtxmKxeckWvET/D4MNWqORcsI4mgpSU37MrRU7vkO+OWs8zQhQ= 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:(13230028)(39860400002)(396003)(136003)(376002)(346002)(366004)(451199021)(2906002)(15650500001)(44832011)(5660300002)(8676002)(8936002)(83380400001)(66556008)(66476007)(66946007)(41300700001)(4326008)(6916009)(36756003)(316002)(966005)(478600001)(6486002)(26005)(2616005)(86362001)(107886003)(186003)(6512007)(6506007)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?fyqI3XWj75jcz/WFuJErws90d1MzVLzmj+lZMrqvd+kAJb8Afulu1rt0GvDZ?= =?us-ascii?Q?5qEZVEOoOlS9EOEnEq6GIxnPndFfgwt3moikvmHNU04yVQJXf6O+yl2ejubm?= =?us-ascii?Q?Cw+tRMPmlhZRqcIaPJZy4MwDKmlG1+F4zUFxby/Zj5lo7dIfbDK+VKr0G206?= =?us-ascii?Q?uq9TO0kKG3k56Cs6Ek2321q1HYOIE7z3FxKL1qsT5bkxxD/QdGi9tSFEPI2c?= =?us-ascii?Q?scjyzJXhdmHAB93qXkmDZisnMO88I2SHs+y7Nn0FN0f28ldjFA12xGz0TYix?= =?us-ascii?Q?cpTyJltzlHRXd38OH1UmmnxPT++9CDvx5d9B8nNRQcgjFoa45DFL4ghh5Neq?= =?us-ascii?Q?o7kG0whFeoltCOkIzUEUVSj7hA+nK85cf9AOqDZmmWiVZb7/W1colqhOcgzG?= =?us-ascii?Q?3Px2X2ucv+5VwByMAMcuniqpfeSGDDyrt/ZIWWhxkHn+PHxSnlWcSXidq/k0?= =?us-ascii?Q?OFY924BX3Yh1FBjdM3OUIpUSFJ4+o1skuCsw2lW5iEYio+bYSf2Lqpkh8iZm?= =?us-ascii?Q?/aUDzhRb2StDb0Mf12UXvsZBh8Pt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Q?BlR/7xT3DVxkyj5GrdA5kA4GQFn9tAWXZW1hxiA0tgHeDGmzbAiCkq847K+o?= =?us-ascii?Q?aGm5F8cGVIgRpylj844f8xG5DSUuGzFBuQIhgsrbqi8i3tipu0oJdN4+b7PY?= =?us-ascii?Q?Xu4JRO1tfokQs5LWqDQHTXo5htatL5MjPuAXBhxk?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 70059285-f0eb-472e-4722-08db5c2d62a0 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 08:03:40.2290 (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: 60amkpqAOefpiZt+D0pfpl/YHPnHfBj/nxcjEDxNEk64JtSoT8j9Z+VdkkjB5nL+yN1PFkTqC5V5//re+L6tXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7714 Content-Type: text/plain; charset="utf-8" To align with what is done by the in-kernel PM, update userspace pm subflow selftests, by sending the a remove_addrs command together before the remove_subflows command. This will get a RM_ADDR in chk_rm_nr(). Fixes: d9a4594edabf ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE") Fixes: 5e986ec46874 ("selftests: mptcp: userspace pm subflow tests") Link: https://github.com/multipath-tcp/mptcp_net-next/issues/379 Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index a42745e60976..a0c502d617e5 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -937,6 +937,7 @@ do_transfer() sleep 1 sp=3D$(grep "type:10" "$evts_ns2" | sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q') + ip netns exec ${connector_ns} ./pm_nl_ctl rem token $tk id $id ip netns exec ${connector_ns} ./pm_nl_ctl dsf lip $addr lport $sp \ rip $da rport $dp token $tk fi @@ -3210,7 +3211,7 @@ userspace_tests() pm_nl_set_limits $ns1 0 1 run_tests $ns1 $ns2 10.0.1.1 0 0 userspace_1 slow chk_join_nr 1 1 1 - chk_rm_nr 0 1 + chk_rm_nr 1 1 kill_events_pids fi } --=20 2.35.3 From nobody Sun Dec 22 05:58:28 2024 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 AB3C4BE7A for ; Wed, 24 May 2023 08:03:54 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DBEyQ4yiWfccjtB8G6hVviCDvZPjqE3xwH3C30QrXvdsOZN/GSDz9gZ8FVRV7s/MOFCayNj5P/cmJDzzSXt9apH94ZgKdPwPBpGswq7vvh8WhvPNemRm23vqHLpFiSRXCke1qrOk2Hcu1QzT9b3f9nqqNxZwGoZdQaP4QXjTf3TuyDemXmgsYN0fDG3rDMFtGlTiEIW6znOYHSKR22MEPnEtpTe2C8yi8knUinSodgNnGmy2emKtzGYZFH7FfgM4SZO1wJHw9KhoxfdHi/UFbXrrIwEtqTHGu6NoMXTFXQYNBenKJHxsbg2WcqcAegXqMn6KGO+HykkMC5HZdXQ+qA== 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=zNJbjISTuZalS2v1QmnO1FpiWON0lLzO6YKl2gn1/Vs=; b=aeKkB89Ydgievls/KQYhnK1n7knySeFcvy7jn0zLloG7rW7sVhVnYK+YlrMijuluJjLdi+SbXpqrCLj8Xy0qEkvoxHMAU3L46xQGtqXEpblVcYOKuxPULmOnzV0p8M2lrfBRAoJEmjPAmy4Dkccfjx308Vah6uqlkySr++7ZawAvLp5sqFXKHT4pn2FbqIuZOtGZ6QOuP/Izij2LM2XbH208f9D4BknVPrDb0ZXW2/SDAIsU/eP5Cv1fDxlJAvfTU/sU7HdwnXSdCQK/iSlftKYwTyOyusB/G2adL1RcN3B5nkNFIp9V5sM0TWwqdykAb2uaqGXngwabAYm0baHQXw== 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=zNJbjISTuZalS2v1QmnO1FpiWON0lLzO6YKl2gn1/Vs=; b=y4s82LhF1cICQD6LCLTVkVHavHmwnvO4qMSqqZbaRGIoLp3Gn6ihnVGS6Ccksdua3WUj2Y2Lg40EiElEe4q3c1MnDVNAYDoGhZCi/OGeTxag8x7o7uFFDsggrcQrw5UVExdvERI/f+DkPiFj+LtC7WyU+ySqCFnjDnSUIb/xRagVKudu56rgUvlyiX/biTY4eVqoymQPfFeMNfs25n/CRsq3ic2YZZF4XgLTTMT9EA51Q3NYb/2vM/E8WgoxD3qLGEdR7tMwEL1CHTC4r1ujSpmB10tt28q8NjFgZ2sXr903ERxhXVh0E4T+nuQHp68J65lUrWi7Hsazn9MeWf2xGA== 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 PAXPR04MB8591.eurprd04.prod.outlook.com (2603:10a6:102:21a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Wed, 24 May 2023 08:03:51 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::423a:a30f:5342:9d35]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::423a:a30f:5342:9d35%6]) with mapi id 15.20.6433.015; Wed, 24 May 2023 08:03:50 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v15 5/5] mptcp: update userspace pm infos Date: Wed, 24 May 2023 16:02:48 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: TYCPR01CA0024.jpnprd01.prod.outlook.com (2603:1096:405::36) 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_|PAXPR04MB8591:EE_ X-MS-Office365-Filtering-Correlation-Id: 96687c02-94f6-4283-dd8f-08db5c2d68cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x8SGA33QkOqPrBpAyCH7eD3Jdy26fx3Ew0GWFMgQvrovxXT/e6X5tckMinMQ3VHzZqxrkIPzCAn+MrRNePXk5ApKfh5pRmedcfOl6w9SO0bfb3CNScYTNKLDGG41TzpAgwM7U7J45tw4r5hHsRvtz6vlctmCz7ok8VNcCY6m9N9Pl7zy6MFAVKsFJHBHrfAlw+D156DQjpH9sPBMQ6eRCic3VcsTaKrOm7SNzpMeUciCVQQMhuIhm2caehc/1+aTR79brXJdBcZYtVrMdXmup8Vo5mUHAl8YN+995FmZs/zNeV3IbvbPMvWXPG+CeAYkqextY/XaRUQM3ToYbWhuNcahOAeodv66CsUKSxBtIGatZob+KYMRHktgaX9dUD22wCGXq1QqDg35Y18rrJIMpIhPK62Y/3qjy3otjbrnm+iScb+nT2aziOb2+iyamsVm99BLNBPjnmpYzskveSL/P8kQSyYYIBG+PTgDCE9Xq/1Fw0DyUNmjND1ayfUkmsXxfS0ak8oGesT6y2En+aI6KmFoLbro6j9sONKX70+DTO8= 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:(13230028)(346002)(39860400002)(376002)(396003)(136003)(366004)(451199021)(6486002)(966005)(38100700002)(186003)(6512007)(6506007)(107886003)(26005)(2616005)(83380400001)(36756003)(66556008)(66946007)(66476007)(2906002)(6916009)(4326008)(316002)(8936002)(86362001)(44832011)(8676002)(5660300002)(41300700001)(15650500001)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?KTj6yYbcTXJqE8CIP7CW3PK7SJRAxjmdxygwxBocWTQo/uI+vDPPBJAAem0d?= =?us-ascii?Q?bEYZ2BrBEDjhmDD4yBuYSFu5B67CJjQwe/xPSgZ8PpJ6RuCdePCZYrl+Rhw7?= =?us-ascii?Q?XaPtlNcGbk8JEL1WC13FhcdnesFCfuJqhZdIYZGghYeI7fZRmI6SWPu4t5xN?= =?us-ascii?Q?TjSKbgMz/ywxDelAKRj6lMzbLlex1BF/1LQ5w5SOeOrGaWeOzBfrnztv97pS?= =?us-ascii?Q?ynttxbOc4l2+as2WqTW4QdApUgZ128l+2JV9l00c3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i3lxY9hSw0QnEboVmWVGTLSrHwfZQWFopCphJMINWw1Esj9kxzg?= =?us-ascii?Q?RcRO8aYxAT1UZm5lvF+3We7PZ6jh5NZxBO+m7aEK2RrdGU7mCzCUx5AnR579?= =?us-ascii?Q?iJmDOfqHCu5+yOUxguZEIzZzGqEa+0nQVLZH41cgCVVxCf7fZ4hUjmRlTrSO?= =?us-ascii?Q?wFRa1I5doHM1o2P9kdSZo13fbKT/18FvOkehsVLLXVOnYCcXm/20cYtiZWKk?= =?us-ascii?Q?XolbTCCORm5mDJxy9DjfDjQYBBBEiNfohk6OyQ9H3tSyBju1dKzOVvCVS9cw?= =?us-ascii?Q?M5QIjtFwIvG/6/qDmr5aOpJO7CeAKdMLKqY9E+loGRpQdgjxBbOugKI6v66I?= =?us-ascii?Q?xwYydd3T4uXFSQk1TzgaWwY1pO+pcJMdAUOnkBQauMRI1T+hseIM0ZiF1/Gw?= =?us-ascii?Q?DD8+KjekIBLcZHQnFb4Cs+9NVJaDl2wkuLY2HTLp?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96687c02-94f6-4283-dd8f-08db5c2d68cc X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2023 08:03:50.8548 (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: mzYqaR7WGyHJrD6mySJx/L3aStUE/QIedRT01Izy+FDSlJ+D+teG5ZHXu0Gj6h3kStQXBTNrRIlaHSVWHyqvNQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8591 Content-Type: text/plain; charset="utf-8" Increase pm subflows counter on both server side and client side when userspace pm creates a new subflow, and decrease the counter when it closes a subflow. Increase add_addr_signaled counter in mptcp_nl_cmd_announce() when the address is announced by userspace PM. This modification is similar to how the in-kernel PM is updating the counter: when additional subflows are created/removed. Fixes: 9ab4807c84a4 ("mptcp: netlink: Add MPTCP_PM_CMD_ANNOUNCE") Fixes: 702c2f646d42 ("mptcp: netlink: allow userspace-driven subflow establ= ishment") Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/329 Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts --- net/mptcp/pm.c | 23 +++++++++++++++++++---- net/mptcp/pm_userspace.c | 5 +++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 7539137719ef..e7f944d09fcd 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -89,8 +89,15 @@ bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) unsigned int subflows_max; int ret =3D 0; =20 - if (mptcp_pm_is_userspace(msk)) - return mptcp_userspace_pm_active(msk); + if (mptcp_pm_is_userspace(msk)) { + if (mptcp_userspace_pm_active(msk)) { + spin_lock_bh(&pm->lock); + pm->subflows++; + spin_unlock_bh(&pm->lock); + return true; + } + return false; + } =20 subflows_max =3D mptcp_pm_get_subflows_max(msk); =20 @@ -183,8 +190,16 @@ void mptcp_pm_subflow_check_next(struct mptcp_sock *ms= k, const struct sock *ssk, struct mptcp_pm_data *pm =3D &msk->pm; bool update_subflows; =20 - update_subflows =3D (subflow->request_join || subflow->mp_join) && - mptcp_pm_is_kernel(msk); + update_subflows =3D subflow->request_join || subflow->mp_join; + if (mptcp_pm_is_userspace(msk)) { + if (update_subflows) { + spin_lock_bh(&pm->lock); + pm->subflows--; + spin_unlock_bh(&pm->lock); + } + return; + } + if (!READ_ONCE(pm->work_pending) && !update_subflows) return; =20 diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 114548b09f47..7ada9cf81c14 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -69,6 +69,7 @@ static int mptcp_userspace_pm_append_new_local_addr(struc= t mptcp_sock *msk, MPTCP_PM_MAX_ADDR_ID + 1, 1); list_add_tail_rcu(&e->list, &msk->pm.userspace_pm_local_addr_list); + msk->pm.local_addr_used++; ret =3D e->addr.id; } else if (match) { ret =3D entry->addr.id; @@ -91,6 +92,7 @@ static int mptcp_userspace_pm_delete_local_addr(struct mp= tcp_sock *msk, =20 list_for_each_entry_safe(entry, tmp, &msk->pm.userspace_pm_local_addr_lis= t, list) { if (mptcp_addresses_equal(&entry->addr, &addr->addr, false)) { + msk->pm.local_addr_used--; /* TODO: a refcount is needed because the entry can * be used multiple times (e.g. fullmesh mode). */ @@ -195,6 +197,7 @@ int mptcp_nl_cmd_announce(struct sk_buff *skb, struct g= enl_info *info) spin_lock_bh(&msk->pm.lock); =20 if (mptcp_pm_alloc_anno_list(msk, &addr_val)) { + msk->pm.add_addr_signaled++; mptcp_pm_announce_addr(msk, &addr_val.addr, false); mptcp_pm_nl_addr_send_ack(msk); } @@ -343,6 +346,8 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct = genl_info *info) spin_lock_bh(&msk->pm.lock); if (err) mptcp_userspace_pm_delete_local_addr(msk, &local); + else + msk->pm.subflows++; spin_unlock_bh(&msk->pm.lock); =20 create_err: --=20 2.35.3