From nobody Sat Dec 21 13:23:25 2024 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2047.outbound.protection.outlook.com [40.107.249.47]) (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 111723FEF for ; Fri, 15 Sep 2023 07:44:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JT37CRklZdZEgN9oI+Y9tnZOLaJdEBY+siUMIlv8ZBR6aDI8EwgqI1l/tQoHyI0LZqJLS5pcKkGgiqBUu8+zSkc26skq8LlMQ7GXz7F+5KOvR4r7Wg8rGK12lltzZpN36xfesdvBETEJmuBNFdguwrcwvUKBguOUXyP5xLE5ozr2aY7NuRK1JZgAEkvoSPcDRw6mcaRYvCm0zWEcGmmSjHWpcMjKCBJL6bhHyxr3yGW31aGHFVk75061V544WzXQqEZ9OIXMecqOIxh62Y2mpy8MliC5gjyvrHLMC/9zUtRpxdA825dlZc8xsS+HJFIAAvcJknpsx20UBaZFi65xeQ== 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=h7MQneB/L2zNrKONWwQoEuSa6jZgfhKosCUS1hCCBqc=; b=T7d+DRLnBZLN7hEeFQg8bhOYdt88v0664uz6XMCUbVb6yeGZ89PG3NoxRI/hcxtiAhd8GYZX6KIu0WoCm0KsnL7DlpBT23RPlqp9T1dmRsi2T3lA+0JnCOGA3bVMI+JnibtcfDowq+O3Hk8qYu9igxmYhNyCUknvRKoR7zHSrkOwgManpMlMN9UHnCCXWJb0BwjJauEYXw552e1IcgINzgphS3x0nsnd2kDd4W+9EOdZrG/O9LJrLPh6PZJvbWeQ9dzVCgF2onpgXUM+YVtIMrV7UjRbRhI38++zzswjvexrDCTZULmI11YuGryBPrU9SF2v5roHjNANORWyjZpNFA== 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=h7MQneB/L2zNrKONWwQoEuSa6jZgfhKosCUS1hCCBqc=; b=ed6FIIG2NBbSNNgMZSR96OLNH3Dp8JjcWemr/q7fwHp2u2+fw0fvz0N1r6b7b3GQIuAym/HuXlpC6w8G2cTT4EeZ4MzQl3unV/HIBl980qxschiutFsWEsnG1FBpviY9yod68cnbv6zquFneiTpc3u7fbdpHV72i67nNCcWNf9slRpjlMLb1ufuS3Rw/srnOuHo59DYkhpKwr0V8MFimzl89N0KwckIxfmvIzlmPDrhEZgvbdGfQ6iudb2/lpb6boVnEaJnd97iJ6wzkXyjNOWzE/P3iB99Tp9mSyCBAQfbaMT7ELjK7SSkOzRkDFBgrSlNF+d27GGGm31oNE7uaug== 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 AS8PR04MB9079.eurprd04.prod.outlook.com (2603:10a6:20b:446::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21; Fri, 15 Sep 2023 07:44:45 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71%3]) with mapi id 15.20.6792.021; Fri, 15 Sep 2023 07:44:45 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v10 1/8] mptcp: add mptcpi_subflows_total counter Date: Fri, 15 Sep 2023 15:45:11 +0800 Message-Id: <8309187dbf3d14c73ab8852fccfcf46fb6f7b43f.1694763508.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:194::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_|AS8PR04MB9079:EE_ X-MS-Office365-Filtering-Correlation-Id: 4030d6c4-4629-48cf-f29f-08dbb5bfa14f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DDM6je4dJ7vFA1Z1kgClpcO1EY+OD4sHuyO+1cI1paaOmStdy9cUf1ZBxofPlu+JeGHZK75qaLXrslrdn58HpEkHuUkcgODqztZb7Ovw8D+yXprEMlhMh2tlwlGLHZJ8pujeXxOYi9uQexADKvYwCd/y9VRf0rlq3mDo1dY2UModrlynh+bLL6etFpIysy6qr6SUARdlv/V89lX6hx535E201Q7wxRSh2SZwtepTVtuSKi0dHkTE34uvBSifPPxO4MsFVpv6ov/qSN0n961qa9TYZ4IHvQ3PDQTzAFRa/XWzQTLdWBmJp+kMN9Zl2bmQXKOHQbMRDhiIdFhPaZcUAjeWkvbqLjZaYvzj4mUy2ycz0QRVbo0siLX1JpmPhPeK0iOc4RZ6C0i4LYizpMfAdZ3SmvIjRxfXnazQqRbFoLa0QQ267kc/cQ0SolKlQWT2KzU4tc3FYwtmTYL2FbGt7XRLlU/QDaZO7lkSby4h8gwkfr4bfkZQgwTphcdHK4KQQINXvkpLem7z++3J19tiBO+bUfkGunNouLYMhMQ9+vjNNbPE3qleEjWjDD6OX3/5XqNEWz3hPaKnisDjlLAZVm5hXk2iYtJaY8p3C316Dnc= 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)(39860400002)(376002)(396003)(366004)(136003)(451199024)(1800799009)(186009)(2906002)(86362001)(36756003)(83380400001)(26005)(107886003)(44832011)(2616005)(5660300002)(4326008)(8676002)(6666004)(6512007)(8936002)(6486002)(6506007)(41300700001)(38100700002)(478600001)(6916009)(316002)(66476007)(66556008)(66946007)(966005)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?wVDg8OihvbyV2TdaW390DsCejhqt5cwk8mLJ+ZP0uO5Wqy1eJ0ntWCisLW/m?= =?us-ascii?Q?NrFs6WaprrKw79SqA1edv5E8UMRis0mvMcA+LwtrfKleb/8dUvmpRKdk3S8W?= =?us-ascii?Q?BjVL2KZ55cBVKWmO6RAeZ4l3aKLSLxgEg+4tEZ3a2Qcx9nure9XkQd9Q44p/?= =?us-ascii?Q?59OMYObemSLVleO1XxcKeN5+JdAdMvwLG8dgvDklU5yAeBelqrkRy/YAs1Pe?= =?us-ascii?Q?ssIwDH4ac9MIRQp8WLX/3fBTFJ8K7QoPEkM+CULYg+AxHfQVaYJYv9YcGtg4?= =?us-ascii?Q?vHq5+bnTTEn2j6o4h0DwfuHzNAEw+Dv1XewHJX+yfHlfnV3uHGbdleNLUt8d?= =?us-ascii?Q?lemvSeIHLVZXBnKmc9ZcIT5+p1rPdoGKC8uMAfiszEfvEm+FXEOaYwN2ggNK?= =?us-ascii?Q?U8LcjW9c4BT1wfXR3bRK/0WxW2gbAQw/TE9c8NprYOpEZTQtzx9/EZRtyfx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c0MnAhWtKVlSJqjRo3aZePUcvTAGJ3cl?= =?us-ascii?Q?aBGpeBgKyD68JllBP9Ohw0d5r47B9857PkVjX5CA86h6cSUY/LN6hvxyIpgz?= =?us-ascii?Q?CzGqV2LzganQ5KuxEFMhuLhfkd8ml8QPSVa4iUuep4b9EaD8iZuLh08nCdXY?= =?us-ascii?Q?pneUhEAxfR2QLa7ELLkFrCIzhbjmMdmecTi6kZDNC4e5Y0VklglPIEp+x+zf?= =?us-ascii?Q?THQf9CmrPrMSuW5gXZOOYSOyXWoWT5Oxv2Ds/EJoFxppjE9Dp9nYqnGDZUjt?= =?us-ascii?Q?2g=3D=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4030d6c4-4629-48cf-f29f-08dbb5bfa14f X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 07:44:45.3780 (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: OpowbMre5wHMFH/3HgU1te6GDFX4eUrakhxkLsMCcc5W7w3vkOs4eRBvxlDc3tjO04BLNgTXd6suG38cDF7fCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9079 Content-Type: text/plain; charset="utf-8" If the initial subflow has been removed, we cannot know without checking other counters, e.g. ss -ti | grep -c tcp-ulp-mptcp or getsockopt(SOL_MPTCP, MPTCP_FULL_INFO, ...) (or others except MPTCP_INFO of course) and then check mptcp_subflow_data->num_subflows to get the total amount of subflows. This patch adds a new counter mptcpi_subflows_total in mptcpi_flags to store the total amount of subflows, including the initial one. A new helper __mptcp_has_initial_subflow() is added to check whether the initial subflow has been removed or not. With this helper, we can then compute the total amount of subflows from mptcp_info by doing something like: mptcpi_subflows_total =3D mptcpi_subflows + __mptcp_has_initial_subflow(msk). Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/428 Signed-off-by: Geliang Tang --- include/uapi/linux/mptcp.h | 1 + net/mptcp/protocol.h | 7 +++++++ net/mptcp/sockopt.c | 2 ++ 3 files changed, 10 insertions(+) diff --git a/include/uapi/linux/mptcp.h b/include/uapi/linux/mptcp.h index ee9c49f949a2..f89aaa67f10d 100644 --- a/include/uapi/linux/mptcp.h +++ b/include/uapi/linux/mptcp.h @@ -128,6 +128,7 @@ struct mptcp_info { __u64 mptcpi_bytes_sent; __u64 mptcpi_bytes_received; __u64 mptcpi_bytes_acked; + __u8 mptcpi_subflows_total; }; =20 /* diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 3c938e3560e4..9259c75d805f 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1031,6 +1031,13 @@ static inline void __mptcp_do_fallback(struct mptcp_= sock *msk) set_bit(MPTCP_FALLBACK_DONE, &msk->flags); } =20 +static inline bool __mptcp_has_initial_subflow(const struct mptcp_sock *ms= k) +{ + struct sock *ssk =3D READ_ONCE(msk->first); + + return ssk && inet_sk_state_load(ssk) !=3D TCP_CLOSE; +} + static inline void mptcp_do_fallback(struct sock *ssk) { struct mptcp_subflow_context *subflow =3D mptcp_subflow_ctx(ssk); diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c index 8260202c0066..9998e9f7a2d5 100644 --- a/net/mptcp/sockopt.c +++ b/net/mptcp/sockopt.c @@ -934,6 +934,8 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, struc= t mptcp_info *info) info->mptcpi_bytes_sent =3D msk->bytes_sent; info->mptcpi_bytes_received =3D msk->bytes_received; info->mptcpi_bytes_retrans =3D msk->bytes_retrans; + info->mptcpi_subflows_total =3D info->mptcpi_subflows + + __mptcp_has_initial_subflow(msk); unlock_sock_fast(sk, slow); } EXPORT_SYMBOL_GPL(mptcp_diag_fill_info); --=20 2.35.3 From nobody Sat Dec 21 13:23:25 2024 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2049.outbound.protection.outlook.com [40.107.105.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 789C83FEF for ; Fri, 15 Sep 2023 07:44:56 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GOfNbJxnhmHHvSFPMky18sXYUvcxa/Jz26FVeeQtCwKObP0DyrcIzvye9QyVF9BdSS13BnPJmxMItldh84q3xAMYx9LzUtilk2o+DBXm0Abbzm1zfru7HrDb+OzQe0m9FMpyeOglRXrd6LiUVXdr3ga9gGacoB5eUNoc+Vx40T2qMJcxabBPP+sTU11ch9wZBWzzUvIqwWKNHOCZlphLFBY9sSNvXjLOhlRDpgc+IZDl7z7hU2JFF983jUQW8gGVVjDHIL+jB8b6yBop4bcZRvmkrgzC8mH1xU0UexJly0XtVaeX/WDa830i1VsPiK9PW//RVq6pRGU6z2eZwvaSNw== 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=nR1OPqU6gXFlwK7zO5nLsEz7TgE70MHii4ubpmYAoMw=; b=DzQAGm8e/fqW6KPrKV163u3VwtHOEeJANK8M0moZi9QaJnmDZVRv8q2VqH1mljkG/ZNWqkf9DLPXopzqzBF3jajur8QQLoncWJFtEbG7okJaClfESkqKNK7oIplANgdoCoyY2TELFQyrmwMeMYY+Snyu1XKMRhpDt4hLC3hKBS88LxMemZvuWiQFVklLcphcQC9SN30tih0ISz/iLCd2CKWdGQqw1zukjzqfZVjVKva+H4QoLu78XtoCyIlhqpFu2iiU4sPQUhFX4/yfqkQ0mY+CDpkkzfb5Chzzn3BLfV4RYjaxsXKg9bBjHbtGnqkJYu5W+19004Dvjto9o2JqMw== 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=nR1OPqU6gXFlwK7zO5nLsEz7TgE70MHii4ubpmYAoMw=; b=HnGWdP5+A3Zy0KSATqJy/ggOHHfQ5ItN7Q5KGx6o6IaAbR9GBPzvpemjDvR4+Dza5KBqJZ5qNkV/F6q6XRlVnGgjoe5p/lvifHgMZJOCdN0hVmmYsehJ3xJ26xRVHyT3/k+Xz41rQa/av2xzai8KJhI8kwIDnZdq3WMOBdWOQeVKLz3c984+8h/as58WvP8KmPXSiecvQTrw9fxpYDvrIDZUxfS0I3purYxT7MA2V8G1igOU83cVU1xn3TEKHcdVrAcc+bhzk3v4tUNeHpnEFFEQNi6n8z82pzFqk3MH9sLbIGCuVUwW29jEOGDH2c7mOydXE1Z6zyZXSVBiJo6sRA== 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 AM9PR04MB7524.eurprd04.prod.outlook.com (2603:10a6:20b:286::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.31; Fri, 15 Sep 2023 07:44:53 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71%3]) with mapi id 15.20.6792.021; Fri, 15 Sep 2023 07:44:52 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v10 2/8] selftests: mptcp: add evts_get_info helper Date: Fri, 15 Sep 2023 15:45:12 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0006.apcprd02.prod.outlook.com (2603:1096:4:194::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_|AM9PR04MB7524:EE_ X-MS-Office365-Filtering-Correlation-Id: b21c2a63-3127-429a-e1fb-08dbb5bfa5a6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wAMrjPvUYJadPuGWOU4yQhvo/L8PDL+jMmu1vLA4LWmbTKsKdNVCjsk9/3cpRRkR1qZc4h1gA4qsSp1uV0DPrY4DLUZhxc+8zZU7UN70zojoN+VRWcjSoYzHSj+xXAJtX64F0VOjDl45m8oAEdz9Xhnui6GzLDmJlvbotjRvG2rtQwp4IsT3LbHww2uZAudamtKZaXkx3vZKc2CYwt6YfQfTiZaV6xp9yZy14XEwDE9nJxB81K0ELcPnS64pOR3ypb2zDlz31e6Qtow7ngAX5X2SXUFmfiz3qOejl6p8+YKdjnM0OF+xyMCysRapALRCUfdOedjNJi+cmXB8QF9SXJHs+TeSjyKYuK+zL1t7p7KTLIlqksVi5be+h9J0Rcj7zHaAd7g8Uo8pgjn1emTWfRjeBt1YNsX+EjCQw6zH3+q5xz9rslXmXb3j/uuWMg+01VtlbmzjHZmr/mUUPnHUk9nHau9/On5SlhaphfIW8TLDqEFNrOswWSrDYOPLQOn8ftlmUbnGD9kmiJLHsKw/Z7Zp9WVYN7JJVKfb8Nr2MdIJa6ynqJBf3wXjx6xowou5P9d9hmycWmlCyqlWcnwQE4N+p3AmNLOshcpoM5Zd3wE= 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)(396003)(376002)(136003)(39860400002)(346002)(366004)(451199024)(1800799009)(186009)(6512007)(6486002)(6666004)(2616005)(26005)(6506007)(38100700002)(86362001)(478600001)(107886003)(8676002)(66946007)(5660300002)(8936002)(66476007)(44832011)(4326008)(316002)(66556008)(2906002)(6916009)(36756003)(41300700001)(30864003)(83380400001)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?c+ePLKrhqK6pBqNhlWVBP126MkgA+OLVa2iRFhDuwpHvKX777pbKBd9FHxTS?= =?us-ascii?Q?8LET3zeYe3e1KX4E0rj23RGFZyJLUlNof6CvYj0+stQ2H5Xyl3mvUt4HLark?= =?us-ascii?Q?0UrdJSo9/XMdzqRsZLnp34CJ3nufc0wm/VoQslduCBGdUxh82hhVVikFZohD?= =?us-ascii?Q?UD3mTZRTXmj5plGtFsjrF9r1aDpLsQ2tb856IkIX7BAEtqFHyT4N5EinQf2+?= =?us-ascii?Q?sLZPbBG8sCnfGFMg7nOUAnvDYlb8PemiqpnMX9h9reXt7rIHpoHZ4GO4Hgay?= =?us-ascii?Q?vtunbvrpo9VlF2NUuf0wgui2KZPat5vQqkyDsWol6mEhF9De/KJnt70kP3dQ?= =?us-ascii?Q?imvF1immEzXyQvqmpWDnMjljPTvL4POOgt5gPLQUFKSVnqHZrhdPZVC1zfHo?= =?us-ascii?Q?m+OtLA0wslMxjbJbL1CCvPL6Z0TysbUGbVU5Z4fXSRcl2tY7EHOP0eHtCnUm?= =?us-ascii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Cov9R2QmzCc+gnVvq1bKfKtrEtiP?= =?us-ascii?Q?W+Z4VOZS9Za2lHp6v3UAb2+povn+JSIkWkOzI79dWm4byU/JzniNgH2gmN0s?= =?us-ascii?Q?usrn6Hrg+ktRxYfSLTkSnpNMsRKXVjmA05p3tUG8+0uEjeWxnilLDYxnuwXK?= =?us-ascii?Q?iEFNqrBDYmMoZacrkdUpcZfUmA9yaxgXT9M0VcbY7YmwfEFh18S5H9FjpIA7?= =?us-ascii?Q?K2LITS46qZSncVm1CRbXkeP9WHfe1Mf5N+16lfmGcxg5B6ObsE/cOyDC9Vjf?= =?us-ascii?Q?IQ=3D=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: b21c2a63-3127-429a-e1fb-08dbb5bfa5a6 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 07:44:52.7653 (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: kuYgOY9O9dscql53j9VMFosh8RVCNhs6ApfJ5c3DzB3Zsw6ZvyPs3vdAF4o0uKTBLDfWOMyqzy+FgvmqSGQjDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7524 Content-Type: text/plain; charset="utf-8" This patch adds a new helper get_info_value(), using 'sed' command to parse the value of the given item name in the line with the given keyword, to make chk_mptcp_info() and pedit_action_pkts() more readable. Also add another helper evts_get_info() to use get_info_value() to parse the output of 'pm_nl_ctl events' command, to make all the userpsace pm selftests more readable, both in mptcp_join.sh and userspace_pm.sh. Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 19 ++-- .../testing/selftests/net/mptcp/mptcp_lib.sh | 10 +++ .../selftests/net/mptcp/userspace_pm.sh | 86 +++++++++---------- 3 files changed, 57 insertions(+), 58 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index ee1f89a872b3..27517ba770bc 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -1862,10 +1862,8 @@ chk_mptcp_info() =20 print_check "mptcp_info ${info1:0:8}=3D$exp1:$exp2" =20 - cnt1=3D$(ss -N $ns1 -inmHM | grep "$info1:" | - sed -n 's/.*\('"$info1"':\)\([[:digit:]]*\).*$/\2/p;q') - cnt2=3D$(ss -N $ns2 -inmHM | grep "$info2:" | - sed -n 's/.*\('"$info2"':\)\([[:digit:]]*\).*$/\2/p;q') + cnt1=3D$(ss -N $ns1 -inmHM | mptcp_lib_get_info_value "$info1" "$info1") + cnt2=3D$(ss -N $ns2 -inmHM | mptcp_lib_get_info_value "$info2" "$info2") # 'ss' only display active connections and counters that are not 0. [ -z "$cnt1" ] && cnt1=3D0 [ -z "$cnt2" ] && cnt2=3D0 @@ -2828,13 +2826,13 @@ verify_listener_events() return fi =20 - type=3D$(grep "type:$e_type," $evt | sed -n 's/.*\(type:\)\([[:digit:]]*\= ).*$/\2/p;q') - family=3D$(grep "type:$e_type," $evt | sed -n 's/.*\(family:\)\([[:digit:= ]]*\).*$/\2/p;q') - sport=3D$(grep "type:$e_type," $evt | sed -n 's/.*\(sport:\)\([[:digit:]]= *\).*$/\2/p;q') + type=3D$(mptcp_lib_evts_get_info type "$evt" "$e_type") + family=3D$(mptcp_lib_evts_get_info family "$evt" "$e_type") + sport=3D$(mptcp_lib_evts_get_info sport "$evt" "$e_type") if [ $family ] && [ $family =3D $AF_INET6 ]; then - saddr=3D$(grep "type:$e_type," $evt | sed -n 's/.*\(saddr6:\)\([0-9a-f:.= ]*\).*$/\2/p;q') + saddr=3D$(mptcp_lib_evts_get_info saddr6 "$evt" "$e_type") else - saddr=3D$(grep "type:$e_type," $evt | sed -n 's/.*\(saddr4:\)\([0-9.]*\)= .*$/\2/p;q') + saddr=3D$(mptcp_lib_evts_get_info saddr4 "$evt" "$e_type") fi =20 if [ $type ] && [ $type =3D $e_type ] && @@ -3229,8 +3227,7 @@ fastclose_tests() pedit_action_pkts() { tc -n $ns2 -j -s action show action pedit index 100 | \ - grep "packets" | \ - sed 's/.*"packets":\([0-9]\+\),.*/\1/' + mptcp_lib_get_info_value \"packets\" packets } =20 fail_tests() diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing= /selftests/net/mptcp/mptcp_lib.sh index 92a5befe8039..def35395a254 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -207,3 +207,13 @@ mptcp_lib_result_print_all_tap() { printf "%s\n" "${subtest}" done } + +# get the value of keyword $1 in the line marked by keyword $2 +mptcp_lib_get_info_value() { + grep "${2}" | sed -n 's/.*\('${1}':\)\([0-9a-f:.]*\).*$/\2/p;q' +} + +# $1: info name ; $2: evts_ns ; $3: event type +mptcp_lib_evts_get_info() { + cat "${2}" | mptcp_lib_get_info_value "${1}" "^type:${3:-1}," +} diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/test= ing/selftests/net/mptcp/userspace_pm.sh index b25a3e33eb25..2413059a42e5 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -247,14 +247,11 @@ make_connection() local server_token local server_serverside =20 - client_token=3D$(sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\= 2/p;q' "$client_evts") - client_port=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2= /p;q' "$client_evts") - client_serverside=3D$(sed --unbuffered -n 's/.*\(server_side:\)\([[:digit= :]]*\).*$/\2/p;q'\ - "$client_evts") - server_token=3D$(grep "type:1," "$server_evts" | - sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q') - server_serverside=3D$(grep "type:1," "$server_evts" | - sed --unbuffered -n 's/.*\(server_side:\)\([[:digit:]]*\).*$/\2/p;q= ') + client_token=3D$(mptcp_lib_evts_get_info token "$client_evts") + client_port=3D$(mptcp_lib_evts_get_info sport "$client_evts") + client_serverside=3D$(mptcp_lib_evts_get_info server_side "$client_evts") + server_token=3D$(mptcp_lib_evts_get_info token "$server_evts") + server_serverside=3D$(mptcp_lib_evts_get_info server_side "$server_evts") =20 print_test "Established IP${is_v6} MPTCP Connection ns2 =3D> ns1" if [ "$client_token" !=3D "" ] && [ "$server_token" !=3D "" ] && [ "$clie= nt_serverside" =3D 0 ] && @@ -340,16 +337,16 @@ verify_announce_event() local dport local id =20 - type=3D$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$= evt") - token=3D$(sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' = "$evt") + type=3D$(mptcp_lib_evts_get_info type "$evt" $e_type) + token=3D$(mptcp_lib_evts_get_info token "$evt" $e_type) if [ "$e_af" =3D "v6" ] then - addr=3D$(sed --unbuffered -n 's/.*\(daddr6:\)\([0-9a-f:.]*\).*$/\2/p;q' = "$evt") + addr=3D$(mptcp_lib_evts_get_info daddr6 "$evt" $e_type) else - addr=3D$(sed --unbuffered -n 's/.*\(daddr4:\)\([0-9.]*\).*$/\2/p;q' "$ev= t") + addr=3D$(mptcp_lib_evts_get_info daddr4 "$evt" $e_type) fi - dport=3D$(sed --unbuffered -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q' = "$evt") - id=3D$(sed --unbuffered -n 's/.*\(rem_id:\)\([[:digit:]]*\).*$/\2/p;q' "$= evt") + dport=3D$(mptcp_lib_evts_get_info dport "$evt" $e_type) + id=3D$(mptcp_lib_evts_get_info rem_id "$evt" $e_type) =20 check_expected "type" "token" "addr" "dport" "id" } @@ -367,7 +364,7 @@ test_announce() $client_addr_id dev ns2eth1 > /dev/null 2>&1 =20 local type - type=3D$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$= server_evts") + type=3D$(mptcp_lib_evts_get_info type "$server_evts") print_test "ADD_ADDR 10.0.2.2 (ns2) =3D> ns1, invalid token" if [ "$type" =3D "" ] then @@ -446,9 +443,9 @@ verify_remove_event() local token local id =20 - type=3D$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$= evt") - token=3D$(sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' = "$evt") - id=3D$(sed --unbuffered -n 's/.*\(rem_id:\)\([[:digit:]]*\).*$/\2/p;q' "$= evt") + type=3D$(mptcp_lib_evts_get_info type "$evt" $e_type) + token=3D$(mptcp_lib_evts_get_info token "$evt" $e_type) + id=3D$(mptcp_lib_evts_get_info rem_id "$evt" $e_type) =20 check_expected "type" "token" "id" } @@ -466,7 +463,7 @@ test_remove() $client_addr_id > /dev/null 2>&1 print_test "RM_ADDR id:${client_addr_id} ns2 =3D> ns1, invalid token" local type - type=3D$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$= server_evts") + type=3D$(mptcp_lib_evts_get_info type "$server_evts") if [ "$type" =3D "" ] then test_pass @@ -479,7 +476,7 @@ test_remove() ip netns exec "$ns2" ./pm_nl_ctl rem token "$client4_token" id\ $invalid_id > /dev/null 2>&1 print_test "RM_ADDR id:${invalid_id} ns2 =3D> ns1, invalid id" - type=3D$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$= server_evts") + type=3D$(mptcp_lib_evts_get_info type "$server_evts") if [ "$type" =3D "" ] then test_pass @@ -583,19 +580,19 @@ verify_subflow_events() fi fi =20 - type=3D$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$= evt") - token=3D$(sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' = "$evt") - family=3D$(sed --unbuffered -n 's/.*\(family:\)\([[:digit:]]*\).*$/\2/p;q= ' "$evt") - dport=3D$(sed --unbuffered -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q' = "$evt") - locid=3D$(sed --unbuffered -n 's/.*\(loc_id:\)\([[:digit:]]*\).*$/\2/p;q'= "$evt") - remid=3D$(sed --unbuffered -n 's/.*\(rem_id:\)\([[:digit:]]*\).*$/\2/p;q'= "$evt") + type=3D$(mptcp_lib_evts_get_info type "$evt" $e_type) + token=3D$(mptcp_lib_evts_get_info token "$evt" $e_type) + family=3D$(mptcp_lib_evts_get_info family "$evt" $e_type) + dport=3D$(mptcp_lib_evts_get_info dport "$evt" $e_type) + locid=3D$(mptcp_lib_evts_get_info loc_id "$evt" $e_type) + remid=3D$(mptcp_lib_evts_get_info rem_id "$evt" $e_type) if [ "$family" =3D "$AF_INET6" ] then - saddr=3D$(sed --unbuffered -n 's/.*\(saddr6:\)\([0-9a-f:.]*\).*$/\2/p;q'= "$evt") - daddr=3D$(sed --unbuffered -n 's/.*\(daddr6:\)\([0-9a-f:.]*\).*$/\2/p;q'= "$evt") + saddr=3D$(mptcp_lib_evts_get_info saddr6 "$evt" $e_type) + daddr=3D$(mptcp_lib_evts_get_info daddr6 "$evt" $e_type) else - saddr=3D$(sed --unbuffered -n 's/.*\(saddr4:\)\([0-9.]*\).*$/\2/p;q' "$e= vt") - daddr=3D$(sed --unbuffered -n 's/.*\(daddr4:\)\([0-9.]*\).*$/\2/p;q' "$e= vt") + saddr=3D$(mptcp_lib_evts_get_info saddr4 "$evt" $e_type) + daddr=3D$(mptcp_lib_evts_get_info daddr4 "$evt" $e_type) fi =20 check_expected "type" "token" "daddr" "dport" "family" "saddr" "locid" "r= emid" @@ -630,7 +627,7 @@ test_subflows() kill_wait $listener_pid =20 local sport - sport=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' = "$server_evts") + sport=3D$(mptcp_lib_evts_get_info sport "$server_evts" $SUB_ESTABLISHED) =20 # DESTROY_SUBFLOW from server to client machine :>"$server_evts" @@ -668,7 +665,7 @@ test_subflows() # Delete the listener from the client ns, if one was created kill_wait $listener_pid =20 - sport=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' = "$server_evts") + sport=3D$(mptcp_lib_evts_get_info sport "$server_evts" $SUB_ESTABLISHED) =20 # DESTROY_SUBFLOW6 from server to client machine :>"$server_evts" @@ -707,7 +704,7 @@ test_subflows() # Delete the listener from the client ns, if one was created kill_wait $listener_pid =20 - sport=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' = "$server_evts") + sport=3D$(mptcp_lib_evts_get_info sport "$server_evts" $SUB_ESTABLISHED) =20 # DESTROY_SUBFLOW from server to client machine :>"$server_evts" @@ -745,7 +742,7 @@ test_subflows() # Delete the listener from the server ns, if one was created kill_wait $listener_pid =20 - sport=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' = "$client_evts") + sport=3D$(mptcp_lib_evts_get_info sport "$client_evts" $SUB_ESTABLISHED) =20 # DESTROY_SUBFLOW from client to server machine :>"$client_evts" @@ -784,7 +781,7 @@ test_subflows() # Delete the listener from the server ns, if one was created kill_wait $listener_pid =20 - sport=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' = "$client_evts") + sport=3D$(mptcp_lib_evts_get_info sport "$client_evts" $SUB_ESTABLISHED) =20 # DESTROY_SUBFLOW6 from client to server machine :>"$client_evts" @@ -821,7 +818,7 @@ test_subflows() # Delete the listener from the server ns, if one was created kill_wait $listener_pid =20 - sport=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' = "$client_evts") + sport=3D$(mptcp_lib_evts_get_info sport "$client_evts" $SUB_ESTABLISHED) =20 # DESTROY_SUBFLOW from client to server machine :>"$client_evts" @@ -867,7 +864,7 @@ test_subflows_v4_v6_mix() # Delete the listener from the server ns, if one was created kill_wait $listener_pid =20 - sport=3D$(sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q' = "$client_evts") + sport=3D$(mptcp_lib_evts_get_info sport "$client_evts" $SUB_ESTABLISHED) =20 # DESTROY_SUBFLOW from client to server machine :>"$client_evts" @@ -933,18 +930,13 @@ verify_listener_events() print_test "CLOSE_LISTENER $e_saddr:$e_sport" fi =20 - type=3D$(grep "type:$e_type," $evt | - sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q') - family=3D$(grep "type:$e_type," $evt | - sed --unbuffered -n 's/.*\(family:\)\([[:digit:]]*\).*$/\2/p;q') - sport=3D$(grep "type:$e_type," $evt | - sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q') + type=3D$(mptcp_lib_evts_get_info type $evt $e_type) + family=3D$(mptcp_lib_evts_get_info family $evt $e_type) + sport=3D$(mptcp_lib_evts_get_info sport $evt $e_type) if [ $family ] && [ $family =3D $AF_INET6 ]; then - saddr=3D$(grep "type:$e_type," $evt | - sed --unbuffered -n 's/.*\(saddr6:\)\([0-9a-f:.]*\).*$/\2/p;q') + saddr=3D$(mptcp_lib_evts_get_info saddr6 $evt $e_type) else - saddr=3D$(grep "type:$e_type," $evt | - sed --unbuffered -n 's/.*\(saddr4:\)\([0-9.]*\).*$/\2/p;q') + saddr=3D$(mptcp_lib_evts_get_info saddr4 $evt $e_type) fi =20 check_expected "type" "family" "saddr" "sport" --=20 2.35.3 From nobody Sat Dec 21 13:23:25 2024 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2070.outbound.protection.outlook.com [40.107.105.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 2FA463FEF for ; Fri, 15 Sep 2023 07:45:02 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kaQUenciJFBwMPfWm1qpj3PR2WLH4U0idJXENOa/mRj91FlHJANP5fFxEP6YrrqSycW2uPV5exF4bxEW0pYS9uJ6H8xhbDJnw1qlU5Ef3RpI4V54EUEFqROvHxrOqHvIjkMRCN5CawJb2nsOTv4uKR0hVEkI1kT1CnC7R9xHs+X4Hwn+ntUUA2ytPXU+PkMWecc09wNpFOOt2CAVwo4qbExWt7ok3p9t65GECGOevKVL2w9dupbfEyPI6SHDQO5ai6e4acNzbUTM86o6+AlvRyjmimVFKS++ILZ945xZJjKziE2i/7ChQxRRtIyG1XRv38aByOrmPc72kuoFl44tNg== 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=GE78aZJ3v6xlnhLBrQKgprjSocMooXv8XYlKh+VFWac=; b=OQWYU/kJ1cqSg/qv9OWct0evoCuS7/sBNXqWlsva6YQ9p/ndhCsADrrF4+3GskXRUck+GKola7M5adjEyHDtKBrDeDzpG2eUq2+ZM9kjlQuEmG1DtYkNQwCcvFlyClsCBQmoFm/dqUTucpjsLz1OjYNu17l5a0gpAUBZ9YPqOqYbTx0vAQLVWGnTuM5INRxJlzRaMsYW90QVhHzGJ1bIzmVDTX/ADhKlDLFNxpTsTw9ToblaWvIvl+C9+mqwURogiO+dhKTSqmFLHoS0Q8v/B+f2bnkOdboGdNKN5I+9ZWrQOyyqemSTlQI/XxreSzZRgk8zjjwNlnpO3gEHTkmUeA== 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=GE78aZJ3v6xlnhLBrQKgprjSocMooXv8XYlKh+VFWac=; b=0UlDcTEFnNzN6sqUweSvisAz4XyurZ9sB3xox6TIXiRu4/fnpOJP44A4uxTba/2zE+KmgYtFPcp1zVn405+2OV3OX+FvLfaTHZjMTUS0PbdMKbERzuk1s1leJGFn4Qafo60hElKSlQQX9QMYpcyhSnAYWRSxYsSB6AhAIgJgeeWKsVDkLrA+2RiuNySywmN3++xfYQvcOlZTxMzNCblu+hcJh9Vkk1/SszCmcJ8HLLkSpGfELtfXMcXf5zvRVGhTpTf8eclrMLSRwUKGXvXvbbb3JpOnu0i0LEDd/V964sZVrwVl2iI00LVfU0JPNfl7VjxZSzgnPe+xhcnrd/HkxQ== 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 AM9PR04MB7524.eurprd04.prod.outlook.com (2603:10a6:20b:286::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.31; Fri, 15 Sep 2023 07:45:00 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71%3]) with mapi id 15.20.6792.021; Fri, 15 Sep 2023 07:45:00 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v10 3/8] selftests: mptcp: update userspace pm test helpers Date: Fri, 15 Sep 2023 15:45:13 +0800 Message-Id: <43e619056ff815355d8fc67338d7578741918572.1694763508.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0013.apcprd02.prod.outlook.com (2603:1096:4:194::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_|AM9PR04MB7524:EE_ X-MS-Office365-Filtering-Correlation-Id: c01dbc12-2d21-48ce-1f1c-08dbb5bfaa0c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u6F473TUvDU16peoLzS2df0iAy9QcNmFgFJ6xYhCUcypnl9YNwaNgmNt/SiXiGdDDpJO9RMSas2fxEGLud+Vp8c7z1UruHlrPUEws5J8vV1XyyqYRHWaJoKHjAeibYfuFU/JqD+yaSSSwee0kT8kccqXpKDqR0SIBqCnu5cbLNxYxA2euaJtaGHf7RvHmzpTAw8EROc/4Ax1LKdJEbpqkJzXYAgy0z1B5ZktOOIgo44uhtCqCQoSDvpjIAIZNlQC0jb271Nsvou2A0XQK5NsAKY8EwLi0+umKIsz+ji0Zo5cSj0SP6jgMNmpnQfSxAz9/m7PAOvhnarao20hGQimQyJx/38uQNLxiVLA+tl86lzz8WlY9jq4w71sP+MUzyRpniUrLqbjf3b7Qi3mAI6VwcbSlQFpkCvOH2yzauZaou5FWcqlLhRcDfwULkY5YzUmQqdJV/ff9hwb4nFNmQnXWblSgNjgIeDwFQMrGcE+tXuWxRtVmMPLe3sOJI5PH92tBY9VAaInH3nw60eYgoDA5KiaF6C/K8YgJ4PCuVT4MPGLKZsVpaA3Mnv1VUkxoHCGcfpaIzpbvAyGRLcVG96zP9ZkK3Svqxpaqe2YiluOglU= 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)(396003)(376002)(136003)(39860400002)(346002)(366004)(451199024)(1800799009)(186009)(6512007)(6486002)(6666004)(2616005)(26005)(6506007)(38100700002)(86362001)(478600001)(107886003)(8676002)(66946007)(5660300002)(8936002)(66476007)(44832011)(4326008)(316002)(66556008)(2906002)(6916009)(36756003)(41300700001)(83380400001)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?BxeIk6akcN+dmxY5Jqf0cW0PXIMGEP6jXFoqTcxxD3v1zNxO7449XsZyb8VN?= =?us-ascii?Q?fCAHJlSZcP3qp8b5zUhoPZwz1/b/ePIpnHmrHQwJwR08m4wcEuyqH9Lko1sI?= =?us-ascii?Q?aJHATHBO41k7n+GAMNSry2crznGwkyFjzFbpdr9JMeKR8eZRmC/MM7zNv9gA?= =?us-ascii?Q?r6nWa3Yjd7Bbt2evsvmgYXWJPn5EgqNwatwSTHWMnrcmtR84bpBv47/+c19b?= =?us-ascii?Q?YlK90+P3ZTJ5YdziWcjAkzfrEjzR/2T74Uxbi5zB6IdY0aCYDULlNp+bof5j?= =?us-ascii?Q?Uuce+vxjmcjYAR2RqNR/IeA1G/28T9QTow0ZyWdjIkLkCY8/FYbtfw9HIcLA?= =?us-ascii?Q?nOqjdcpdsBWtPXtNSKcwdFNEX9qLibWivPV/z+yfi1m90JQnsKUOABegmzQT?= =?us-ascii?Q?R1pWumRLVkrSaFaZ0gpkRntlt6vIYfj+vRw1Xd1uv+16nUvy8X8O09PPkrNb?= =?us-ascii?Q?JIv40CW0qlbU7mQi5wFlrdOBCyDmH8AhC9Fyjrge4Pp+V3MRPQ9W8aao6DU8?= =?us-ascii?Q?4i7gZOEJWH0RoseKqNmpTL32RqdDwe/x3UB6Xd5AFBCw7gEK8REaTJPBoCHJ?= =?us-ascii?Q?L42eYLWkso1ffUNR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ascii?Q?yXhpAF0/VFjsNxUvbfXCBbHldGYi8p7QmyrupumxeqArIdQpm5+7SNa2FPGR?= =?us-ascii?Q?4mg3yIbK8gSbCnxFqRlh0IwciBEq8stpMsE6NzNKrV/jgo4720PLGal2S3QW?= =?us-ascii?Q?pQ=3D=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: c01dbc12-2d21-48ce-1f1c-08dbb5bfaa0c X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 07:45:00.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: B+7vtmeRXBZAEwvsf4Wcp4OzSggXT734hZJTLU8Ns91RgMgSIXL/EI92/8PrraPRTffuw9ojYIrVoXuzqOMs7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7524 Content-Type: text/plain; charset="utf-8" This patch adds a new argument namespace to userspace_pm_add_addr() and userspace_pm_add_sf() to make these two helper more versatile. Add two more versatile helpers for userspace pm remove subflow or address: userspace_pm_rm_addr() and userspace_pm_rm_sf(). The original test helpers userspace_pm_rm_sf_addr_ns1() and userspace_pm_rm_sf_addr_ns2() can be replaced by these new helpers. Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 89 +++++++++---------- .../testing/selftests/net/mptcp/mptcp_lib.sh | 2 + .../selftests/net/mptcp/userspace_pm.sh | 1 - 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 27517ba770bc..2ebe1692edeb 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3252,69 +3252,66 @@ fail_tests() fi } =20 +# $1: ns ; $2: addr ; $3: id userspace_pm_add_addr() { - local addr=3D$1 - local id=3D$2 + local evts=3D$evts_ns1 local tk =20 - tk=3D$(grep "type:1," "$evts_ns1" | - sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q') - ip netns exec $ns1 ./pm_nl_ctl ann $addr token $tk id $id + [ "$1" =3D=3D "$ns2" ] && evts=3D$evts_ns2 + tk=3D$(mptcp_lib_evts_get_info token "$evts") + + ip netns exec $1 ./pm_nl_ctl ann $2 token $tk id $3 sleep 1 } =20 -userspace_pm_rm_sf_addr_ns1() +# $1: ns ; $2: id +userspace_pm_rm_addr() { - local addr=3D$1 - local id=3D$2 - local tk sp da dp - - tk=3D$(grep "type:1," "$evts_ns1" | - sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q') - 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 $ns1 ./pm_nl_ctl rem token $tk id $id - ip netns exec $ns1 ./pm_nl_ctl dsf lip "::ffff:$addr" \ - lport $sp rip $da rport $dp token $tk - wait_rm_addr $ns1 1 - wait_rm_sf $ns1 1 + local evts=3D$evts_ns1 + local tk + + [ "$1" =3D=3D "$ns2" ] && evts=3D$evts_ns2 + tk=3D$(mptcp_lib_evts_get_info token "$evts") + + ip netns exec $1 ./pm_nl_ctl rem token $tk id $2 + wait_rm_addr $1 1 } =20 +# $1: ns ; $2: addr ; $3: id userspace_pm_add_sf() { - local addr=3D$1 - local id=3D$2 + local evts=3D$evts_ns1 local tk da dp =20 - tk=3D$(sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns2") - da=3D$(sed -n 's/.*\(daddr4:\)\([0-9.]*\).*$/\2/p;q' "$evts_ns2") - dp=3D$(sed -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns2") - ip netns exec $ns2 ./pm_nl_ctl csf lip $addr lid $id \ + [ "$1" =3D=3D "$ns2" ] && evts=3D$evts_ns2 + tk=3D$(mptcp_lib_evts_get_info token "$evts") + da=3D$(mptcp_lib_evts_get_info daddr4 "$evts") + dp=3D$(mptcp_lib_evts_get_info dport "$evts") + + ip netns exec $1 ./pm_nl_ctl csf lip $2 lid $3 \ rip $da rport $dp token $tk sleep 1 } =20 -userspace_pm_rm_sf_addr_ns2() +# $1: ns ; $2: addr $3: event type +userspace_pm_rm_sf() { - local addr=3D$1 - local id=3D$2 + local evts=3D$evts_ns1 + local t=3D${3:-1} + local ip=3D4 local tk da dp sp =20 - tk=3D$(sed -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns2") - da=3D$(sed -n 's/.*\(daddr4:\)\([0-9.]*\).*$/\2/p;q' "$evts_ns2") - dp=3D$(sed -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q' "$evts_ns2") - sp=3D$(grep "type:10" "$evts_ns2" | - sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q') - ip netns exec $ns2 ./pm_nl_ctl rem token $tk id $id - ip netns exec $ns2 ./pm_nl_ctl dsf lip $addr lport $sp \ + [ "$1" =3D=3D "$ns2" ] && evts=3D$evts_ns2 + if is_v6 $2; then ip=3D6; fi + tk=3D$(mptcp_lib_evts_get_info token "$evts") + da=3D$(mptcp_lib_evts_get_info "daddr$ip" "$evts" $t) + dp=3D$(mptcp_lib_evts_get_info dport "$evts" $t) + sp=3D$(mptcp_lib_evts_get_info sport "$evts" $t) + + ip netns exec $1 ./pm_nl_ctl dsf lip $2 lport $sp \ rip $da rport $dp token $tk - wait_rm_addr $ns2 1 - wait_rm_sf $ns2 1 + wait_rm_sf $1 1 } =20 userspace_tests() @@ -3401,12 +3398,13 @@ userspace_tests() run_tests $ns1 $ns2 10.0.1.1 & local tests_pid=3D$! wait_mpj $ns1 - userspace_pm_add_addr 10.0.2.1 10 + 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_mptcp_info add_addr_signal 1 add_addr_accepted 1 - userspace_pm_rm_sf_addr_ns1 10.0.2.1 10 + userspace_pm_rm_addr $ns1 10 + userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $SUB_ESTABLISHED chk_rm_nr 1 1 invert chk_mptcp_info subflows 0 subflows 0 kill_events_pids @@ -3422,10 +3420,11 @@ userspace_tests() run_tests $ns1 $ns2 10.0.1.1 & local tests_pid=3D$! wait_mpj $ns2 - userspace_pm_add_sf 10.0.3.2 20 + userspace_pm_add_sf $ns2 10.0.3.2 20 chk_join_nr 1 1 1 chk_mptcp_info subflows 1 subflows 1 - userspace_pm_rm_sf_addr_ns2 10.0.3.2 20 + userspace_pm_rm_addr $ns2 20 + userspace_pm_rm_sf $ns2 10.0.3.2 $SUB_ESTABLISHED chk_rm_nr 1 1 chk_mptcp_info subflows 0 subflows 0 kill_events_pids diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing= /selftests/net/mptcp/mptcp_lib.sh index def35395a254..bb95dd967eb3 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=3D4 # shellcheck disable=3DSC2155 # declare and assign separately readonly KSFT_TEST=3D$(basename "${0}" | sed 's/\.sh$//g') =20 +SUB_ESTABLISHED=3D10 # MPTCP_EVENT_SUB_ESTABLISHED + MPTCP_LIB_SUBTESTS=3D() =20 # only if supported (or forced) and not disabled, see no-color.org diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/test= ing/selftests/net/mptcp/userspace_pm.sh index 2413059a42e5..283c62deb628 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -25,7 +25,6 @@ fi =20 ANNOUNCED=3D6 # MPTCP_EVENT_ANNOUNCED REMOVED=3D7 # MPTCP_EVENT_REMOVED -SUB_ESTABLISHED=3D10 # MPTCP_EVENT_SUB_ESTABLISHED SUB_CLOSED=3D11 # MPTCP_EVENT_SUB_CLOSED LISTENER_CREATED=3D15 #MPTCP_EVENT_LISTENER_CREATED LISTENER_CLOSED=3D16 #MPTCP_EVENT_LISTENER_CLOSED --=20 2.35.3 From nobody Sat Dec 21 13:23:25 2024 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2070.outbound.protection.outlook.com [40.107.105.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 75EA23FEF for ; Fri, 15 Sep 2023 07:45:10 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RlizqK2aZrak4VbQ7oy1D50PGiue/oD/TxLc8rDOLDcj2+A9zD0IGtXnntjJzEbNuD4Ypmip0GnbKoz/LmexeRLoVrWKTlRp1ZzT6r+auXHRC7pv7AkQV3k8wyZxHrdG5FbiOkvcCoZwrXq/84ks+XTV+20Qc1jux4HXSGHcaT8R1hQR3QmxE7cdFKybzwL0t/e6l4m3WQRsp0pyWyw71uPptYCOD4S1rH12aIx65ttxOXjUe7iblRtOP8AHsQ5RxO6+vuFIkZ37KUjP06wDKOjhe6ilFtO7vdOH6kuCeGxUIr+BfzO68y2PYbkCHO+R0xm/XkHZBrKZuAzsdn+h8g== 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=ZAmRX2YE443I2a484pGYv471GMVIA7d/Gu/AgfKiw+M=; b=f8e7Op7PZc2tzLc1b8gz7UC/4huifnC0Y/4iU2Ay7B9XlyhIYMDaQXsuLP27rvmracW8oPh0VJdBefefoagCWHuq20HvPsDX6nfO5dg74F1lLU07BcZSBhraPgEViGYUXnHhr3V/yYznmHlhZPbYxuBeNcmyEaAgbfV4x6mZJBVeauYY8zHTot8+la46oX1Qz6q+vcufBMBLfIzpgdxIDD8KeveRV0lFoRV+TbH+bVWngxymcP4d+sk5g5GV5Fp16Aacnh+PSF39NLmcV/EUkg0KOqaKZcxFd0A5mE6NNBjxiFrQcTRvonLexbfOSC6IhKwHzWxViCpYlhqp8KhkuQ== 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=ZAmRX2YE443I2a484pGYv471GMVIA7d/Gu/AgfKiw+M=; b=0jbN5H8QXVJnY9DMmA/vZojIGm5p+AsuwoaAOlmvSbGCu2fVkBeICicr59wMq0pB/8Tv2mpI5dCzFfax7QqOqhiV1Uc42fJZNSt0tWIVEM4n1SucvrGuPwqKgKjkYyCP++17FpzMsg3e8x8LqQrZiN3m+hbbMLNsL8S3DepW863Nf8LY64RoS6mdob9wlsiQ8HFNARakyU4rBWkgT+vJPtaT7CAG6H7gUX24PvlxasGOkxTePGjs4UUYT+/uEChtY/4vzVs0rO8qPbHhdmdNMXzEcKwkgpQABT8FpM3KK1FiFgiBitiM9sURPHEmhsOrZa17BZEHEtQuRD86medL7g== 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 AM9PR04MB7524.eurprd04.prod.outlook.com (2603:10a6:20b:286::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.31; Fri, 15 Sep 2023 07:45:08 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71%3]) with mapi id 15.20.6792.021; Fri, 15 Sep 2023 07:45:08 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v10 4/8] selftests: mptcp: userspace pm remove id 0 subflow Date: Fri, 15 Sep 2023 15:45:14 +0800 Message-Id: <3b0584bc00e11164fa28aba7af517f280d1290f9.1694763508.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0004.apcprd02.prod.outlook.com (2603:1096:4:194::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_|AM9PR04MB7524:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d5f4d86-4d71-400b-cefd-08dbb5bfaea5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nmyrCu5Nw+BIMu2g3+nZTpFoPKn0AtsqVbEMwmHCgylQf6JyB9FQIvVsCtRLhdLEbha0M/gDnPdKeuI26tTi9VrT+Q3DVNOGj3emcLo7Ne010wIeJiMZEFSLjsLCq3xHqZuI3yjMDOGrJby+cn3+gh4PuAfcQOX+A+hVIZMuNVdySO3zk7sLxmqKU1tbOImggYorNNuQBtJIlpe18muipoP4qvNanBkkcwKGm/fRdwDTwj+wyeXarIZwouxP5HZ85wU+MwD7nVlICmep27bnGsfM0/XR32SwTF0QUy+H1I/ZmmAPN10qDqY8h3NMfi7vY3wmyfz5FaCLyAf3P6OTjdeuiqJ4XnE+jqgq/J6NFcrrbpru7EBBhOWdhVtm9tuCaMNa7LYtmDxXVBVfGVcqv69w2O6Pi2D9X329cYa6UPVtdEAMKyXsvjVE1a9fEZh0MYCM6Odejhk6eAjgLo0SKd7okuMHMrR50c4gieeUMBoPUu+hC8YLxYNLkIDZLPzjQcw3y73H3BUXyEtqzwUVqFstVgm+Ucm33y7wm1nNxIWyguoltmOAqjOQ8S9U7rKFjfV9vPpD1tLgWAPJ0EvE3+5YzCs1MCNwwy+jVkoYFZU= 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)(396003)(376002)(136003)(39860400002)(346002)(366004)(451199024)(1800799009)(186009)(6512007)(6486002)(6666004)(2616005)(26005)(6506007)(38100700002)(86362001)(478600001)(107886003)(8676002)(66946007)(5660300002)(8936002)(66476007)(44832011)(4326008)(316002)(66556008)(2906002)(6916009)(36756003)(41300700001)(83380400001)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?5JmCZ+l8x9BcECecYWGtnZj9IcNUTWgKuz+uCJEbgdnllqzIoEtrl+V9BxcJ?= =?us-ascii?Q?JaPDzv8joJ+oY3cn1PmbqojDPG17sr5uVoB7XQrm+J+rPOvhtd/a0KoCYI2U?= =?us-ascii?Q?5JK7nw9DYpPLsFmS3U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KGUHQiOyYkAig?= =?us-ascii?Q?cQ7FADbYB7IRBCWsW9zVcmjgVjJQov2OzgfjV7Z08dSLFMDOU8onYBoakG9Q?= =?us-ascii?Q?V04EJEmeGO2cKj+HyFVGI9zN78PonmFLLqJ5XUqqRKfmDkky7TXpbki8dq38?= =?us-ascii?Q?qNw4KoPJy2sofViUQud3LCpcXWfl3W/ifgtxZGcl3r6pgyP24x++XFXPaAls?= =?us-ascii?Q?xJSY/CsnNM+fDJ189Mcc28w3phXMV0p+r0lX82ZjRdl1GDS3frDk9h0r06ZW?= =?us-ascii?Q?ya5F8I4t9HJiiKVEShWcZIY4i2qmCEsGt6/JU7LGopfcxZPGXDruUcdebVua?= =?us-ascii?Q?4Gtl8XtSDQwdAgH2E4iOEUxdDSuFX8rqxENQ5rXS0zh75pXHiJ2KwqWcWyfO?= =?us-ascii?Q?0e+Lg1YfTTiQ4ff8jvXPQK29W81TyyvBMaGmSydRBRXfmbcM60ZbulZ9oUJd?= =?us-ascii?Q?L9BK+q4BYIweeAwPHNyZq94RdSZ9q2Mr58JfHpj+aoaz/QOgzHi50B85KBWZ?= =?us-ascii?Q?6v14+KrBmg0Kb34Tx/O6AWh02VE85ZxD9RUG5/nHxNgZFOVEv88K5LFoeXPY?= =?us-ascii?Q?3pDxjOK7lDvYMj7EAShOWYyQAoKLIHDpNLPi5gXgV6ywSmkJtZH9MewKc/a9?= =?us-ascii?Q?Fg=3D=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d5f4d86-4d71-400b-cefd-08dbb5bfaea5 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 07:45:08.0162 (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: 2CBSpLruRFYpTm7zGkeAQmRun3jcGUYsf2PtWAeos2Zhd2ypyTF/b1JB1SKEwqjEv8ZYVnn01GgEgDVaCkSJ9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7524 Content-Type: text/plain; charset="utf-8" This patch adds a selftest for userpsace PM to remove id 0 subflow. Use userspace_pm_add_sf() to add a subflow, and pass initial ip address to userspace_pm_rm_sf() to remove id 0 subflow. Add a new helper chk_subflows_total(), in it use the newly added counter mptcpi_subflows_total to get the "correct" amount of subflows, including the initial one. To be compatible with old 'ss' version without this counter, get the total subflows using this 'ss' command: ss -ti | grep -c tcp-ulp-mptcp. When closing the initial subflow in __mptcp_close_ssk(), dispose_it is false, then tcp_disconnect is invoked. This will send a MP_RST to close a subflow on the peer too. So chk_rst_nr() is added in this test, and chk_all_subflows after closing the initial subflow is '1 1', not '2 1'. Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 55 ++++++++++++++++++- 1 file changed, 54 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 2ebe1692edeb..662800437a38 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -1860,7 +1860,7 @@ chk_mptcp_info() local cnt2 local dump_stats =20 - print_check "mptcp_info ${info1:0:8}=3D$exp1:$exp2" + print_check "mptcp_info ${info1:0:14}=3D$exp1:$exp2" =20 cnt1=3D$(ss -N $ns1 -inmHM | mptcp_lib_get_info_value "$info1" "$info1") cnt2=3D$(ss -N $ns2 -inmHM | mptcp_lib_get_info_value "$info2" "$info2") @@ -1881,6 +1881,37 @@ chk_mptcp_info() fi } =20 +# $1: subflows in ns1 ; $2: subflows in ns2 +# number of all subflows, including the initial subflow. +chk_subflows_total() +{ + local cnt1 + local cnt2 + local info=3D"subflows_total" + + if [ $(ss -N $ns1 -inmHM | mptcp_lib_get_info_value $info $info) ]; then + chk_mptcp_info $info $1 $info $2 + return + fi + + print_check "$info $1:$2" + + cnt1=3D$(ss -N $ns1 -ti | grep -c tcp-ulp-mptcp) + cnt2=3D$(ss -N $ns2 -ti | grep -c tcp-ulp-mptcp) + + if [ "$1" !=3D "$cnt1" ] || [ "$2" !=3D "$cnt2" ]; then + fail_test "got subflows $cnt1:$cnt2 expected $1:$2" + dump_stats=3D1 + else + print_ok + fi + + if [ "$dump_stats" =3D 1 ]; then + ss -N $ns1 -ti + ss -N $ns2 -ti + fi +} + chk_link_usage() { local ns=3D$1 @@ -3430,6 +3461,28 @@ userspace_tests() kill_events_pids wait $tests_pid fi + + # userspace pm remove id 0 subflow + if reset_with_events "userspace pm remove id 0 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=3D10 \ + run_tests $ns1 $ns2 10.0.1.1 & + local tests_pid=3D$! + wait_mpj $ns2 + 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 + userspace_pm_rm_sf $ns2 10.0.1.2 + chk_rm_nr 0 1 + chk_rst_nr 1 1 invert + chk_mptcp_info subflows 1 subflows 1 + chk_subflows_total 1 1 + kill_events_pids + wait $tests_pid + fi } =20 endpoint_tests() --=20 2.35.3 From nobody Sat Dec 21 13:23:25 2024 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 380163FEF for ; Fri, 15 Sep 2023 07:45:18 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VcVyfa9/vluihmy5rwr/xWMkBeeYFaRT3A5FpAGcAD03irlKPRa90I+UEAeBSi/1lYqDYYCbGuzG3tI2qIwVVF9U3yNnYENdbDlLd8+R15nNDisFD3nGQtFAvhEsS/dSVbrFM8nm7/LltPuHZqIanUQe0JnHGaLQiblR2aMA3WcxelwrBc7D7Cukf+G0h/9hGd7tlq3QgEOYZ5tfm73IFJiSNF9HC+4Un+WA6kbMe2FC4z4omE/c6JbD+/X1wkM6M+HTRQOXKRyqne6/ynAvM7z/m7Wp0E1KNRlnwyzBwixPG8O4us8q/MLYnzBXnFBo093oDHCTFv2JzcBiRvr1hQ== 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=NSAF9pVPQMGFCRRIZ2CWkJOpmYr2QAARJNPwTMUnHq4=; b=IA8U2rKirMjAeLqjjC5xKh0sSDDKJAk9yZTlsTd+F+9efOS5nOlcW+mJu7T06w/3GZ5rDGsSy2PXLahFeO1e2woMErwplexFeoFIUEdLqJFVJfyig473kDdzqOgChAk1cWuclKUmgVuMowQazLLBi6fY3FolaR2B0KkcL6YqlaKHXdUQzmWWCqzAvJxVIT5MZI8nDdcz/rvvTGd2TKGopq/rk1k2fl/08nG2G6nTkCZ2KztG4b3cXq/zCUBYWRO1X3nnQ0MtGG7RBWrYgRDLr7WhD0OOJAk2JRa2wPGMDAjkEN6ihM5oIdSd0S2Q1TVXDIlUkxfKrbjZ1X46BoeNHg== 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=NSAF9pVPQMGFCRRIZ2CWkJOpmYr2QAARJNPwTMUnHq4=; b=jLvZrj7/nYgYF6nvZu2a/XxrUpGXYACm7WKSsIPiapd+0T019bf4FxbaXkexmKeGZmIVlDKAKkqvFicZGfDDkxLyX+GV9KPE1MZ+ABz4DGZ7ECRCL4yNV/dTzOqPTR/Jf5cf8X2c/IR8NEZGRw06Mm8wvTCXK95OeG3MKoah7UftwgfaImRSVwkKRFsJ5I1J4w1ND6MbrxXLXw+9G+L8iV/8K/AISOjRy6aqaC47LGflu1jVOLzCzsm0VaogeFfmpp3kjP+HIR54WjLRxqZ0JDQB5C7nAuUWG//NJbocjQoV2JykF55MnxOytKNvgpk2iUfz2TcCwSOuHt7Lft5mSg== 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 AM9PR04MB7524.eurprd04.prod.outlook.com (2603:10a6:20b:286::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.31; Fri, 15 Sep 2023 07:45:15 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71%3]) with mapi id 15.20.6792.021; Fri, 15 Sep 2023 07:45:15 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang , Matthieu Baerts Subject: [PATCH mptcp-next v10 5/8] mptcp: userspace pm allow creating id 0 subflow Date: Fri, 15 Sep 2023 15:45:15 +0800 Message-Id: <662455ce1e286ba38ae29dde19f43ed51629cd91.1694763508.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0011.apcprd02.prod.outlook.com (2603:1096:4:194::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_|AM9PR04MB7524:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ee91075-ce29-4148-4161-08dbb5bfb363 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P4RL4m4argMJxhkXjTBeOtte93l2gq9kD4j3DrZNKt0IMbTWcrCMb0bNt0GK1Ip/gRMSWa3RP0BLXbqj64iA/cl+uqkEZI7h/9+I61M0YxVNlKXyU+G4GqZC3sKGpFryS9K6T1w7MNNhVdBJudGPHlHwGAnQQeVGA1SjtPWxxae6In41vxHbrSz0xIcKQLnoR5NekZOCF8+iFXsxtvd2X4CGrjpsb2lDnNXhV+DsAf7reF1gdDFxbQ3FO7BIXVuaKH9S4em6p4qtq7uXcqkeX9u05rf7BnSz9Wc8xW/IkjGO18hzY3xJNp7+edHjj3yoZicS3hpnezES94CYbw9VN4t2wrvA/9XSFM5PO3w2VakLo0dEk14BuLAnsK/aVsS+OKJ38P+liaAZHACNFVxr5J9zAPlVFcRPbPy+XmoEF5k3yiOX0d72yWOVbYMmre/oj3BuDjuqWCvwLpuY6unyA103N+AUZpncz1K+N3GW3oTNdIvLc6pguwqE51mz2jTANEalrCBTOal3rwpyTd0Fd6uUVHcRNDp61yxj2+zvH+isDjPVg3Sn6ZeYxpwbHhYTZEGIm+sx5+uMEzyLPa8xGh8i77mYZZbzFgdo+j5ptsM= 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)(396003)(376002)(136003)(39860400002)(346002)(366004)(451199024)(1800799009)(186009)(6512007)(6486002)(2616005)(26005)(6506007)(38100700002)(86362001)(966005)(478600001)(8676002)(66946007)(5660300002)(8936002)(66476007)(44832011)(4326008)(316002)(66556008)(54906003)(2906002)(6916009)(36756003)(41300700001)(83380400001)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?rw2Wawl/dBtGwT4Jky5lekt1GFZG/odMfH/eJoShjeJjgEDTlHXGms+VJOFx?= =?us-ascii?Q?z7UITzWeEmHTuKHMXPSuJw/h3JloJtkYWE6oQPhDdO+A6Zb4SuJ5Hq3200CH?= =?us-ascii?Q?rp1pmIroQrLfdlwsl47xnu30jpPZiQidt8RFYqfwZP2zgB0WpZE6bc68LkVw?= =?us-ascii?Q?LhJdnxHtPLsXfusTLsE83yUG2HFdi2AQpsSLaqOVIh+E9pgCA7xNbja7V6iz?= =?us-ascii?Q?BnDswLwspL2wPd8w4icJuOktvg5YI5ALihaRHiIFQzKjCkHiRv2italgPl0Z?= =?us-ascii?Q?AC8TBsJfGhf0ZaaJU0N16X8cQp2lR/es775G7v6lzRCDV6yx+xI44llJnBpf?= =?us-ascii?Q?wJvunzR7O0eI3nb+Ls6zaA63UtnNRiMG0JqTPZph9zhm8mdwOShdet0/aKvZ?= =?us-ascii?Q?a7hHd5S0wGp+QxQSklLfb+/zNoFOXlNSF36ijjMegPfzItRRMpMsrkgrGFWd?= =?us-ascii?Q?cH/VqwnRbAi4sTPksEbdew4SJcf83FuZJoQ8Ep6JnZ2Ldr8CHnEm5kHHZAWB?= =?us-ascii?Q?yXCdUhJwOwotq+zEAL9BkD6A+OzeE6LNoIweLXFLJ804IdpcMo5P0syHNVuQ?= =?us-ascii?Q?p5dOaHMuURKSm+oqn8yHmyLkBfnxlanmm7Kj9qRQprOKtAreOdGbZPVJV6eU?= =?us-ascii?Q?if/JzZER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/WDw?= =?us-ascii?Q?4Hq1C/ye3JAQ7Rd+9bzVTFko0KkqKYPyH1GrCOdnjCmTO5+Nf+t2vKrYub3N?= =?us-ascii?Q?Gw=3D=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ee91075-ce29-4148-4161-08dbb5bfb363 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 07:45:15.7506 (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: ouUxoeGLBcnUeSn+w7gpDDAKC6mAkX8fvNqn7SGPh1gjkeG/GE463h5v2yOePYxOHGCht3cRxikVwGdRrZK0Cg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7524 Content-Type: text/plain; charset="utf-8" This patch drops id 0 limitation in mptcp_nl_cmd_sf_create() to allow creating additional subflows with the local addr ID 0. There is no reason not to allow additional subflows from this local address: we should be able to create new subflows from the initial endpoint. This limitation was breaking fullmesh support from userspace. Fixes: 702c2f646d42 ("mptcp: netlink: allow userspace-driven subflow establ= ishment") Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/391 Suggested-by: Matthieu Baerts Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index b5a8aa4c1ebd..d042d32beb4d 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -307,12 +307,6 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct= genl_info *info) goto create_err; } =20 - if (addr_l.id =3D=3D 0) { - NL_SET_ERR_MSG_ATTR(info->extack, laddr, "missing local addr id"); - err =3D -EINVAL; - goto create_err; - } - err =3D mptcp_pm_parse_addr(raddr, info, &addr_r); if (err < 0) { NL_SET_ERR_MSG_ATTR(info->extack, raddr, "error parsing remote addr"); --=20 2.35.3 From nobody Sat Dec 21 13:23:25 2024 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2068.outbound.protection.outlook.com [40.107.21.68]) (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 1BFBB3FEF for ; Fri, 15 Sep 2023 07:45:24 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AAJcDYuFr6p0S5r60/9wyyL2cbbKjRT5s7MJwVPeJkyZN5xWjcOd/SopGJuiNGY9p+zYk5rQMBYA5Hh/iRLCXdSE1Wg8TMSlwqqgVeKqJlR0ChhmMkwZAE7ISnUMnupZMnQL8ZJWbPas8ug/qCOPQ7EKMM4WAlfQVgkkScilySK5tNw+A2of8QAd5JGYsYGVMZVMGT9EgjWSrK5uvh6YNs0JDEl7IQKwgPQTHwZD/VXasFzDqH7VosDN6uQIPXUcerTsQ2buV8QbHi/6Ya7Ii+x+w9JmyRUnLFlJ3Ti7/1mJ+YTE7gzJ0+tkyjSP/nhIETyaQSKPvMh0FDOw0o9zfA== 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=bydDROSsm3rpJY5/kWMfWLhNClfLekoVJ45cKwtN7s4=; b=NY8gaY63GUne7Rae0KHso189WDkInizI0bE4vBgTB0ngojau9RejApe35K1KPsbxg2maUCiV2Nym/aZFBCWIz2TWYnLzwSLb5IG32+RdxXUkEyCuAX2ePZVE2h09X9ZdnegOH9OpS/dXwv8qIpR8DcrpBQqwCCI+YoazA0MxkOLR9f78WlMnRoso1Em0SIxm2PIiPnAkOF0NBJtuIx/I6JRu3ld33Ti4dp/ZS6ad/5Ni1h+RQ0j59vjfzIts7LdrY79/dymrPKr7q6p0qqevo5KvEhhPnc0zgc0nQwWHJBBGMd1HH3UChMtVFuXuFmY4AIHre4pK3Z20/ny6FDVFHw== 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=bydDROSsm3rpJY5/kWMfWLhNClfLekoVJ45cKwtN7s4=; b=fMAHEoFNjHAY63KtoqTc7mXzfS+sQBeJ7CazNy0+lYC2xdP/SvoBcEc3aXhgAIdLM5PTsc6GIEt71aO2mMw7u1563sZRYjjBetCtuYX175KLzVpBjuSzpS60vlw5dIxomwjRbWDLRmwApenJkAS8nMryXA/kahDU/zEOIUGHWh+DtlGm0h6RIQitA6D9x6nxCID+hAEUtT9Bg+Tl/Q+H6rK+RZCJOEaw+e404ZwsFSBr2NyUE1gtRsFAdOa2eOWRuQASF5OyxSVlcLGklxc+2hJ6HTin0Bw+ljcmR0XqaS+KAhDQCPxFbiAgMmOX1BK8YonvP33fm1yPZmw21GbNZw== 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 AM9PR04MB7524.eurprd04.prod.outlook.com (2603:10a6:20b:286::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.31; Fri, 15 Sep 2023 07:45:22 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71%3]) with mapi id 15.20.6792.021; Fri, 15 Sep 2023 07:45:22 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v10 6/8] selftests: mptcp: userspace pm create id 0 subflow Date: Fri, 15 Sep 2023 15:45:16 +0800 Message-Id: X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:194::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_|AM9PR04MB7524:EE_ X-MS-Office365-Filtering-Correlation-Id: c12305cd-5432-4484-1293-08dbb5bfb737 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: puH/fvsggXcz+g6AEQP7ODJU4ODc/3NqskKRkWRmtKy/wNyahHeldmS04CBJPrAVCHEtQ3FQHcy83kd+mR4QSR6D+rExzLIppurUo9VTMRtHoaDtGAz7ln54gS9rsHvM2QwBTb5fBtum+NJDeu9Fxsw8MmVK5CD7xrl7IbcdphxG418x6jnNnqunBDOXBtiGK05ydYaavCSRpJlbl2bJpufPHKt8sT7o4/wU37+r4bSY721gF/OkRZiMxlwNIBXDlyQbWFbrTQbPPRRxnfDaRa+yJPEz5oXCaBmHm2tpgimi4cLUeMikmQbdIzqXS/WB5rSzFO8HPqUphnNCAxRJOA46MTK5bhhcDAJDwBUCof5CEmNcs711o3q3JgCmh/iLsAiQ9cOGAzGPxR8FiQoQLspdWAIJz7ION5Q3WOdaEXv5HwqOqSIFZd7lSggs64VNqMw4XBFkfCXWLyBpVqEMgMXJyo6PH1oQMPwUUr1g9q0/f1GzIQqWbSb2UfCqS3pb3Bme5U2Qm7TncWJ8ZwrUbR9bTuwGQz7q8O7DzE0SSYKIW15SkKTlsvw2gMTDQHGtBhqfUP8hZ+onePJ8aYsqyedVfdQjIf+jx4miAAR/hhc= 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)(396003)(376002)(136003)(39860400002)(346002)(366004)(451199024)(1800799009)(186009)(6512007)(6486002)(6666004)(2616005)(26005)(6506007)(38100700002)(86362001)(478600001)(107886003)(8676002)(66946007)(5660300002)(8936002)(66476007)(44832011)(4326008)(316002)(66556008)(2906002)(6916009)(36756003)(41300700001)(83380400001)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?46OC8kDisoBE0wZ1DgXjT5x3ZtEp7JDTOElB+iEhv/gqcW+XZUVB6yebIV23?= =?us-ascii?Q?Vnie+SEsY4i196E6rAJVF9sZwE0cboDeij9k/MUyJ18J1uZ3dv15t6SNp81y?= =?us-ascii?Q?Q4Zy59gdTi1OIHomKfGZAuvrPEWqFvxoMDOcLo2AzdLRJ17jgqSbNnLqQ/7l?= =?us-ascii?Q?AjIgfSx+eGs3A/FAEZMg4CEjDNDHpTlcUZWjZS34VwQvmAXSzWJj3Eaq4DMN?= =?us-ascii?Q?4jBKHLRTeLzTMuP9Dav5Cg3HAM/2vqo2TDBF658Q8ArkNSr9w4hCXVGxKK7R?= =?us-ascii?Q?7/ofvHhL6LTOq2rDcrHNEWyHeQ3hwgTNiG6kqm0R+zVPMfS0mAP3slFBiTH6?= =?us-ascii?Q?M/wYDsik1kg8t32C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vz5Y?= =?us-ascii?Q?tZneWHfyvlkvlLYWJCbs3nojPwr/qbj9jZqqpI+lBc9WBLHVWZSn15XGfBf0?= =?us-ascii?Q?QKqE79wwwNYShVbSIv/fLWpSFlclBlZPEPxAZA2mySLZAkrFqDsa+2fEyIUR?= =?us-ascii?Q?wKFJQeXGqK8+NELOgCqaRmTIMnfpbNyetve+vU5+dXNNfZLX+r1h5Ys75+nN?= =?us-ascii?Q?fi9Wf52hzp/wlzyeeKvsY2NFMoA84SN3ujSJTbaglx/tNE5ILEtej5ELDUn8?= =?us-ascii?Q?90nf38y70z6j3IQcbJJlXEFnspj4ORiN506cC+4qm0ygUlLOuBSER+9aAe0g?= =?us-ascii?Q?x/R+f6pIzh7yIw559MIl2pfT1mswcOB66XM+OSPo3pGXEhEU+O49+w+xX0pk?= =?us-ascii?Q?Mw=3D=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: c12305cd-5432-4484-1293-08dbb5bfb737 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 07:45:22.1833 (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: YnGSM5o/qopfe1qYZEq1Y83vm6HZpU7yqeDfUJ24rxzzGz7B+i1avDutxAam9nwl4T4SSJuqMzOfdHZkFEbKYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7524 Content-Type: text/plain; charset="utf-8" This patch adds a selftest to create id 0 subflow. Pass id 0 to the helper userspace_pm_add_sf() to create id 0 subflow. chk_mptcp_info shows one subflow but chk_subflows_total shows two subflows in each namespace. Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 662800437a38..2d5815ce9095 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3462,6 +3462,25 @@ userspace_tests() wait $tests_pid fi =20 + # userspace pm create id 0 subflow + if reset_with_events "userspace pm create id 0 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=3D10 \ + run_tests $ns1 $ns2 10.0.1.1 & + local tests_pid=3D$! + wait_mpj $ns2 + chk_mptcp_info subflows 0 subflows 0 + chk_subflows_total 1 1 + userspace_pm_add_sf $ns2 10.0.3.2 0 + chk_join_nr 1 1 1 + chk_mptcp_info subflows 1 subflows 1 + chk_subflows_total 2 2 + kill_events_pids + wait $tests_pid + fi + # userspace pm remove id 0 subflow if reset_with_events "userspace pm remove id 0 subflow" && continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then --=20 2.35.3 From nobody Sat Dec 21 13:23:25 2024 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2068.outbound.protection.outlook.com [40.107.105.68]) (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 460183FEF for ; Fri, 15 Sep 2023 07:45:32 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AEtMfBv7iR+IqefjriyfbHHLQxqbPeIJwSUS5e9NyqUk6eXYqSvrN+PCme7LyaPQTVEKpwaPkeF3yw5Nsv0wIkZCCjmBuhzfp3LBENgqD0wQ87ogcpdwTOQqRjS3/dVIcIx1YqyI4qqCDbDwnJZxUW3A3Kzj67oFp+mn7udkUnOzGZnJe5DXWkK9LjAu9Hht3CT8zVc76ojookTQ6VfqHeTtNu6+ufQK+M4l6HdAXSAiqNUed7zvEWKffOQUClXEQcaVnBlJh/YliEgBjo29xQOUvPn2hEck/15uXb1oVYj7yh+ULHxVpeQJs3gZgLNWTHUOBvXQuF5R5ASKhE+68Q== 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=Z4jRpiI0jVho3tp+txq+97yEpHB0GlYcB05QEGS3g5U=; b=T1GSfSiFzwxCt01EyIvwZRx5EaDbPSMH2/4A4GNawxhkLGxO7VqQgirG4YGWRt4d4t4Q8JdV8lwcJN3eGVlTseVttB/15FEA5paMVou/yNYpe2h3PCUpSy+CrQaFJnO4a//fAMmMtDRZ5WoKdTCVKxfuEw5VTYiL4RGV6Iscn6C2YkBcivfNkIG9gRrYdCRBcnLCDvq3a2kTvRRxpOD7fb0AI5EEkHn7DI4VHnrDVV1MIu471YKBXHKwv0aQu5kUsB3cYddzYesQj9mpguH48+Wvo9YWPoSQgM6nl1VSGjrlPErVKRHVSKWh9wly5f1qYzyvUCTKgcitAa4hfys/kA== 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=Z4jRpiI0jVho3tp+txq+97yEpHB0GlYcB05QEGS3g5U=; b=sJvk7RjD2UOJJc3eu4QFdTDBDuHm+rrwjjH+WGqdB7deyFQRczlg4AsSRu1e3zFyOc85sXEEE26moyyqWZWYIcTaR8/4f9BxBp6ouTvOvh3A6qznq4PgFDhmuELRTgyyDR5tJxp8IcU/GxDK7NHklPcE7lq1CihANmGOe7heoox6ZEFmSrJXCk8T1pdKiByhveM8DaqqxrRiUCbgyoq7o+v2Gb1wQpteYCIotJdtzUi92kwW4FY+7G2oPNzf1nLmu/Jdpc+OnXLVLZLesILkIkYh6YIBzWCINVQ+Z5FSQ+lt9GkHnVul5sqSrc7MawwppwlmjCTXoYXr+hfretELig== 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 AM9PR04MB7524.eurprd04.prod.outlook.com (2603:10a6:20b:286::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.31; Fri, 15 Sep 2023 07:45:29 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71%3]) with mapi id 15.20.6792.021; Fri, 15 Sep 2023 07:45:29 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v10 7/8] mptcp: userspace pm remove id 0 address Date: Fri, 15 Sep 2023 15:45:17 +0800 Message-Id: <9b4409f27299b8bb82016d777ea759ff326a7393.1694763508.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0017.apcprd02.prod.outlook.com (2603:1096:4:194::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_|AM9PR04MB7524:EE_ X-MS-Office365-Filtering-Correlation-Id: 3d133c58-e29e-4ca4-b26b-08dbb5bfbb9e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P8C4G3OYmdZf4Q0QAHi2MtGHl04Y+IA0UMhNBahT3a3Q9Jy7C4wyk73EGb0hSuAnsCTP9e85is7BMyAJe8i+saJkcXvOMW5+RF21/LyHDMgfOpH1IGjM/kN7ImO5BtnwIOjDnYILI8CJSwNNx8TMyCM8eoxyf2rrqcbQB7wSeu85aaQxdwNGZoZeIeSqx3QNU4D2ZuYP533Nd6SGuav0cvkNjZta7QSywGMLD8XGWfrIU+616sdaz4zBY9B/3c/ygsfDgoSRZomKURI+nnk4iN1lYWqVWGkEedkAoiNLcgJ+6bVwdQ5PH1BAxURLb6JA8Ld1LbLVT8ibvZzg2rHR0O31OeaxeX7xidfwCZohVzj69WHynC7hTV5l9pWUHADdMUFTjhJltQ4pPtVi4ZoYJQJbpKKJq8SIOiUnRjF8GGPaN6HVSAeiZTS+aT8DF5jnugG1lCdHBfWp8t0ubbWY+ZCQMzGJ41i5ZcV8ab4g8Hu7cwNXZoxNK5J1wPnpobOLrt21fsYPuek2RY6WH6LsDjesQKTJ9okITtJyZPnCWBPDHLNejUWw+AY6xE4u0AcbC3peg2ml7n06oVVNRMXh9fU1HujnVMOSBRMZv2/vN9c= 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)(396003)(376002)(136003)(39860400002)(346002)(366004)(451199024)(1800799009)(186009)(6512007)(6486002)(6666004)(2616005)(26005)(6506007)(38100700002)(86362001)(966005)(478600001)(107886003)(8676002)(66946007)(5660300002)(8936002)(66476007)(44832011)(4326008)(316002)(66556008)(2906002)(6916009)(36756003)(41300700001)(83380400001)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Nw1TgG3+Pvd+BG0PbfZ5YTt6zBz6X/3HusJ5upZNawAhcYCUmADzhcQfMe1l?= =?us-ascii?Q?psHB/zEoTRlIGE3ExNqHuwp9fHgoLkhyyGXT/yLEgtbJb3tZtZaBaNjhi3qs?= =?us-ascii?Q?Ds/djgvJIw+aKjx+e3hwS+HS3QJWiOAqt0rzV74P+ylqxDlt/mHudtbOMXNO?= =?us-ascii?Q?WkzHu9foAOOOWMp7SSK1yxNzqQxmG8ARfkMQSmrhODfAkih/bm4fgzMth9It?= =?us-ascii?Q?qiebYCtdp5xC80OoAuD7nPEEIzaj4H9cbrBAar8KvO3ZyM3RLwUNqwHfpbVP?= =?us-ascii?Q?yXHBPsQSFM5YFMWPSiND1XvlJwRHvVfMud3Q8h0opFxKjWThN70bLkncCuBs?= =?us-ascii?Q?lchp8WbC45sI2scjKQkNjwBUlVARi6Qj1uTG+5LuvgEUjHE4qUAcprFo0ozE?= =?us-ascii?Q?gasyocC330oq0cfTwZ1gDgmWbMCHxRrdWriUVprhnBsorqLfKEHKrxWCiakh?= =?us-ascii?Q?VNdHxczPTYCmNbs5uDPcSFolrrKFrv2WL5aQA0tfOn6CIPka1trbcOLuEQIj?= =?us-ascii?Q?qB5ax2M2Jfunr5x1Zrt+6zMnr9t3/yhS0gmgiz7LpwntTMEbWyQREa3unN4E?= =?us-ascii?Q?yiDWaZZJEGOmQVN8BcRC+aiPWDrM0jRGFNv0VY7GIKlDES8xVx+6Q2jmhu6x?= =?us-ascii?Q?gVuq1GkJK2t3bSo9YKycrQKI97d7L92ednS4yRmnYGrYZqKy/xMhJNBfwU8D?= =?us-ascii?Q?sMSm7b2s6DVisvlomQH6y1oihdiJIZ6aEABg9G10IytE41Xz7XUtc5rVAE9G?= =?us-ascii?Q?mcj8I8lumiGQkCh+9ZLrCCB1qIPJsPGtqLsHwLst6lhZ6nDYUzsYbwTaWhtY?= =?us-ascii?Q?aWjmugn18c3Uai2/685JHDk3bBkUgqG0IbKZlTXna8rGPzingL4JhYgDIvOI?= =?us-ascii?Q?fyVOV8DpgLDWPAt2ASCfXHNw/XGuiJgq/w6QhC3+tlC/tQRJLaQnVC11VkyS?= =?us-ascii?Q?oY4KpJGsjC+0R69zyZg6NJYQPTxa4lMMpUwi6++b/8KaswDphRYeuLjLuVqy?= =?us-ascii?Q?OS7jxPg6VnoGbNpuyS6xIhFQFa2ikBV3vxeYWqx0twpgUL/6HInA62KEeBmc?= =?us-ascii?Q?L986KUBjNm1qEo6QqcH2W/uQdgmNhYQQLNfFHBVdrMOwX15lpw79y6vuwV4c?= =?us-ascii?Q?30ZFvZbRh3XMqEXNVHfvEwZDZT/ldrbn8At1j4uECKO0VaT8KYnmMfzlPdpx?= =?us-ascii?Q?zvhEPVOsT0ZljwXpFQVq6QbcTuwbUDrI58kDmA2NHpqvDsQpLHMS5cIgxREQ?= =?us-ascii?Q?LjjaHt8I4VnpcGI3ETmT2kSgkPNI9irY8SDTBcpXIphUmeSdq1nB8ZLh0XB4?= =?us-ascii?Q?3YrJHK3FBpO0x0iBF9KtPwEl0Wo6XqHvv4j1075EEk7qweKJwdRnUKwsfG8K?= =?us-ascii?Q?y7zloNY/80HZ+zNXRE9gqP+kJXmWaqdBa2nB1QXdDDIoTgBzmUEhOtsLbfyR?= =?us-ascii?Q?jzTlZO50JyrY1rOl58rhlXwUWGZK9jGdLNIhiFol5BrAlFArtec819g1zU+D?= =?us-ascii?Q?tL5N0Rk4tHHU++ofH0kXeHDrzfoy0CBp5XmwllWYzVj1zoO187cyEpCO53p0?= =?us-ascii?Q?NhnC60FAJPubiDff99eRqwA5n/uoen8vhPSUVJ5ONkVxwYEDlLhqARv2gc6I?= =?us-ascii?Q?Pw=3D=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d133c58-e29e-4ca4-b26b-08dbb5bfbb9e X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 07:45:29.7455 (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: 3Rpl7cvkGGk9gNTOGMrOYFtJvk89MMSN29V6lwY4Kwq2E3lXlPNGhh3uD6//zYjeOLCGD5Pqm7sLMCtK2fEKYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7524 Content-Type: text/plain; charset="utf-8" This patch adds the ability to send RM_ADDR for local ID 0. Check whether id 0 address is removed, if not, put id 0 into a removing list, pass it to mptcp_pm_remove_addr() to remove id 0 address. There is no reason not to allow the userspace to remove the initial address (ID 0). This special case was not taken into account not letting the userspace to delete all addresses as announced. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/379 Fixes: d9a4594edabf ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE") Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index d042d32beb4d..b0fd7440016d 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -208,6 +208,38 @@ int mptcp_nl_cmd_announce(struct sk_buff *skb, struct = genl_info *info) return err; } =20 +static int mptcp_userspace_remove_id_zero_address(struct mptcp_sock *msk, + struct genl_info *info) +{ + struct mptcp_rm_list list =3D { .nr =3D 0 }; + struct mptcp_subflow_context *subflow; + struct sock *sk =3D (struct sock *)msk; + bool has_id_0 =3D false; + int err =3D -EINVAL; + + lock_sock(sk); + spin_lock_bh(&msk->pm.lock); + mptcp_for_each_subflow(msk, subflow) { + if (subflow->remote_id =3D=3D 0) { + has_id_0 =3D true; + break; + } + } + if (!has_id_0) { + GENL_SET_ERR_MSG(info, "address with id 0 not found"); + goto out; + } + + list.ids[list.nr++] =3D 0; + mptcp_pm_remove_addr(msk, &list); + err =3D 0; +out: + spin_unlock_bh(&msk->pm.lock); + release_sock(sk); + sock_put(sk); + return err; +} + int mptcp_nl_cmd_remove(struct sk_buff *skb, struct genl_info *info) { struct nlattr *token =3D info->attrs[MPTCP_PM_ATTR_TOKEN]; @@ -239,6 +271,9 @@ int mptcp_nl_cmd_remove(struct sk_buff *skb, struct gen= l_info *info) goto remove_err; } =20 + if (id_val =3D=3D 0) + return mptcp_userspace_remove_id_zero_address(msk, info); + lock_sock((struct sock *)msk); =20 list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { --=20 2.35.3 From nobody Sat Dec 21 13:23:25 2024 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2044.outbound.protection.outlook.com [40.107.21.44]) (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 CFB513FEF for ; Fri, 15 Sep 2023 07:45:40 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g80nsooIIL2OwZz0TQPvyM/fTwXFWKEE9YclEXzFiR3Q6dIvt9DXvUjMGSo7QDSnbP2Zj5mie6hKZxpSUorhEbY6ZtagPN1Cwt4fDeUnJAMCKhQbneMoIw4vNrSNIBljA2p+Z/pkb2gx0vXujoKF88py8qhcmNV/OKcOqvDfWCOQdDylOWesE4jeIVa9g6ytrm4XZ45+2OjEvb4I/YutFebmzpMFmHt5WTrF1mvNgIoOlswfy2qP7RPZeNswbJw3GzKbPvY7F/C4C3PBrkekj+1+Qg1LoUFTNPxyxZTrLkaaJzhj3cwuViyX062zsB3+mC2T/g93MpojuUAAvkJ02A== 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=zAR0czk6igmMGBlZHDMAiwryixgqEW+X5hN9wMXKYcA=; b=oVcNsPTPAqkcbP+aE0ATJgk5wxBzFBmIZ3v5rxPUCTogjueDCQXNzYjk8F+oLPBA4F9I6/ZkbVRvLBu534Wjc+bsHFloy7U+0bkwJE9NAwL3/UHUezE2LMJ002h6kriufTZ68GR6xs7LSzw9pTt2Mr9CvzKXv0WYk1ehcK96p+gqDK0CmIUNyozvbCpDbTnCsofn5LL7JKVZn8898yXjDInRgGMlbaFmB8go8nY0a7R8Q1YmYZ2x6MPh9NCAVDxg/c3fw60dvpXJBQ/Wtt4ify55GruMppnG2bcTIKZaD0lObMSoVbhmimw2VP2ersfCR3AHlsFmLn1ddUWHd8UVhQ== 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=zAR0czk6igmMGBlZHDMAiwryixgqEW+X5hN9wMXKYcA=; b=bwde9n1fUhzmPqSCg49mTr9ntI0pHMvJxS0HAZ5jZ/So6RVuNOiF54nGlaEEXNJ1XBWEWnM4+zVlIZuCq0T62JsFzzsazjEQYdqJBZSAOisyRs+IwizDDsN8MHJEdagdAzQa65Uo8zhnRYBmhbDOBs25VLt14y/GzDuHcre0rqams71p+V8hj5sdHdfBQ5e0qxfEtWPWgP85eFepCFXrjc3qS8pnK/9KQfItudNZQ4sE7k7aekK1zh8ceeqjUEsh1tsQQgkzod6Wa2lUuaS15rUTWggLPMPwlMjorR70nq963KxZxh8ONkAwVpcAYRG5Fl5xIjBOrgwKaZ7gNjlEwA== 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 AM9PR04MB7524.eurprd04.prod.outlook.com (2603:10a6:20b:286::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.31; Fri, 15 Sep 2023 07:45:38 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71%3]) with mapi id 15.20.6792.021; Fri, 15 Sep 2023 07:45:38 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v10 8/8] selftests: mptcp: userspace pm remove id 0 address Date: Fri, 15 Sep 2023 15:45:18 +0800 Message-Id: <2e4ab346b47f4f36a9f6e29d2decb99ab00043d7.1694763508.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0009.apcprd02.prod.outlook.com (2603:1096:4:194::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_|AM9PR04MB7524:EE_ X-MS-Office365-Filtering-Correlation-Id: c06f42d0-cf14-41fe-357c-08dbb5bfc08e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VDYmQJ0H6qsZxbMqt+sVSgLZasJqwuT9ui7EN3WC2z6+OpmweF8ZsT2LwVj8iLKgJyfcHaXGCFRhg9y7cIjxhbE8T4Nr2J1cgAg8Byg9g88NCX/avh8tWXg15nlPj4jkxmfBTYRkqb9Z9JxrdaL0Egc5KWRRBgo/xjAoDt0VdbHKdfstT3Gkn16B9vLnrDiKtArKjCeekF67UoRsLbyfrZIAai8wMbvsO/HGZWJJ6McIs1JRTOmtLNML/qBmVkjaUpzKWC7I2PNQWlcyNbWmTE94iDcQxAUQ+Bhg9eVXckPzEb9VyoKthr7WQZZD40mahp2i1LbgTzWxX0m0Vos3zhwB+4fjucvcPG6n6fOndevmSD3QHC6AeSVsWqaRG0GrWVjvg0qnUdWDmhwjEZT5Gr2SsT/B2sFB1xqvCyWAUNSPBIS13GNXm19mZgb/fGG+HE6a1NeH+U2aZHgrnXH+NWl8c5noydiGJHDwJfle3ZmxSR4eearxs+qjL+1E668+kAEk4S3pES3+lyupzkVZLfsZ2TlrcwuxESQCIKX4AnvRtjweepOU8mcndAK/nbaHTOERRkP7AsBHxY292sEgJolKFF0PoZZAuPyQA4KEe+U= 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)(396003)(376002)(136003)(39860400002)(346002)(366004)(451199024)(1800799009)(186009)(6512007)(6486002)(6666004)(2616005)(26005)(6506007)(38100700002)(86362001)(478600001)(107886003)(8676002)(66946007)(5660300002)(8936002)(66476007)(44832011)(4326008)(316002)(66556008)(2906002)(6916009)(36756003)(41300700001)(83380400001)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?MBjU3NZ8ltrk9m633spUZnePrm5losPr0thFRx1fZfJK+5ivp1dy+kQqilr/?= =?us-ascii?Q?V7zbrakAY3s5jqVtwnM+C5sLt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-ascii?Q?XurJvBdjnY2Fi6LbHWVDVYoT6Cx6ojNDorr0Lc0LOfOyFXA9EQqTHa57dTUn?= =?us-ascii?Q?gQlL5nBZqOps3waqeB0dVlpS/ce6kb9BeVOCkJudw4QIOfav94emt9+X2wnX?= =?us-ascii?Q?57ocnVkcY57lcq5GtvdBmmyYHlOVd6JGSxTBrwL/PPzbzER87TeHby3Z9rMT?= =?us-ascii?Q?aJifuEpcr7J1r8Zs6K4B8NecIV7gLVpRXrS+MKCJTDtlWbFOFRFMjpIJHjzO?= =?us-ascii?Q?g2k+Jbx5OvNQP6cEqO+rSmatjyDLldyWaGtPv8GLb8WmeZkR1DkjKQEEPNly?= =?us-ascii?Q?7nz5yB0cT2pDSknUBGz+gD738CIJLOg2lGnJAjAJw6/FtDiPUUiTcxLykWba?= =?us-ascii?Q?C0S11bNubYJWpwAzSNGuDqnQgoBOJ8qeY60emZF4fdzV6GRJsUcoyYm0VKKv?= =?us-ascii?Q?3SsyY6sbBr206BO8Cst3hEUWrI0BI9b6FReh5v4wVrzwJUa2Y9A4vFYXWbGf?= =?us-ascii?Q?xEpqn5asMdjmynKOkFfo+VvCCytTYMhMiGbMR0s6OwIg032CsQDvImU4YYOJ?= =?us-ascii?Q?GDYTSPMZiNq8x7x83u19nXZIHXhqsh2bs3mJ1iONuSKqNg6iFiUH4ABNdbon?= =?us-ascii?Q?+ulnOGsECa7VfH0cOJeWwyoaprJ7eB4RPVMq1o33K7QzvofBCuAX56ijmFJI?= =?us-ascii?Q?wg=3D=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: c06f42d0-cf14-41fe-357c-08dbb5bfc08e X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 07:45:38.1961 (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: kJE1VqG764aOoXdMoOU7pXJ1AIM3YIAkFStgvoBK9KYTjLPtYECerezy6FMPSYO3Hfq6qzgHR+6dWO4zzz6IbA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7524 Content-Type: text/plain; charset="utf-8" This patch adds a selftest for userpsace PM to remove id 0 address. Use userspace_pm_add_addr() helper to add a id 10 address, then use userspace_pm_rm_addr() helper to remove id 0 address. Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 2d5815ce9095..f25231a8f32f 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3502,6 +3502,30 @@ userspace_tests() kill_events_pids wait $tests_pid fi + + # userspace pm remove id 0 address + if reset_with_events "userspace pm remove id 0 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=3D10 \ + run_tests $ns1 $ns2 10.0.1.1 & + local tests_pid=3D$! + 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 + userspace_pm_rm_addr $ns1 0 + chk_rm_nr 1 0 invert + chk_rst_nr 1 1 invert + chk_mptcp_info subflows 1 subflows 1 + chk_subflows_total 1 1 + kill_events_pids + wait $tests_pid + fi } =20 endpoint_tests() --=20 2.35.3 From nobody Sat Dec 21 13:23:25 2024 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2078.outbound.protection.outlook.com [40.107.21.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 51FDE3FEF for ; Fri, 15 Sep 2023 07:45:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UkS0Rd2mMJeZ+1Da8aWIoLkURZnb4/Tbe2w+EyAAN22lOKEnxoKK2rr17GqTYEpy9c52QYB9t+gUT2xW5di+YR+fO1cl/caTNE7V43gqe3eC4C1k8Rs6SxS/f9qX+SNAxkipkEX3QNtsdSELvOZyCoWsGlkDORvC1HMStSsrF1Zd0fsxmABR/inLmvifIbVZwwjrQrohPVF1fQQVr/Ef9FQ8wwWuELohowiHWf5oNepBw2XcvjafVsL4pXloDahqyvfDmjXSrp2N+nwisHNRjgUFmdZOSoCieou+oBNzCIRW9Vm/Edp1PmjgiqIe+16641Z0MT6xDU1oytdY4k1cbg== 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=jpp/i3aXk61yYFGbObLKa/JLeNL25iavaTEjwCip/sc=; b=P+aQYtzcDR37OOQ35cfjKH5pOx8j+SAzDJcf2Rm/tprFUsbYmESiHhDyLRfaoDu8sECMpsdbd3G+w29+8LLLIvX12ZOW35s20IZyPxtGXSua596J6AOjL6AbwB0cxXOdv/0pjlY7CVgTGwdh04BpIRdnTqdzJQWytg+Dw9Mb7shWZpH6nspMCYJ2WViwTt+XIbFTTKyZkyVPZ6pXr9slCj8Z8fuiVYCBFSWjWvq/KaPQBiOuWSAXwgqlB8ooravaon33oNyuFrVVAfNH0HrrxRBHE4bJys1EqhF5/1hsCVhCrG2bmyPjaa3xxuKkXdxFSOUk2Nwz1MHjb6w5YwuTuA== 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=jpp/i3aXk61yYFGbObLKa/JLeNL25iavaTEjwCip/sc=; b=sfbxbPWiG4nUdrPmVNiG/l509U/NiamVHk/s+8PORZU2I9PMwCMFZV+2vdpNdFrCDFJH9Gd9L2vsxvf3D859M4pdOtZ4+bj6UkEA2GwkEm5UFEWHrbcbvozd5HEDHJ18hd4Xug59Ja0XokCrmPKX2XW/FArcvrHxAWm6neMiuiZ2CVgXS1UUpHJVGQLXux0p+tyRylSdVXOExGlUISgB4JntbsoC8ie1APN/JxxDtXlabhRSLZI/FRNPzZCQQQWel6+P0e6v3oeKMQhXc9vCfk2lXfFFFie0Z/CFD8wX7S7b9f8EGnRaZnoOugush6Z8LlryaaPw3EPyifkszziC7w== 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 AM9PR04MB7524.eurprd04.prod.outlook.com (2603:10a6:20b:286::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.31; Fri, 15 Sep 2023 07:45:45 +0000 Received: from HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71]) by HE1PR0402MB3497.eurprd04.prod.outlook.com ([fe80::2867:7a72:20ac:5f71%3]) with mapi id 15.20.6792.021; Fri, 15 Sep 2023 07:45:45 +0000 From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2] ss: mptcp: print out subflows_total counter Date: Fri, 15 Sep 2023 15:45:19 +0800 Message-Id: <3ca520a2ce84c33ad8f9421add0b717091173a22.1694763872.git.geliang.tang@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0017.apcprd02.prod.outlook.com (2603:1096:4:194::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_|AM9PR04MB7524:EE_ X-MS-Office365-Filtering-Correlation-Id: d994c0b9-ba3f-4531-2555-08dbb5bfc4e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kfFP6db8rLB4ykp0fmM6nM3/YSPrA+SPsozH3hD7/rI8nVJQbZkFaRhrQWJbVbu34hIRkXbcAppwf1FC3UTRGAI6FI4NGILnUOEbmUlZ0HDXrhMzcBjpE4u2+ppmXg4m2s+WA3E53AYAkYAwLQvAC2xo6m/Ep+V81BPnWC/f4rzGtvIal6U0K8hQGB6e8Vmi209Xc/gNgIhcKXo127j+3NEVUrpYCVl+9IpjUkWd6oF/DG6UacHkn91QTgpcXk6QGJpxXklgI5ye+IQrMCvByBdVE61EQzoeQ2RpHTjjEw0zOA37dsbSCoPDFapeebqDIfjPnaEDM+BNMbCcjE39kRxrOJOjs7LBpcndPVUMwnGKbPg3a6JdjD6v3l/jMuhJ1O0C72+xuD8o87zSOcf4nk5ILJ3t9ccEmzHAqWxcGKRBHYQPdFqb8ffr324XrD5KmdClZOhP0Jj3ts5M0ctxamtzp3qRZ73LTwxIfFG9fcBJvqW+sv6gUoysho6VId2UVHGSnLfS75kXrMIFtXSOQY1mxqQbyk63cjR1DdFONKic6ceUWB7m2KBCJZBkrl/w5zM9ZpY5ySrlw6R2MfAbDlabrUan1Jd8OO40ZrCFFss= 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)(396003)(376002)(136003)(39860400002)(346002)(366004)(451199024)(1800799009)(186009)(6512007)(6486002)(6666004)(2616005)(26005)(6506007)(38100700002)(86362001)(478600001)(107886003)(8676002)(66946007)(5660300002)(8936002)(66476007)(44832011)(4326008)(316002)(66556008)(2906002)(6916009)(36756003)(41300700001)(13296009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?XSyf/lnsCVa3SAu8wnkF8feDRP4dVhoTVuNhg5OnpPi0RxQPVZCtcGuAgn+g?= =?us-ascii?Q?nWUPrd8QjwtpysVjmMDhPFxddf9hteLtYOzyb0Z1yxB7uuRFmWVpfUrznNdX?= =?us-ascii?Q?Z1TFMk6CeLZBaiEtGrp93jcHarC03O+7Yqa1jRwgesAREbUqqxrHt0OoNZn7?= =?us-ascii?Q?ba7pW8GyP2hqYiIZSBUKOGr/INMel3hJjHqDNfcgkqXqgj9PO0FhXn3zBANr?= =?us-ascii?Q?5kpRV6ueg0XOkXnsBSafx2l/kP2kv8IKr7sQGWv8u4N9yXOTuG/U5fqtAD5I?= =?us-ascii?Q?XgkfuoL1gYo5PMfVe5n1q8PliRDwpPM0QeUTwBMWsXdTWgSO+3bO3zK414uc?= =?us-ascii?Q?qHAnnzxmh3lPgdoHBspRBX3QlIUbjfNB6EnKRZ3cPVuAx8RCN9cmhaklG0xG?= =?us-ascii?Q?8STuG9cGKbPDykPZVrgw3R7gEDBcgO/R+GkG9b+V9B4fgiWUlakaNgLXdd5b?= =?us-ascii?Q?AcYMeQFQ8hRx4B4SIygVSKHpJXxD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Kr08eEt5pnJTEaD23nDC4GZGQOR4+EjgMEzwhBokHSYbp22Q0n/V?= =?us-ascii?Q?ewttpmqpbId7Xn+l4B3qJnqpkO6mhKmvvupWpYT0YjsYfWatqzSj7ZV15dwu?= =?us-ascii?Q?Biu//FH5zf29gDIDU9mUVz1InfjsQVSrkwsjjUPQCaz1NsxN9yKLEAmpIZEy?= =?us-ascii?Q?vyRjiQ12EzqNsUwow+NU+bv2CqCYcMjq7sFXuMR9CceGYRM1l+YpG577bufu?= =?us-ascii?Q?jQ=3D=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: d994c0b9-ba3f-4531-2555-08dbb5bfc4e5 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3497.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 07:45:45.0872 (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: xMsB6vWgHgfl4G2+qAO1xCkP6LulnA9E+egeWo8jqilHdJY0aEtf1TAu+mOmOYE7TU6hUFJJ7ZAKHqY7EnCxrQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7524 Content-Type: text/plain; charset="utf-8" A new counter mptcpi_subflows_total has been added in mptcpi_flags to count the total amount of subflows from mptcp_info including the initial one. This patch prints out it into mptcp_stats output. Signed-off-by: Geliang Tang Acked-by: Matthieu Baerts --- include/uapi/linux/mptcp.h | 1 + misc/ss.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/uapi/linux/mptcp.h b/include/uapi/linux/mptcp.h index 159d32f0..c110c183 100644 --- a/include/uapi/linux/mptcp.h +++ b/include/uapi/linux/mptcp.h @@ -126,6 +126,7 @@ struct mptcp_info { __u64 mptcpi_bytes_sent; __u64 mptcpi_bytes_received; __u64 mptcpi_bytes_acked; + __u8 mptcpi_subflows_total; }; =20 /* diff --git a/misc/ss.c b/misc/ss.c index 2a584015..77fdd6e2 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -3271,6 +3271,8 @@ static void mptcp_stats_print(struct mptcp_info *s) out(" bytes_received:%llu", s->mptcpi_bytes_received); if (s->mptcpi_bytes_acked) out(" bytes_acked:%llu", s->mptcpi_bytes_acked); + if (s->mptcpi_subflows_total) + out(" subflows_total:%u", s->mptcpi_subflows_total); } =20 static void mptcp_show_info(const struct nlmsghdr *nlh, struct inet_diag_m= sg *r, --=20 2.35.3