From patchwork Fri Mar 1 18:18:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 208998 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp63719dyc; Fri, 1 Mar 2024 10:19:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWtkGfEDjXiuoF0sR6X0ac6Gh9BZUJS5XFd5AizdCWasrvzuiQvbPRhEmBEJO0wj02mAhhECPkcREcqTT4825x6XsbeEQ== X-Google-Smtp-Source: AGHT+IGn21u9v+4EYNOkAKCTGlTqtDR4jIsdqR/qvlAYCKlMVBeQ11gVGmwMoQuOi467qlxd478A X-Received: by 2002:a17:906:fb15:b0:a44:9c44:8ed9 with SMTP id lz21-20020a170906fb1500b00a449c448ed9mr1719984ejb.5.1709317179947; Fri, 01 Mar 2024 10:19:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709317179; cv=pass; d=google.com; s=arc-20160816; b=dGLK0Xqo39+1lPGHxhBQJMNeN0w5iYjvU9PJxdY4DIyI4m3WXeTqiQzqQB4EyCWWPw Rq0XSOGqoqtMZY5BrDKQsgwJogvd1XapClcSI1vdSKTorRqYStHYZNVm66bynK/SeThw 685TCRLznTlaiWCriFUbm89NFXkv5pU0WImCcivW5+7MPea/+KAgAVF8RnE5tFhYCecg OJ2R5yMSC1eEkfxOlzn7DM4Wh7no5cMxLSRhQstVAniLibhNkZQylhkZfmhOGwhcavtk lm+3ilAj/4taLPHSBXVq35R9IRMcQPPfllDNYN+GY6i1uGekilOs7oF+ATsn+5ZaT2mq mVyg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=9oXYmtEOwEfFDoTf+qksFv7pGFb+US2DxRv0+UDqdZU=; fh=i1fHfqb3ms9PQICjX9LbYyHHX00fft5d6t57sCy1Fok=; b=AyzWSnqHxq39sm/+2V0WYO7cD/x0s6XSpLE5UvLJcLoag77qnNtkVQSS7WghP+ebAY TBINz4UFw4GxbIer/nR6bYNnxmMUkSncwZ9dW7prz1YH5/lPBfyb8SZzKDWhT6CPmA2B 7ADOpbftzyTpU061T7YOsapy904k4mrry2kNBdkf6slZTzUrjy1Lu8kXHtwGsoTqIQnB 25H3n/1NKhJjiuPHMURWW4OBcDGFFlZ4JSxedgAr/6zFvBX4rMsDCVuqAz32zx3DAlPZ DVricTETFM8RpjSakRiD/oNfAvDSj9aztRy+4020eClsvrf7oPGmyUYIKxbvdia4bQRk Mbdw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MGedMBzH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88898-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88898-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id j24-20020a170906411800b00a448d9a8138si648309ejk.142.2024.03.01.10.19.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:19:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88898-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MGedMBzH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88898-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88898-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 911EF1F2374B for ; Fri, 1 Mar 2024 18:19:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80FFC39ADB; Fri, 1 Mar 2024 18:18:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MGedMBzH" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ACC9D38F9B; Fri, 1 Mar 2024 18:18:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317115; cv=none; b=C7D9S5DuVlfyI/aGkASHPr5wLjAFjtfY92LTZvIEGKXCz4eV2mDk0aZV+TI3IqG4pBTgiIAnr//0R+l0+En5ak90FCXtPNklSOf1RBNNVKHTDp+XpH6yCiVmSYy0l5XMlPrmqTES04pOSUiet+KY3U+uAlbCIyxIJOduwc65vZw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317115; c=relaxed/simple; bh=nt6AK20BL5oE7VRdGXzhIfQmFT8Y3Oo0oEL80YyLgpA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CWCyv5n/G74BUBYkJLGipL94EOaAdK67/RQSs0IY1KElv7kb7ukXM+/zTfmZkPqoUfUOx2fRiowLsZGgURF7cTgjWDUjYrVNoLHI/EpeyRakqU/pi6It3DGIivJw8ffqw70giDSIn7N09mRpxsP9+14pK+2UG1F9mU6v6Oo1skU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MGedMBzH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99129C43330; Fri, 1 Mar 2024 18:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317115; bh=nt6AK20BL5oE7VRdGXzhIfQmFT8Y3Oo0oEL80YyLgpA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MGedMBzHzZeeUXKNXA4pbwd9tulDraVf9ElmbbZaX31Tu4/ngP3JM0xIIaWp0Akzm bpYi9Go0reS2dlilCOtLGjeYQnvOac0qLoiMR7ZJjNo2U4T9mATmx0f3NzW6F9tqwD wofrPNtqKC4UB5YszEGnF0RU0ZE1emVh76TbCS3ir3tyAeuziuUjrOtqmtwxYbALjR FCBSQ3lr9fTurFNlcEBWlOkEXiRjdcbGTzCZ9cBxrGwhadw1bv+k1YSeOUf1jHmIlA FFKogXZaAvBdz5+z3JQAhHOSzd46O/XxcLOWeMlQzxqgmntnzQfMC6Du9nqqs5hEZQ WTqQQ5uWLp8ZA== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:25 +0100 Subject: [PATCH net-next 01/15] mptcp: make pm_remove_addrs_and_subflows static Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-1-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1808; i=matttbe@kernel.org; h=from:subject:message-id; bh=AYZiynLgRUai+yID1XvGhwLbyUgBmTsv+wmTY6d7j1k=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl4hv0xChc9yYB8ar5v7m2sV4b4QOwB2y8ncWKi 5fPZzqqOZeJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeIb9AAKCRD2t4JPQmmg cykdD/9zcobt34JTrByyeA1zmI504Wl+lTcEYdTDQKK2spFDNgy6NYB6b/Z5uCPGYZFzngjCAGb JSBKl/ze7FLssmtStNtKdxrGZdGVJsX/d+/jaKNpPETzlYiZz8DWldWF422PRHNVDOmOnCyba1R wDr1IT8/Nooh8hjzh4B7JjsErJLg9FODPalwCQ1SSAMEXS2Sj6Vf4StKlczQXik8E9YEeo9qgwh Uv2orFVmKdYxOWAcAR9nMBXienMI7BmtPBP7dTnHmHNJe3fOFNZQ/PVHm4NwPNDVJreha+WbE0h xt+RDPQqt/qZ54vd43IjF9gyrGaWD8dafn7OKNniVbhFWi+sVGTqCq9n/tNCUI7/TU6hh2ctp1I gsMi4CTxGlX5roM3FjcEh5mwOGNA+Qzw2FV0ks3TacRqlB52mZAXJKUoRQhbHD6JuCtlHFeTpgV DzYCA72293xIQ1SjKTmnv1/K3kH8DslE4Ss6OZAKYk2d4mI3vRn65qH14eItlNuKEUw8EJPnU+5 YxK4wuy7tNehndHBm2sop6DhV+TnCzOQLiJZ+Yc6GMZh6Xcg2fi6BuELjD9Wc/J5qNdjx0CoMId xUcR8fdPVUoTjdF8hzPBra1FWVxRcXWpa2gW3Pzov+SX74PSfRUrte/8bPaYmtK52n2jfG36Zxg IpjcdF96MdQfKsQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792348971295171627 X-GMAIL-MSGID: 1792348971295171627 From: Geliang Tang mptcp_pm_remove_addrs_and_subflows() is only used in pm_netlink.c, it's no longer used in pm_userspace.c any more since the commit 8b1c94da1e48 ("mptcp: only send RM_ADDR in nl_cmd_remove"). So this patch changes it to a static function. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 4 ++-- net/mptcp/protocol.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index d5a942b9ab29..80c537659922 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1550,8 +1550,8 @@ void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list) } } -void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, - struct list_head *rm_list) +static void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, + struct list_head *rm_list) { struct mptcp_rm_list alist = { .nr = 0 }, slist = { .nr = 0 }; struct mptcp_pm_addr_entry *entry; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index d0a7955b96c4..b85d1a8d111b 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -959,8 +959,6 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk, int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list); int mptcp_pm_remove_subflow(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_list); void mptcp_pm_remove_addrs(struct mptcp_sock *msk, struct list_head *rm_list); -void mptcp_pm_remove_addrs_and_subflows(struct mptcp_sock *msk, - struct list_head *rm_list); void mptcp_free_local_addr_list(struct mptcp_sock *msk); From patchwork Fri Mar 1 18:18:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 208999 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp63973dyc; Fri, 1 Mar 2024 10:20:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUE1010L5l/+a3s1Eo1UiJ9fXuqjaV4Opbh1rhJc2oP3G2Z4mSUN+omydk5eKNd6UIC/6tkNBYnB+qYU9jG72WFS6bh4w== X-Google-Smtp-Source: AGHT+IEoU5l4Zn8ATGuAeGTGRPFMWAMKTEJk/U776OPy69TP+I1KhA8k8lyUe+9ebJKX/WZfdhzc X-Received: by 2002:ac8:5bcf:0:b0:42e:8523:5b82 with SMTP id b15-20020ac85bcf000000b0042e85235b82mr3027654qtb.14.1709317200040; Fri, 01 Mar 2024 10:20:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709317200; cv=pass; d=google.com; s=arc-20160816; b=iRZfoUeYAh3S4i+pT3Pw5bBaDFhjyW/PPOdf1UOzYmNWRTeh3kFkOIa+Sz6ub0UPmS f51luLNSBNpED24JUX9Qk0VzNZmResCIOnL0SihQ8EIruNPkZ0L0TIuJiKp41Z4GYpE6 SEiNFsmz72Djqr2Z9rSG9L08NyalxeTlHd/JDHchoUW7NFh5j2kTLOpwcW0FQ7yucwgC hdH4wedO3I1zOvOo6suMknb2qLOfYWiCjADaU0gNTM7fQFcX/TnPI2Wrd+l1V7GJFseT B0ymwPMNXKRRMEByVi17e05IJFsXyV2aPS1l9KklM75ug7+MbzNhm+G7ykpSfsv/YbYe qKKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=PfiyO0UuCSnRx3EHo/KIglrBKd8k4E6etZOxI3R8Ks8=; fh=i1fHfqb3ms9PQICjX9LbYyHHX00fft5d6t57sCy1Fok=; b=oHf4BYBzFtGyETe8Pw/RBf5NKgBicVo1QUotcyjwbLPSAQeXcvEpemoBs6HDaNEQfQ uOCBHgpiWxmvybBEsWm792jiLDOdyz8t5h9C+BVaDU7pYkVLtYJOT/olJniCjuhgpQD/ tfO/Fuxt+lGpsbmu6H9uc6eAarY1Cy4iWEn+A2Z1jTdagkgd1+gtmrw9PGZxa4Vs10sb Fw8US4ZEEZIq6bEsXYTJFeFOiV02c3IvERkZGFbNuNFpa9Xb0FXW8I7lVypg7c6eMOAl FD5cSvmu1hxS+DfBkCDR0urXCI7F2gW2qHR/wvfgvirV59KACgQWqc94WOd4eb/GTvfo QnRA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OZGU6REx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88899-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88899-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ku16-20020a05622a0a9000b0042e7e1ffdd9si3942009qtb.676.2024.03.01.10.19.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:20:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88899-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OZGU6REx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88899-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88899-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CDC641C21F58 for ; Fri, 1 Mar 2024 18:19:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 811323A8EB; Fri, 1 Mar 2024 18:18:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OZGU6REx" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9508C39FEF; Fri, 1 Mar 2024 18:18:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317118; cv=none; b=P4gPn6BeuG23H70wFmp5Gpq5cH2gd9yg1l+hYS9+GJNavnN/97FvoKobzYZ3E3l9cKfztEztRpqQM8mTC17Az60WH9d7YwekLVRo77m3xQUWFzxHpWQ3oQKLTln1zRhhXf1HAZ7IAudp45JzuWbhUXm30otjsWWD6yhGmspw2DU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317118; c=relaxed/simple; bh=eScPtd27k6a2RMCsmgXPa3fVzwLEszi4ZWB1Hb7/NkM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VcUSFlHzYZNEwulHyYKJ09+B2ntfo3hJtTjF88zik9qT2LhyISpLFYS1UeNyktJsoWurljfZq/qOjkBlERtvUfB2F35zZnePVuGenCX700cCPPTYylM34pk479FM8vcLZWkxXg/v745/on9AORvI1ejc8AF3RDT8aCtLXdPZBAM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OZGU6REx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D6AEC43390; Fri, 1 Mar 2024 18:18:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317118; bh=eScPtd27k6a2RMCsmgXPa3fVzwLEszi4ZWB1Hb7/NkM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OZGU6RExEJhoQaXKKrHO6opllpxZlqOmnKeDFyfBsBXFPvoMnhKmvK5QAWCIRsBz8 9dX8pOrXMO6v5WmlZHnrzI61e982AYzOb3ET3z1tGSG3jsiB6luFRi/8macRJpB5k4 bMtnxoAiLjrzROxDJlz6687h5aKh+C2s8nUCTvZ4DzgKJ+Ggx6k9kCYGVBqwI1mwvi iZ+wpD561/TYl5OdnrhZH8Zu5KBtKohgQSEMvIhYRjjwFxd2nMjKJL3nIHuyvcnriU YPuP6Pug+mRngtiXbSbvcM+UafxxUVE4FVTZCjIAOZfZicuqaIImQ7uBvHsLWB6ndz uOYSZyOTudOvw== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:26 +0100 Subject: [PATCH net-next 02/15] mptcp: export mptcp_genl_family & mptcp_nl_fill_addr Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-2-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2543; i=matttbe@kernel.org; h=from:subject:message-id; bh=wqCWze8v4zdWHeq1IXu4TPUkM/xqaWNcPQAM2nOwuyA=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl4hv0RAbW8CCvneg/shfdH2PXLY/tcVDkWkLXx uFkaYeBueKJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeIb9AAKCRD2t4JPQmmg c7vPD/wKT3FbQK5LVP6HMMrXdtrBBUGk5t2G08+0nnwmajDd2WcJGkplj/orpRVTDrFbkUjUoxa 1mRkI+oAlFYo7jjFfED582DL/D6xsvXI+i6q7BOSUsGR0+5af3yalAiNwgBLjWddPztSKLIQD1T iVTPhC2s7Pxp0QpAeFW1UGEkvB0RRJ+/6lbFOwN6YDyumZ/uldoozkmepaxMRCBlR20YWBDYGDX L8fgmlL36ay6hl8c0rv20olMOE/+wbtW4jhVVclspFFfA6w8lnj3WsErL6B136eSc3D77HHgFxB i1wGUevJST699DXvSurmY0Pja3IkPmzgMUfzDkv/lDo+fgIQB49CC1qrfsIZD7tiS/ZHFvWhQPO k68EdlO3MxFZdKM1GTwlPekgfT8Hv8ObMvJD88khxjq9PXomQ4/VP+PU3gaW1Ssb2I4jynO4t9q xLndkbGszDTSo7z31CAdkhU1rOvfqPQVJZyaAeh2Mx11mE68JNnZm+tQ0/df0oTe0ke2n/4D3UD Ar0Q1FSnK3YUML2Qf7lzkqpomcxvpRwFbloIjsprXNkWGevtVAl8nnuDm4jD3n4yYp325btOOsk +ufsdutiZH9YJPd/QSRgGey2cC7lel023XR8rgXIhvWYrIejlo3ISNPlvrGTgguQPJMZ6ZxpTE6 6/Ptx6JbkC98AOw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792348992278149112 X-GMAIL-MSGID: 1792348992278149112 From: Geliang Tang This patch exports struct mptcp_genl_family and mptcp_nl_fill_addr() helper to allow them can be used in pm_userspace.c. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 9 +++------ net/mptcp/protocol.h | 4 ++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 80c537659922..e8cb887561e0 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -18,9 +18,6 @@ #include "protocol.h" #include "mib.h" -/* forward declaration */ -static struct genl_family mptcp_genl_family; - static int pm_nl_pernet_id; struct mptcp_pm_add_entry { @@ -1636,8 +1633,8 @@ int mptcp_pm_nl_flush_addrs_doit(struct sk_buff *skb, struct genl_info *info) return 0; } -static int mptcp_nl_fill_addr(struct sk_buff *skb, - struct mptcp_pm_addr_entry *entry) +int mptcp_nl_fill_addr(struct sk_buff *skb, + struct mptcp_pm_addr_entry *entry) { struct mptcp_addr_info *addr = &entry->addr; struct nlattr *attr; @@ -2281,7 +2278,7 @@ void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk, nlmsg_free(skb); } -static struct genl_family mptcp_genl_family __ro_after_init = { +struct genl_family mptcp_genl_family __ro_after_init = { .name = MPTCP_PM_NAME, .version = MPTCP_PM_VER, .netnsok = true, diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index b85d1a8d111b..d70fb3bf5076 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -343,6 +343,8 @@ struct mptcp_sock { #define mptcp_for_each_subflow_safe(__msk, __subflow, __tmp) \ list_for_each_entry_safe(__subflow, __tmp, &((__msk)->conn_list), node) +extern struct genl_family mptcp_genl_family; + static inline void msk_owned_by_me(const struct mptcp_sock *msk) { sock_owned_by_me((const struct sock *)msk); @@ -974,6 +976,8 @@ void __mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflo const struct mptcp_options_received *mp_opt); void mptcp_fastopen_subflow_synack_set_params(struct mptcp_subflow_context *subflow, struct request_sock *req); +int mptcp_nl_fill_addr(struct sk_buff *skb, + struct mptcp_pm_addr_entry *entry); static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk) { From patchwork Fri Mar 1 18:18:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 209051 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp92620dyc; Fri, 1 Mar 2024 11:04:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUUYPvnJOprfdT1gFreJeFK/Kx4Gb7PyqsNB++i2sshlfNP6EBPP6oNNu0iB5nPrUmopLhmxBkc/DcMQVpO/++SWvx3dg== X-Google-Smtp-Source: AGHT+IHV4DCc660Ya31/FWCfAWm77e5B2c5IYB0iZBRS8X3WITwr3MdpBQSAMJHsLBS3d0QHQMCn X-Received: by 2002:a05:6a20:131c:b0:1a1:2779:62a6 with SMTP id g28-20020a056a20131c00b001a1277962a6mr1950036pzh.42.1709319883499; Fri, 01 Mar 2024 11:04:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709319883; cv=pass; d=google.com; s=arc-20160816; b=GAazRTcTWcmexg5yayeLsixyetwgAC13L8yV3hYiSrxOB7dtT188hSYr9eFgWGqwXl NF/Y187PsUZjl40FMXDXMhVEHeHaNbDA/iA9MqByLIbT2eRxj7mrY7UL1BuFQw89lSHU b/w7Pg/kPkdXwlzXpfy6gkvDznlU3kvBhOOs5oHy/rFsO8YAucJq36jGxmd9VIbfuXXd Bt1j0sSQKyxWCWY01kJB1zu9Ur2TNLNjWH89H+Z7pIWSHFRCL4hRXkVanCriKrgCj55g ShNciUgTsr7lc1tpOqKV5ZuSd5GiuYL8K3eOPebjafM0XX7+66+RTiDpIZh90zcl+q3h 62Xw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=9no2Wtt0K6QNEmomgWlPuHiM2cndjfQnxde478qDFTg=; fh=i1fHfqb3ms9PQICjX9LbYyHHX00fft5d6t57sCy1Fok=; b=I+KO42kKL4PSTG5DkZ7Pb5K0Jg7TfWHliMGIMI0VDAaMc34Rrp8vqVa+T16ddYPF2K HWj0zEkDPDHwlEpfWd6K2t+wybfCW7ISZ2ZleSMDw3WWV5dsqL/uTlPkyMih9lE3OBlj sv5zvk5KNZubIgSmFuxGs9TjXfRrCzv0tqXDEAuZ0/kUusfFyT+sK8BDRiCYArstgmA4 RvgOi088ea0jNz9uBiw5+8kUZuyAo/n1eSmRX8oBhSTlBFwO+1ZShrW2Ydf/yXX7y9W2 LZNyNiN1LQVzQEY2r/GeLHLsHP9gnckfT3C0UUnrO7FTXrZeXEOY43VXhmM4XR1ZqKu5 1DVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EBL3jIEM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88900-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88900-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c26-20020a634e1a000000b005d8c5595ddbsi3996612pgb.271.2024.03.01.11.04.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:04:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88900-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EBL3jIEM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88900-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88900-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id DD98FB27A2E for ; Fri, 1 Mar 2024 18:20:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D5F6F3BB4C; Fri, 1 Mar 2024 18:18:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EBL3jIEM" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A2DC43AC25; Fri, 1 Mar 2024 18:18:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317122; cv=none; b=ZPA+e0nx1WBHWsTH0fYrolcwjriuM2CQhxmp2hGZRv79oEjnZdi+7FFjFN8O0dYwgsikQCjjAQdP4oQSPByPv8X1aPdh2xRjmscXEK2JwshhTEdor3F0fJvyBIOtEIQzM3Rg1oFn/sXj6DC/1cml9X4DZFdlHB1qLAAuPpXgxPg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317122; c=relaxed/simple; bh=2J2ip4Xxu7bYBw1bsYGLEY/qmSglztaVCRJZDa8cTFE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MIxKWBIY6cW/Kycx99G5WQEIboobVTma1Tk9VxujkTto99e8Pye1mo8osCGrDgJWlVhyyvKKImRDHL47C23fu2DDUxaSPlaukDti3OGAUzOpbQcVhuUUOKbRX2Bcb9Z6XE+juJ7GEN/C3GCpnvcEa+2/ad09yMsNyGlzYgHyIEI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EBL3jIEM; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0E06C433C7; Fri, 1 Mar 2024 18:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317121; bh=2J2ip4Xxu7bYBw1bsYGLEY/qmSglztaVCRJZDa8cTFE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EBL3jIEMDupJt9hn+0oMCPPa+NAKGt32Zvd+ptBOUooQjGWN7+3nQxpnJTi3C4vah EUrC5AYcN9qYSAyaom1hP3OWNkDGpco1iOL/+HPqymvTgfpOQdbITve62rLQnYzBXw d1ToOYhMG74oYVunmZ9YG12YmSgOMp6viWjH+VKTYYhNIz4Tht+mcn48VC6tsKjw3E aD2FZ5Iptqq2B6F5mB/KlMqdb772j0LDq9thNPFlEnKfAKH9bx3h9KkCmYMsq5ml9g tgwBNcXXRUbL9n8sO5PdZ2VF3piakXkgzYcv3DR11wWa9LNGPwe4588LB8iwR3Xi0P D54ez0Eg53G+Q== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:27 +0100 Subject: [PATCH net-next 03/15] mptcp: implement mptcp_userspace_pm_dump_addr Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-3-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3214; i=matttbe@kernel.org; h=from:subject:message-id; bh=3ItNwH55x/xaZ+UgJN8s9oLJOd5rmW4EkNP6do8rk9A=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl4hv06y6c4NEIWAkCUt6adgLqaRXfjgFtRrupc RFHEMFnP8aJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeIb9AAKCRD2t4JPQmmg c+MtEACwhMfbqpbW7+htXjcxOM3D2r+x3zW5A0+BdS4NXpHXkLKKvSQxufbUHaJm8knD2QsGgGM 4mX7eAH/ZJFn+VkY+KcEhCf3dnFBIUu/Y7TpwufUddTViKMrFDya3s6hWv+MNBw8aKOLB6U0e2e JmpNyP/WDnZSIqUMB3Kfur32DZ5NcLRZT9ymLsRx6RxFbNgbj7ZZA+ijTuDE1suwqs7jr6NFJUj CuJKWkfFHso8HnJNci3AryGXnMZZQFXnAiHUvEec5+y6BYcj9uyxc+Gp4gKEq5Il5V0ABkdJqSU cOihZsWTtFBLS6yDWj5ui1mf7zAynKtzLI4dD6Jivw0zbG9qoZs0AfwbXyUZQnXGpJ5KpzzjxtZ YI3zctcbXjI+W+Eb5QCFtSi2OQUl2GGbIW+EM+i7VWXrbpuNCTFpwIM/4MCjAsXsfjvOf8i7aqf 9MXBwOf9mhFkXEpPZutBYK9L9dPB0hLkqhEbt74yp95EZm2bPMZ2E47o7QFXKHuwOp8SdfQIU0Z Q6bOc74yyOaRNAigjRtnB+Zm2IrEQ+vZuXJQMxjBE4RWfgTfZF94Ozly+AG/9gbW47EPn452Z3/ ENAe9iB1En6HvqbBDtms2Hik0qjCT7io1pTo/kpX2DhpcRvrJjSiGsX3eywBWRZAbCI06wuu99i Y4YZe5ED3dkCb/A== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792351806278093416 X-GMAIL-MSGID: 1792351806278093416 From: Geliang Tang This patch implements mptcp_userspace_pm_dump_addr() to dump addresses from userspace pm address list. Use mptcp_token_get_sock() to get the msk from the given token, if userspace PM is enabled in it, traverse each address entry in address list, put every entry to userspace using mptcp_pm_nl_put_entry_msg(). Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_userspace.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ net/mptcp/protocol.h | 2 ++ 2 files changed, 62 insertions(+) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index bc97cc30f013..d6b7be3afbe5 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -572,3 +572,63 @@ int mptcp_userspace_pm_set_flags(struct net *net, struct nlattr *token, sock_put(sk); return ret; } + +int mptcp_userspace_pm_dump_addr(struct sk_buff *msg, + struct netlink_callback *cb) +{ + struct id_bitmap { + DECLARE_BITMAP(map, MPTCP_PM_MAX_ADDR_ID + 1); + } *bitmap; + const struct genl_info *info = genl_info_dump(cb); + struct net *net = sock_net(msg->sk); + struct mptcp_pm_addr_entry *entry; + struct mptcp_sock *msk; + struct nlattr *token; + int ret = -EINVAL; + struct sock *sk; + void *hdr; + + bitmap = (struct id_bitmap *)cb->ctx; + token = info->attrs[MPTCP_PM_ATTR_TOKEN]; + + msk = mptcp_token_get_sock(net, nla_get_u32(token)); + if (!msk) { + NL_SET_ERR_MSG_ATTR(info->extack, token, "invalid token"); + return ret; + } + + sk = (struct sock *)msk; + + if (!mptcp_pm_is_userspace(msk)) { + GENL_SET_ERR_MSG(info, "invalid request; userspace PM not selected"); + goto out; + } + + lock_sock(sk); + spin_lock_bh(&msk->pm.lock); + list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { + if (test_bit(entry->addr.id, bitmap->map)) + continue; + + hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).portid, + cb->nlh->nlmsg_seq, &mptcp_genl_family, + NLM_F_MULTI, MPTCP_PM_CMD_GET_ADDR); + if (!hdr) + break; + + if (mptcp_nl_fill_addr(msg, entry) < 0) { + genlmsg_cancel(msg, hdr); + break; + } + + __set_bit(entry->addr.id, bitmap->map); + genlmsg_end(msg, hdr); + } + spin_unlock_bh(&msk->pm.lock); + release_sock(sk); + ret = msg->len; + +out: + sock_put(sk); + return ret; +} diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index d70fb3bf5076..ab9c8004eb56 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1042,6 +1042,8 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining, int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc); int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc); int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc); +int mptcp_userspace_pm_dump_addr(struct sk_buff *msg, + struct netlink_callback *cb); static inline u8 subflow_get_local_id(const struct mptcp_subflow_context *subflow) { From patchwork Fri Mar 1 18:18:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 209000 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp64749dyc; Fri, 1 Mar 2024 10:20:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWFDdBZi6heUBmLU7TLtV1k4BYjDkiQHq+jxJEXLO+8ch7bzgx7De6sJI/2jP2tPsD7Oz16/3kjULU1+IPSaxlLEHf2oQ== X-Google-Smtp-Source: AGHT+IFc+FFjRYNQjTQnd7tesP+rcwNI1BOMi9MFoiUVzzzwxX8Cp06rMelABW6ax1QjL/JjXYcn X-Received: by 2002:a05:6102:1607:b0:472:4f2a:cf85 with SMTP id cu7-20020a056102160700b004724f2acf85mr2636105vsb.7.1709317256207; Fri, 01 Mar 2024 10:20:56 -0800 (PST) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bl14-20020a056102508e00b004724b22c46bsi713393vsb.230.2024.03.01.10.20.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:20:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88901-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b="BgY/IR6k"; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-88901-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88901-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 568F61C24795 for ; Fri, 1 Mar 2024 18:20:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB8533C464; Fri, 1 Mar 2024 18:18:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BgY/IR6k" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 93B263BB21; Fri, 1 Mar 2024 18:18:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317124; cv=none; b=qhWlyUWdr6fj0uk50EbgvLA3pYFnBrUri+QNO/Cusx9QNLACtpC6FyDps19G5ENqkVlSy6rq+6D+6NJwhJ25AvopiVyTdHNZmRRhQNe4hzP/rU/mrtk0V+llhYYQ5iihFi4k1MksfFwFWIqj5ixmmKrg/6/queXRVaATbh6K9jI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317124; c=relaxed/simple; bh=wTNLhVtGoV4ze+fIYMOM7sxbJFFWejuuzNnN9RQXZ6g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XACZjUEpvxsAxuCo/5xqo2x6p4UQWkZB2lTuiT3omHpayUoWbamS+9WS8LpnMR8F2sLF0c4i+gSMzPs09HhwXw0tZ9LORSMrAU2NrEuudaM078zk6wQbLfSd3Yy+c7CZbAYUE8VJGYT+p1GkYrYViIY47x5Y90QrocraIUPR3BI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BgY/IR6k; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A94A1C43390; Fri, 1 Mar 2024 18:18:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317124; bh=wTNLhVtGoV4ze+fIYMOM7sxbJFFWejuuzNnN9RQXZ6g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BgY/IR6knG5JPt1plb++/g2/xbWhydWrDRhmNsBFBr2oc4b8PTuSEQVPO/yVg055j il55nf6L/l2/CH5+S//SwoqvYjVq7yE4KxyYL3aYGZ+FQoKKIpdJzJOEI1/0wjfiWp wp+HhSZtKqmwMQyMZgt2Rpcm5L+EngoNqRez8+BcxJihwB01g0yHpXZBYUNlQ0fteb YKV2InvljnWEyojlGuE13ATJBfQbcCpT9QoS3RPBl3zbF+Bw9OETf2kNyXatzZboil OJjGj+uPm0OKzflW+R103VXpDyV+DVVelpN3pstFJqXnso0BXmd6bpBOmnH9Rs20cV 2fkZIkpuDAcSQ== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:28 +0100 Subject: [PATCH net-next 04/15] mptcp: add token for get-addr in yaml Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-4-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3262; i=matttbe@kernel.org; h=from:subject:message-id; bh=MtlF9xRmcwFi9Km9WSgOTuDFuVjLVFk9I1/xuUhE2Ao=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl4hv0nW6PXRVfJh6Uq5hPPjIxpQId6iEyiF3u9 KKR18JjC8CJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeIb9AAKCRD2t4JPQmmg cy7MEADkZr+/SOv7/ekJ2zg6eU0zFGPNsuwRKvruhBg1XYsUi9Pki4zhlz4NKqCpweabc+sP7EO j6ncKk6s2TJuInE70nLtYGu3ErvO4+z/1o+ekerbOUwotu8cOiEI7OcYflBr5vhAAkXyvIxUBdq ycI58RY/iwYUNYQZgYrMSmVa5AHDE0i+DfgkEkb//JWv3FR2RcknCsdnUYgQ7Wi/jqvy9X5hJd6 7FDwt0HLi/FwbsCFsdzCws+gihZbkKyoe10PxOFjeMZekoc55m7E80wGGwgBXq6J/FaDZCKua0+ wsQo7FpzhoTp9wjGZMB47C24DoOsrLZ03uZrZz25fvL6nH+kdMdzECmu6XW21hvqf733hqiwEph U1QLuYHZFZKrIT1WCHZVAWRPbtJmlMglzoBSMxRtWP6b6kTCMxmFoKX/LHOnx9BRrwgy/2IOISE f/CKngKX/VLuU+kOiQOQFJBc0bUlihzIDoi7gUieVadvFLKtGbU9NgQ2oqHpnuh8BQaLIAelC0T ylaoAyIdq9kwTrt6mJEpG6K0V2bt3ROCj/aASZ7hdUBRN0PmjhL3FGaszo+uLCfcVZsSj4ULVSk +AMQ5vnBP+pynMvUsKsd7RlIudXuY6oOc4bIWNrKV67e/KqENltkvF4iFnyZoAer8IplgsbT26P MCOaCJB7RmO3hCQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792349051289785140 X-GMAIL-MSGID: 1792349051289785140 From: Geliang Tang This patch adds token parameter together with addr in get-addr section in mptcp_pm.yaml, then use the following commands to update mptcp_pm_gen.c and mptcp_pm_gen.h: /tools/net/ynl/ynl-gen-c.py --mode kernel \ --spec Documentation/netlink/specs/mptcp_pm.yaml --source \ -o net/mptcp/mptcp_pm_gen.c /tools/net/ynl/ynl-gen-c.py --mode kernel \ --spec Documentation/netlink/specs/mptcp_pm.yaml --header \ -o net/mptcp/mptcp_pm_gen.h Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- Documentation/netlink/specs/mptcp_pm.yaml | 3 ++- net/mptcp/mptcp_pm_gen.c | 7 ++++--- net/mptcp/mptcp_pm_gen.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Documentation/netlink/specs/mptcp_pm.yaml b/Documentation/netlink/specs/mptcp_pm.yaml index 49f90cfb4698..af525ed29792 100644 --- a/Documentation/netlink/specs/mptcp_pm.yaml +++ b/Documentation/netlink/specs/mptcp_pm.yaml @@ -292,13 +292,14 @@ operations: - name: get-addr doc: Get endpoint information - attribute-set: endpoint + attribute-set: attr dont-validate: [ strict ] flags: [ uns-admin-perm ] do: &get-addr-attrs request: attributes: - addr + - token reply: attributes: - addr diff --git a/net/mptcp/mptcp_pm_gen.c b/net/mptcp/mptcp_pm_gen.c index 670da7822e6c..c30a2a90a192 100644 --- a/net/mptcp/mptcp_pm_gen.c +++ b/net/mptcp/mptcp_pm_gen.c @@ -32,8 +32,9 @@ const struct nla_policy mptcp_pm_del_addr_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1] }; /* MPTCP_PM_CMD_GET_ADDR - do */ -const struct nla_policy mptcp_pm_get_addr_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1] = { - [MPTCP_PM_ENDPOINT_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy), +const struct nla_policy mptcp_pm_get_addr_nl_policy[MPTCP_PM_ATTR_TOKEN + 1] = { + [MPTCP_PM_ATTR_ADDR] = NLA_POLICY_NESTED(mptcp_pm_address_nl_policy), + [MPTCP_PM_ATTR_TOKEN] = { .type = NLA_U32, }, }; /* MPTCP_PM_CMD_FLUSH_ADDRS - do */ @@ -110,7 +111,7 @@ const struct genl_ops mptcp_pm_nl_ops[11] = { .doit = mptcp_pm_nl_get_addr_doit, .dumpit = mptcp_pm_nl_get_addr_dumpit, .policy = mptcp_pm_get_addr_nl_policy, - .maxattr = MPTCP_PM_ENDPOINT_ADDR, + .maxattr = MPTCP_PM_ATTR_TOKEN, .flags = GENL_UNS_ADMIN_PERM, }, { diff --git a/net/mptcp/mptcp_pm_gen.h b/net/mptcp/mptcp_pm_gen.h index ac9fc7225b6a..e24258f6f819 100644 --- a/net/mptcp/mptcp_pm_gen.h +++ b/net/mptcp/mptcp_pm_gen.h @@ -18,7 +18,7 @@ extern const struct nla_policy mptcp_pm_add_addr_nl_policy[MPTCP_PM_ENDPOINT_ADD extern const struct nla_policy mptcp_pm_del_addr_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1]; -extern const struct nla_policy mptcp_pm_get_addr_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1]; +extern const struct nla_policy mptcp_pm_get_addr_nl_policy[MPTCP_PM_ATTR_TOKEN + 1]; extern const struct nla_policy mptcp_pm_flush_addrs_nl_policy[MPTCP_PM_ENDPOINT_ADDR + 1]; From patchwork Fri Mar 1 18:18:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 209001 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp65040dyc; Fri, 1 Mar 2024 10:21:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUG5iaUDFvnUIbljWZMIfLJYYQMU7gxG8FMh5AXbAP2nHgpi8Z5HMYodmO/YpiX3VMU/mle5HDIi+CilY9rsTLOFow5Rg== X-Google-Smtp-Source: AGHT+IFxvhtNKO9t/2A7JrORz52PYkO+XCL/lY4vDHPTJj+6q+mKUv2Zls+ePdW/FZTR+QCTtS0a X-Received: by 2002:a67:fdd3:0:b0:472:771e:79bd with SMTP id l19-20020a67fdd3000000b00472771e79bdmr2098137vsq.28.1709317278640; Fri, 01 Mar 2024 10:21:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709317278; cv=pass; d=google.com; s=arc-20160816; b=sLQ9ZZj22tQipOTODhTsNynD+t7v2h3VPF0j5sGBVNtgwC+/oAqlAwgXXvmxVUtiD1 wkbBFzzXiuSzubbru6Ve6XrfrrfMFwg3+/6hD32sn+TEenfIY9l2kdRG/eV0BPLnVyGk ifA6QIbL7eIVxDFY7KkNXqIz5PwRg5+wLKGkfsgG8ZF89m0BWjkk55gnqbZDPsMHHJxK 6CB/iz+QTTsGmr1sBeCyPxQGuJF8a59e3Z7pwIZRswZkdqmPAWdQfB8y9zM7GFjkAEFX OZmz7YaaSOgq6daCdkDueyTbP8Gh9RmWFaqn4CvaxGiJTLJr+l4paEvMvSP9M/y5qKUl cXUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=ue1DfJHsy+S7DH+YK0HRoX60pck/y1qzC9XbwvTqxU4=; fh=i1fHfqb3ms9PQICjX9LbYyHHX00fft5d6t57sCy1Fok=; b=jrqovPsDLSLAJfOO+wDh8h/Z61QauXXhU5SRh8DdEepdQLeu7VJIIupEjwpMlyfo++ 49pn5cjvnmKDb9W8po1ZRkHItu99UAVZJPl2K5OPk2o/rO/MHrBgYW61+1a32EMo0BuD PyZqoy1kxASAv9ZLxAn7agRn3lEUC5Sb6SgD90Re8fMkqpiv6a3jc4Wya9EvWUl6LLOw +CzipOLuHe9fYVtKKMs9pjvDfXFNhvvFWClul3mu7zycMQnlDhTTpuI9KhcA45HP1QBM lhWdbSDGl0Y8tYkCyJkEfUP277FUM4myPHAqIW3sON/KkSHYqjEAdZ6AFo/JGgplnT15 Hnog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k79Tnt2S; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88903-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88903-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bl14-20020a056102508e00b004724b22c46bsi713393vsb.230.2024.03.01.10.21.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:21:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88903-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k79Tnt2S; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88903-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88903-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6357E1C22A83 for ; Fri, 1 Mar 2024 18:21:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E49233D0AB; Fri, 1 Mar 2024 18:18:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="k79Tnt2S" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E5BAB3C46C; Fri, 1 Mar 2024 18:18:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317128; cv=none; b=iwW6AOZxsCh0YF0ckQp5FnmXTBhdBhGQBuj7jcWWYNYNuJ/t01w9ynThwHo+AzC0lfx2PhQLK1uaeGj7bdJ5va3K0XJVS4XMyehpYgyiuqr2Xjr5Ri2KQLXHnM+XcnQ5jvtbE8OzsD1jVwhr2S1YEbeLChzNjbyXOYpkZUsiTdQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317128; c=relaxed/simple; bh=MCwwm/uaOZTKaQ3CJuZ7Aqth/dw3YVtxCaMEr2Vs0mM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tQMQIgPQVvYYSAFxOQAIu3JEUEgAGONcmKAooqJKaEvbpFnD2Kj23boOQrAcbK00sp2UJi0DtFha7esWhQEZ1r340NZKOr53ijr1P8n4uy76kpB2Tla5SaYTVrhJCUHfU+rZT9Kn4fdGOXYOTrkjIqF9RCi+DDASBTbM9jIQgm8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k79Tnt2S; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2DE4C433F1; Fri, 1 Mar 2024 18:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317127; bh=MCwwm/uaOZTKaQ3CJuZ7Aqth/dw3YVtxCaMEr2Vs0mM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=k79Tnt2ShXxnBeAoXK/KEb6ktRUwk23q3/OlVtfVVY8zOrotSi+uTDf3paXQ8g0zk rvgYfixa7Aj+3vhSsyc8DoZCUTI3ZmWIt4e02ZJmpySKF1pmgpko52JIgsKtuDmY4H bsaphPJdwk66Ahz6AAXe0h1A5o3zez6gOu941qCMwRBl7NPB5Wup4oOCe5dBxT2NNu t+IfUqh4Wl+UAxTv8m86hA+AXX1Q87dIgPevzQUPbt+uHGPGjjJgQP2c0DT7apl1Is 9bAs7QdQMEgyDtScbe2BwL8rV+f+tDhlTWhz2keahfyU5ixq3r3z68inc0EJ0BBGqK pMnmiQqJRHUag== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:29 +0100 Subject: [PATCH net-next 05/15] mptcp: dump addrs in userspace pm list Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-5-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3274; i=matttbe@kernel.org; h=from:subject:message-id; bh=oj+WD2Qiz2y+QGN1F1vEBEbF15PvF2ufVBuTbZM1LxY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl4hv0inT7v7SM31h5ojK6U8VeKvmWj657GgeD/ vCK/3so8ciJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeIb9AAKCRD2t4JPQmmg c+OAEACR+XRPTwiSXfGepQu9Lkq9UWoH/krsqtdkgyBo7VbNhPyyBbsyzEcElTqN101HIjcMFB3 dv9L8Q6ndQvyL9pcBJoa4e8OybOz5wG+oNBEYHGjhg5qlE61pZvz/ctGdidNUY4CIbRUFwuRWwg S14FvS3HftztNvKY1pn8MTXsmDwmSbLY+WHdjo6I96FoKY2in2V7pleHY961Kl5L4Z9KpBOe9Rd 5gtteNfjiCn3u8ziqmm++8agycNbGk64/gS1CMwU2jnAmX/kL28LeRLpe1NAmJXWOqm4iPkkEGO F57D133OG1PJOV+YSbLqRGLFrYbi8QrJDy4ayu8c2WeMaV7a/u29hH2tASgkADxBCA+o78WpDJ3 CWLVMlbHXT19ulPT4SfnQstSfcje9p/DEFShoVqLN3bDSec/ZHjntAUeUoSreO5pzsX/8n2dxqO w2SYmUVxC6UX1snE+Xd3hCrvgEsx6MBWmyn0MpFYl0hF4TtC/Mn46aFrsJ6l0qb3AW10KtHPjXi e8W32dbMFAGqqVVoTeOifFtXEFfnjDBOUnJpz+qxotxN2ZOTu9COIZ7L/H0j7oxMPbNky5DY+qV C3HHek/RU7MBRgJBWyVP7XkYRwkdHNW/dujX1ps5UTO09trsPhNDxc9aVaziovzyZQBP0TfpWTA X7wxR9bgZx6e/Tg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792349074488062555 X-GMAIL-MSGID: 1792349074488062555 From: Geliang Tang This patch renames mptcp_pm_nl_get_addr_dumpit() as a dedicated in-kernel netlink PM dump addrs function mptcp_pm_nl_dump_addr(), and invoke a newly added wrapper mptcp_pm_dump_addr() in mptcp_pm_nl_get_addr_dumpit(). Invoke in-kernel PM dump addrs function mptcp_pm_nl_dump_addr() or userspace PM dump addrs function mptcp_userspace_pm_dump_addr() based on whether the token parameter is passed in or not in the wrapper. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm.c | 9 +++++++++ net/mptcp/pm_netlink.c | 10 ++++++++-- net/mptcp/protocol.h | 3 +++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 53e0b08b1123..193198cec74a 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -441,6 +441,15 @@ int mptcp_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id return mptcp_pm_nl_get_flags_and_ifindex_by_id(msk, id, flags, ifindex); } +int mptcp_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb) +{ + const struct genl_info *info = genl_info_dump(cb); + + if (info->attrs[MPTCP_PM_ATTR_TOKEN]) + return mptcp_userspace_pm_dump_addr(msg, cb); + return mptcp_pm_nl_dump_addr(msg, cb); +} + int mptcp_pm_set_flags(struct net *net, struct nlattr *token, struct mptcp_pm_addr_entry *loc, struct mptcp_pm_addr_entry *rem, u8 bkup) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index e8cb887561e0..5fae35b6b305 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1722,8 +1722,8 @@ int mptcp_pm_nl_get_addr_doit(struct sk_buff *skb, struct genl_info *info) return ret; } -int mptcp_pm_nl_get_addr_dumpit(struct sk_buff *msg, - struct netlink_callback *cb) +int mptcp_pm_nl_dump_addr(struct sk_buff *msg, + struct netlink_callback *cb) { struct net *net = sock_net(msg->sk); struct mptcp_pm_addr_entry *entry; @@ -1765,6 +1765,12 @@ int mptcp_pm_nl_get_addr_dumpit(struct sk_buff *msg, return msg->len; } +int mptcp_pm_nl_get_addr_dumpit(struct sk_buff *msg, + struct netlink_callback *cb) +{ + return mptcp_pm_dump_addr(msg, cb); +} + static int parse_limit(struct genl_info *info, int id, unsigned int *limit) { struct nlattr *attr = info->attrs[id]; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index ab9c8004eb56..69338a6c040f 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1042,6 +1042,9 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining, int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc); int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc); int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, struct mptcp_addr_info *skc); +int mptcp_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb); +int mptcp_pm_nl_dump_addr(struct sk_buff *msg, + struct netlink_callback *cb); int mptcp_userspace_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb); From patchwork Fri Mar 1 18:18:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 209002 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp65210dyc; Fri, 1 Mar 2024 10:21:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVSi3NJzh2N8VU/fb5D+jREyFkCXbBoCL7t/0OYDQ2hB7PuNNAZXEW8WIDS1MT1JsPtVai2xh//fjkGpvADKJ6xjWePpg== X-Google-Smtp-Source: AGHT+IEC9VMUdxGexTsuiRaGp5en8T7EpHysiYV/DBca2n3N1tyy2I7SWn3QaYuOV385IBxeZNG9 X-Received: by 2002:a05:6808:114c:b0:3c1:c1e7:3363 with SMTP id u12-20020a056808114c00b003c1c1e73363mr2659448oiu.27.1709317295745; Fri, 01 Mar 2024 10:21:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709317295; cv=pass; d=google.com; s=arc-20160816; b=GhuCkWE4pWCCeg781qtTvPD+Pn2ywh82wSSZ95DddUYu6c6aygcjNKS5W7YbUCIXgJ QMCv0BWAc6MpuLEJDatsgXl8cGB7LRMSImFR4/q8a78lRex+O3rHVNaK9VxAAEE581J3 U5hLUrwiSERrFRK5V1akonOwozRnZHgq4mnC2H3441f/f4kMAn8SyVg/nUUn6xy53dHh JDLl/J/2xgWOnHC9erT43AKDgF+hvvErQrkjTq/9PUIJQoBXxw5NyyeQ14iQfvnLwlpN +yCQsvueTWg3OH48zFmv75+wmRaLoZIRoKV2slfy95V2l99CprYQTHkkERBZ+lY3XICw TiSg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=RjgxOgwR3hfQlJJg6Qjf5HxAXyOf452TtTO3VE3wiQI=; fh=i1fHfqb3ms9PQICjX9LbYyHHX00fft5d6t57sCy1Fok=; b=PHCjq7PwooJlqIXFAvC78Y+1jSf7Ri4mgJ1+sPJszRvYq1JsXxTyqgDQE60xLIjtom hbaG4r0YRWnPh9TIz9/fHkjdCPWwZKaA/pDceEic4YEyOENyzzMfY46KoTT8IzXe7aKL sKS9Cl6lUIdldsKFnqv5KfRiRnLvDOucts1xtnjrV0eDUWsNJhCEzS5WEKjyBLJAiwM1 neECCOTP0jBOouXnfBfg3uG5kp0eRL+kuWQ8MKITs/3GhxedtQLOTVFb7hxxpZvbg5j7 HwxQ8TsR06+AGBRCAZ4UDwXTFn2f3vi+phX6tzzTRNDQUEriKWR6IZsiUTRIqYRllPcW U1CA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZZLSdb+N; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88904-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88904-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j8-20020ac86648000000b0042eac5e2888si3803476qtp.688.2024.03.01.10.21.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:21:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88904-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZZLSdb+N; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88904-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88904-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7D0571C219A6 for ; Fri, 1 Mar 2024 18:21:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E22293B2A6; Fri, 1 Mar 2024 18:18:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZZLSdb+N" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E94733D0AD; Fri, 1 Mar 2024 18:18:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317131; cv=none; b=sReflvjk6uT/OEyvPzRFMnJ9G1TNnSESSrzNqKZ1+/f1RLvTuId2cWf2sOO1RATQQpTVrpuOJC2GlGWP41GLfiXNoS9pLl0ePc0ZoEiPzWORV9elsyJtMzAo1Qrep7udk89xenCwyo9qocre784JrkiNKgWvqpNlXcaD1opqQbk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317131; c=relaxed/simple; bh=7lG7R/s1q6fLAI6wvapbUgxQWeobDoOOk1BJNjVurX4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Or917CM5yaIUWzt/08qHK+xktdyL2+Wcywd7eWnTAsKvHvSITmg7JJKh4IYV+exDJ5VG8lAfJhQzIbXsnOzCMtovs3N70EmQz9gLpJ2d+NmsxEaUOA077E70KIEzp+e/HfnQrBfQy02wGWro/9rVLsdVY8zZ/Jx9AuFLxDnvTH4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZZLSdb+N; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6549C433C7; Fri, 1 Mar 2024 18:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317130; bh=7lG7R/s1q6fLAI6wvapbUgxQWeobDoOOk1BJNjVurX4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZZLSdb+N5NXpJTaYIYXiX+5H/FwcVSGg7KIN7oClImmg/uIhgKsqdLpJQGB3P1kvy GW55w7Mm40vzu8sQu4oh9U8VZznVZwRS0iNfGvqnYC/OWJWW0JO1xNUQdYVuvVfL7l Uwzu8nlaDD7VMAdi55J7+NAyCBPhEtGoNQl8QftP758ufSa3kteXTCMbqQ5jHxabAb oLgXtVZQwmiS3qTgCGluX1UV3WuLps0Xxg2FMpFq69D1CBFakCFsHBxiIRdxdCc0tr swdofAUxMAkGfq2r2dGaJy5lO38SHv/uPj0tk9PvAsjzPJUKcdpugk5pC+dzdFsb3z ovHIzGB57YyNg== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:30 +0100 Subject: [PATCH net-next 06/15] mptcp: check userspace pm flags Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-6-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2877; i=matttbe@kernel.org; h=from:subject:message-id; bh=nB2jr+h3crYGyM6lGO9/xWsi/9FVXdNk/IEW2/03A4s=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl4hv0aHCCdqzGFyKJ5B1lx+aiAndXV/nIkk7cf gU5gKvfPY+JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeIb9AAKCRD2t4JPQmmg c/+xEADKUM0XrA6HwxFUnHiadXTzhVe8dW1u6ZBaWr4JMv7xPmJjZaP/RgATUAhPGYwrHWL/V4b LzYo4RGTjBHrwI0x+GgCgo+4CTCYDbbJt3M2bdfiSE+R7aILQZNfvGgPeXs1oyZfSCQFksx5Mqx TZ/B0tt7T9qsrdDQgc6AbghbmhotHY+i0/EV1lfFTRGlIiCE7xv5BQOu/gcNerMYtNz2JXvNBrK pQNWsTyxI2vSzcYuyT9rD7Lv3KN8waoTFh/3cbYH/86BpKekO5WMyf714T2nhUW6k/Dl/RmlDSo 7Y1gKUgJ08VttoK2ssbNc1GB3lyb3CBod1bkv7NrskKZoF9AlGt4IFPPGiUDtXez0+9CWVqft+8 c1pbaQfs2QQ2PstgzAn1Zn7aEVOH/RFo6raICKYhiH2u/6GogCzcwxwkyPHIsvKkT4zfgjzw0kV /A20TZlKSkpklyDvSPiXbSD0fW42ntSzYLBN3zPuiLlybL9Diz1J/LXOPEnUNq7MDgmbIIWe+dz tGZ/C/HrQgH1oGV9y6B4vwBM8RgmqhYKa2p8awI6muJnBV1u4ZGEKCw9uJPc8pq+H4/QtoiLm2e 2ZUX7A7DW9Phh0G0JKZKaOfLguGpkQKET0K3ronhYTxP5Mgb+aLokcgqRPaX7+VzEuEQ5x9AxMg z/Wc3YCbqsOvimw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792349092939463594 X-GMAIL-MSGID: 1792349092939463594 From: Geliang Tang Just like MPTCP_PM_ADDR_FLAG_SIGNAL flag is checked in userspace PM announce mptcp_pm_nl_announce_doit(), PM flags should be checked in mptcp_pm_nl_subflow_create_doit() too. If MPTCP_PM_ADDR_FLAG_SUBFLOW flag is not set, there's no flags field in the output of dump_addr. This looks a bit strange: id 10 flags 10.0.3.2 This patch uses mptcp_pm_parse_entry() instead of mptcp_pm_parse_addr() to get the PM flags of the entry and check it. MPTCP_PM_ADDR_FLAG_SIGNAL flag shouldn't be set here, and if MPTCP_PM_ADDR_FLAG_SUBFLOW flag is missing from the netlink attribute, always set this flag. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_userspace.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index d6b7be3afbe5..3bd13e94b568 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -334,7 +334,6 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) struct nlattr *laddr = info->attrs[MPTCP_PM_ATTR_ADDR]; struct mptcp_pm_addr_entry local = { 0 }; struct mptcp_addr_info addr_r; - struct mptcp_addr_info addr_l; struct mptcp_sock *msk; int err = -EINVAL; struct sock *sk; @@ -360,25 +359,31 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) goto create_err; } - err = mptcp_pm_parse_addr(laddr, info, &addr_l); + err = mptcp_pm_parse_entry(laddr, info, true, &local); if (err < 0) { NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr"); goto create_err; } + if (local.flags & MPTCP_PM_ADDR_FLAG_SIGNAL) { + GENL_SET_ERR_MSG(info, "invalid addr flags"); + err = -EINVAL; + goto create_err; + } + local.flags |= MPTCP_PM_ADDR_FLAG_SUBFLOW; + err = mptcp_pm_parse_addr(raddr, info, &addr_r); if (err < 0) { NL_SET_ERR_MSG_ATTR(info->extack, raddr, "error parsing remote addr"); goto create_err; } - if (!mptcp_pm_addr_families_match(sk, &addr_l, &addr_r)) { + if (!mptcp_pm_addr_families_match(sk, &local.addr, &addr_r)) { GENL_SET_ERR_MSG(info, "families mismatch"); err = -EINVAL; goto create_err; } - local.addr = addr_l; err = mptcp_userspace_pm_append_new_local_addr(msk, &local, false); if (err < 0) { GENL_SET_ERR_MSG(info, "did not match address and id"); @@ -387,7 +392,7 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) lock_sock(sk); - err = __mptcp_subflow_connect(sk, &addr_l, &addr_r); + err = __mptcp_subflow_connect(sk, &local.addr, &addr_r); release_sock(sk); From patchwork Fri Mar 1 18:18:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 209006 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp66703dyc; Fri, 1 Mar 2024 10:23:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU/8xAQXxfVojiOQjQZAU4568tSKp0mA4kqlnoKdKrZT+Q9DsRmfKQIEKDANltRaZp6Znv75DXg8fgB268KIwc1887tnw== X-Google-Smtp-Source: AGHT+IGm/OxtNzfQ08EHJxqwNXwfAblRHhqle6Y4NFwN/opN8sLkRZ8APuj54FTST6F1ZzwL/TMm X-Received: by 2002:a05:6a21:3989:b0:1a0:f350:6766 with SMTP id ad9-20020a056a21398900b001a0f3506766mr8708179pzc.4.1709317422149; Fri, 01 Mar 2024 10:23:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709317422; cv=pass; d=google.com; s=arc-20160816; b=tgIP9VJmyyQoBcJBAdNZ8qYEY6cbC1tE66rPyx4Eg6kZmllQ50oX/C6PNc06SaRZyy gPcHbbnNwL0LwvOSBs1s0fUAZfcV8+tayP0v+65T9ho1IZgpxkvFDJEUd1j/aHY6amzc OFSp912pKBw3Dwof/NOrc+Gi48ePymst6a+Dw/BW7h38xAiYpmWZ9B2l5sgFeHxq6JjT I20rtlVJbhM/U1SQw5ZLobKzuCanS4jC6XYmN7jnHErmkXhwWH8gk9GCMV0xJ89cDOqu Zg7k4Chsq+DWWcMp46u6qa9CVqKxFPOZ7hExh0lyAfKXEF3E6G7fGb85TH3dQFrl2Veb pc8A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=4W/a8ZETV0E8eSqzABWlj8thxr1YCL1+dUOa5loYU0A=; fh=i1fHfqb3ms9PQICjX9LbYyHHX00fft5d6t57sCy1Fok=; b=yUUvpLLhJgd2/l/UacELog1kb7aNmxJ1K1dZS4FrxERD1d+QVChi0F+g6prsguJ02U Lvs6rac8nYGBF20jlRPtQKpldkQh/gFEioKIi5BGMJtmZcQML0ggo0slKU2AHWkM70/j 63+RsERDaviigntXHd724jajJT/BO3NcHSqdQXSQFqZTOhePjnnJ6a1Ha4gE7FtyOHoN XGKtYN3rKWdSoY2chm2BW4nspPv5Sh9b4kZzjQEjeuHaVWmrycKT75SC4Gyxeez8Xybf GjkGEuSz5XPVyvHUDIdtuEaG4VOER3YuTo/O9C8calHRj+e6w+bc+prVnM7qw1DedmJd moXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FsrWLWuy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88905-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88905-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 185-20020a6301c2000000b005c220a94525si3959006pgb.90.2024.03.01.10.23.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:23:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88905-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FsrWLWuy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88905-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88905-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AE18A2898FE for ; Fri, 1 Mar 2024 18:21:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0B9C3D568; Fri, 1 Mar 2024 18:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FsrWLWuy" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 064E23B785; Fri, 1 Mar 2024 18:18:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317134; cv=none; b=qRUvFKzXvapsfbTTHm2fkP0fQW/IZf6kY0kG1nTUtwVs5hs6mKb/xxkY9mmVfDMFTi48S2tEWGkR4c8+T00Add/06nppMCri2ZY1oNdFVDGRhTieIRxKCrmn+mgA4UfTO5szcaCob8UBqdJku7pZCktaHQFCmYe3tY0/nGdb/0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317134; c=relaxed/simple; bh=2ulEk82mzCDQTc9Q4xsVEYZBuHiCFEEMnXuV8zumajs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ARUhVQHdXX/GYGntMWvxpWUjXS79zqbfZnRYgiPIrG1p1xm4ZTGolLsWu15BnsETP0aX+Dq/Df6kH9BDh3nORgA/T1okkpieHu1kTb2Vq3IOiBjHrf/5k+yMFj/yrskVSDkV5SUFv4Fh+jHH+npjsxI5gaJhXSg2nuTUSuywimk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FsrWLWuy; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAAE1C433B2; Fri, 1 Mar 2024 18:18:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317133; bh=2ulEk82mzCDQTc9Q4xsVEYZBuHiCFEEMnXuV8zumajs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=FsrWLWuy1cuhgV57G20jSlnzmFnHHmMhHumQtZjkwGU9rPnyZ76ggu10m6kzzXvbC ShLKiFqfhxvfcQsBU0EoLYngKTlQMP0XfTKec5BVa0yHK6/HWX1LneMcy4x82b9rjQ adhAl4k9TngUFpYc+Y2dWxdNpTgFlWvRAztIoecidmd+/1CyNS3OoHP8EKlA3ROLNv pouvrJj/XCBEbT/FRiSZdAqzoXi/8jizTYi7lxoS4fG2AnczXrKBV1ikN59S8zxdLP Q34BVlC+c1GtZSz2lMKV1fHG77MCiS/H7SIfvYwU7Ci2mUYLlMrxWN3z8SiJpFoUBk gk2hrpfFy+93g== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:31 +0100 Subject: [PATCH net-next 07/15] selftests: mptcp: add userspace pm subflow flag Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-7-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1420; i=matttbe@kernel.org; h=from:subject:message-id; bh=hiJ4UAaexdDdOkDMA90vHJxSvQ7TaHeYuKTyQ9X/yhQ=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl4hv0hsDs/1Pa/GzXfDIT9DqD+yjEj9kpfYLNs 1i6ujkWj5uJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeIb9AAKCRD2t4JPQmmg c7AoEACJ8g1KYDvlpmYv1fWLTanHLx/uzyfz4MCfgZ2ecgZT1TxBEucPB2HA3z0I9AAMb+yzbvY y5lz9tc+OG2BszlB1Os7kqvKuOS5j2oIX0cB9/fIfyewK0BC5dPmw5Dxx8nhKTIP+XJE1hUCHJq Jwe2cDcE+XzESyrHwIohfMiQDmFVDXEYRsbors/VLpP22aC7vjJL9GK7CO6q56E8CK3tMdKtEZI m5i+OxEx90+Omq1roKrFu6SO/0ERKK2cZ6qJbT4n/LP+X1rYXYcbuXVc9sa+NsUOhhVnOVB4mJt QdanLxiu03TGJgirap/YLc+qQ6t+wXydNOQBZJoCUdgUWqSjYxg0i3BpZ/BrPjJvirkI8MfSyin +SF1W9fnFgkocAFHKTW7z9sPc/BnvPs+1M0EE1NwaQsg7nzqCpeAdgdkM40LGSUeZP/mPESPSQ8 MUCu3p2M5XWXA/4CY4nc0IX1ofLaXBYJ4GhOuYAerKTChp9vfXetlGQX0rF87IA6eHGUh/tP30v AjVX1UOs4EjisrUMoRk2xLqMnt4HibFIWg/btKys0soDSU0lTT7LSKV6nhAJm/WD96n6C8P/P8+ DDNb9Pb8bhv6WzJj3mDgjF99ynvncffqpsTUGkjVuaVulxCrvdsE0sTQEx+nSa5eagomAEGvzmB 1qrZ3N3QZTe8mNQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792349225190321304 X-GMAIL-MSGID: 1792349225190321304 From: Geliang Tang This patch adds the address flag MPTCP_PM_ADDR_FLAG_SUBFLOW in csf() in pm_nl_ctl.c when subflow is created by a userspace PM. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c index 49369c4a5f26..e97856323ec3 100644 --- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c +++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c @@ -453,6 +453,7 @@ int csf(int fd, int pm_family, int argc, char *argv[]) char data[NLMSG_ALIGN(sizeof(struct nlmsghdr)) + NLMSG_ALIGN(sizeof(struct genlmsghdr)) + 1024]; + u_int32_t flags = MPTCP_PM_ADDR_FLAG_SUBFLOW; const char *params[5]; struct nlmsghdr *nh; struct rtattr *addr; @@ -558,6 +559,13 @@ int csf(int fd, int pm_family, int argc, char *argv[]) off += NLMSG_ALIGN(rta->rta_len); } + /* addr flags */ + rta = (void *)(data + off); + rta->rta_type = MPTCP_PM_ADDR_ATTR_FLAGS; + rta->rta_len = RTA_LENGTH(4); + memcpy(RTA_DATA(rta), &flags, 4); + off += NLMSG_ALIGN(rta->rta_len); + addr->rta_len = off - addr_start; } From patchwork Fri Mar 1 18:18:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 209003 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp65790dyc; Fri, 1 Mar 2024 10:22:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVV02/Ka7EphtLKfS7AesZ5KAOV+fuUiSLtC6jMVEHTEui7NjIbUr9QT/5X2DCe6EN71WEke0fT3vaWxzfO1HGB5uJfxw== X-Google-Smtp-Source: AGHT+IHTUKO/0ge4Y8stbgG/3AsrPLoZXq83imWiA7TiPytz6TD6y9m26i/kkLhhC/oApG4WleWe X-Received: by 2002:a17:906:c49:b0:a3e:e678:556 with SMTP id t9-20020a1709060c4900b00a3ee6780556mr1826649ejf.58.1709317345200; Fri, 01 Mar 2024 10:22:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709317345; cv=pass; d=google.com; s=arc-20160816; b=k2LksDBDWsaw3ojI5b2v70QeHWhzGgBGTsA12ZLI9S79CSI61GUgm+O2YHmlq+TtlM M/j5PH6DIHqcblKNgZ0F6guL7bgHqaeqqQmP94mA3VT+eVgusrWun6oy48FyiQv79ZsR dBW0JZPXIyW2lI90kzO1eEi2KVzujCwuu6b0x853Cx1XvjPFvo5QHrmIBkkyMva/PlCa TTOT5Eb6+LjzQ0tcvEfr0bPV1pj8CUSkube9IN2BkLrURBBrLmlwKBMPomOT2jhDQZwt eb7ntBPQzRrHU2hIEGfLOOn/tMat/TBRkJe3XkPpbeCb7ubB1jk2AFBOwluBRYW8LvDi 5yoQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=UiHfqqBV0f8BNmNAc5L9QNa0SKtKPcokTfZ0LIIjSJA=; fh=i1fHfqb3ms9PQICjX9LbYyHHX00fft5d6t57sCy1Fok=; b=nmUpzLrRO/jK8PARcolhhjy380MUtPRNZBP/DBJAL3fgjZ0V/TBxV3gCK36kfn9zzR Vq3g2HPJI7Kep8uMjJv+h4q10QdftDPvw90VIBnVE0rGi+YuTPyXadT0PglBaIpXOvJq olVuRasC1NIBJMxjS9c3C/cTWiL9rA5B2zXzHXLmZG0ypur/k+TQjUbQ+A1js8AnEvie S1dC7M7PYWOTXZaUkB6B3XlcJmSUrmZlz0vcpB1Gnvi2dyYkwTnDlM2s6pURPXhkP2j3 uxmhRcFMTT/aHUqSqhAVd3JxhvquaKTMX2nk8t2FARo5+VXdKtRvbdcvI2o9WUaEbH3F kHOw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U9Kra0Z7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88906-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88906-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qb10-20020a1709077e8a00b00a445ab8c59fsi1323027ejc.935.2024.03.01.10.22.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:22:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88906-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U9Kra0Z7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88906-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88906-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8EA651F21156 for ; Fri, 1 Mar 2024 18:22:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B60413D996; Fri, 1 Mar 2024 18:18:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="U9Kra0Z7" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0848D3D56D; Fri, 1 Mar 2024 18:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317137; cv=none; b=JWNlJcl9NIyXAWjbOkrgXuU/817RWOsUAwslBRMmMD5yMFDW6kG8JcAW3RM437qdMXx9fAs53/Pwgg3IsPVM4HTJBAz0gpzfFed7j69cniEErDa7jCsKPLp0NF6+Ae8rqhGvSMAoSC3e2BwxmTTgcKJ1PErhD0uhsqREzUbSs2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317137; c=relaxed/simple; bh=FDB8XSQBRdMllqh8m8OoUcSKAfuUGOTWR+NIv4IGlXU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jq7L7NBB1DQYN2SL24IOO9fM7RlWd23uaSMXlqKvkACAOCrQHzmPhoMbIhXZbCVQ2HQILikX3vgflE9RtxR7nGGUFd4Ecc0IXyvPdlh2OXK6bwIBewBsRRy22PGNAdgUsVJOS2qHTGy/WAbUz+eRhEfln7ZRmf/VeDxnLjFombk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=U9Kra0Z7; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B9F2C433C7; Fri, 1 Mar 2024 18:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317136; bh=FDB8XSQBRdMllqh8m8OoUcSKAfuUGOTWR+NIv4IGlXU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=U9Kra0Z7icfOVAk9kgesvPnNG0xsN6fm80CiNQyP2NOADqW6J8e3JI1Hx2Qpv6uw6 oUUS25H3voVA8B4F4pOyApMZ5250SEhvv49eJps4bJTsCp2jNPpWB0FKTDraYaYNoQ UZTwH9TqW0S2IjlMNoquDXdpwN6vno9LdlWTMcPSxihZQSwvi+d8PtT3YRF7ndhzsD MpoTew/daNzKczIkhGAQIpBTND0zXGuG6n1A2KKEi+gugs0gWbdJGEB0YCdRU2GSYH 5+zKq+6iOi8oEEBjCl99j9RW7PgKr9/OzLPe+l3q9o037VQsCS9346eVDx0/URbtM7 DhLn+uFT6Qf1w== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:32 +0100 Subject: [PATCH net-next 08/15] selftests: mptcp: add token for dump_addr Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-8-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1817; i=matttbe@kernel.org; h=from:subject:message-id; bh=s/43MOo5FC27LuiPRjpFodaWmdzbPWbgVM+F4CaJLW4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl4hv0xmOFf35y7gvs5KN2utY3oc86QKVhmAHQI bK97pq1PauJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeIb9AAKCRD2t4JPQmmg c1RpEADF9Swx38ckUj1z0PPfrUI76nHB/BMmj7F7QJowoyqhg0+0QdlZ2nAB2baCgyXF68YSWRN +vcSda8n5MOBteGjahXwc3OlGGC83pbWVOnbt7XAa0FV50w6/TMR1YTjmzPTLz6iX6OqpLm6IFp Oa4SLS6tyVrzYJkj5q7eHodYipWuR0nw1TyR9VfXQtEkZpe43LxP8EbDQowlkj8lwf7pSTuWIey 83vS/VaZ0byZ5jKpxmwqBOY8OPKlqkoRPqOqEyGj7iNZl9BXbaBXY/s3WmRC4/iljaKqbHBj/IK pJ9ooaSrDrMQf7ctNwBcVKKOS0Gws/GCBBSuJ5OSoqUXPgqVc/JXZvscAVFjbqQhGqPPiluf0Nn FhfQ43Uzi0zxs+RKRfzQ1HuW7jPBBCewZHSY7M9lSmN5eE3FMqccK4QT9PBU4nLzS66LbEOsNn/ l2nyOoS/ZuVUOKGJZdq80TKf9GwPvCqoFcQde7prf4i6ZJdMsF3ct9BKAhU+IMjuQN0Ym7YtFWH EwusNbDIZcwQw/1XZDYg537/F/Z4dZkjbCEdB9AE046vvzyALVi08Oy4UpmpwhFO1YGwXzw60IC EcafHWT3oNwpi6XJISyXcZ2mvTe/Ex29D34xdOI4lqyF8oFSEn649nCAXzAsyWRJBZsiZk6opOm yBzXiblnP9LD1IA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792349144516188544 X-GMAIL-MSGID: 1792349144516188544 From: Geliang Tang The command dump_addr() of pm_nl_ctl can be used like this in in-kernel PM: pm_nl_ctl dump This patch adds token argument for it to support userspace PM: pm_nl_ctl dump token $token If 'token $token' is passed to dump_addr(), copy it into the kernel netlink. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c index e97856323ec3..8d7d1b4ed28e 100644 --- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c +++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c @@ -1127,8 +1127,16 @@ int dump_addrs(int fd, int pm_family, int argc, char *argv[]) 1024]; pid_t pid = getpid(); struct nlmsghdr *nh; + u_int32_t token = 0; + struct rtattr *rta; int off = 0; + if (argc != 2 && argc != 4) + syntax(argv); + + if (argc == 4 && !strcmp(argv[2], "token")) + token = strtoul(argv[3], NULL, 10); + memset(data, 0, sizeof(data)); nh = (void *)data; off = init_genl_req(data, pm_family, MPTCP_PM_CMD_GET_ADDR, @@ -1138,6 +1146,15 @@ int dump_addrs(int fd, int pm_family, int argc, char *argv[]) nh->nlmsg_pid = pid; nh->nlmsg_len = off; + /* token */ + if (token) { + rta = (void *)(data + off); + rta->rta_type = MPTCP_PM_ATTR_TOKEN; + rta->rta_len = RTA_LENGTH(4); + memcpy(RTA_DATA(rta), &token, 4); + off += NLMSG_ALIGN(rta->rta_len); + } + print_addrs(nh, pm_family, do_nl_req(fd, nh, off, sizeof(data))); return 0; } From patchwork Fri Mar 1 18:18:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 209008 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp66943dyc; Fri, 1 Mar 2024 10:24:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW6UyYTbu7WFRC+c41j77fXdJ7GS62QY79oUYTZERz75p+qpQDwdjpdrIpcQG/CwlCHeXFqHKgXKA631ffq/s5if9uFbA== X-Google-Smtp-Source: AGHT+IG7akToFXzu6MvoxHCRttCDi9UqEuaCT2KxNtzwHrR2TfN1ktOMcG+Dx3D+eSDk8L60Kqy0 X-Received: by 2002:a05:6a20:7aaf:b0:1a1:2ff0:4e2f with SMTP id u47-20020a056a207aaf00b001a12ff04e2fmr1955384pzh.60.1709317441272; Fri, 01 Mar 2024 10:24:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709317441; cv=pass; d=google.com; s=arc-20160816; b=G9p8N2gU0/neB2LCI2v9rPwy6G2B64mZamLH5rfcEiA+zWhIq7D4cNeB6MXJFwxBdd LbW9HSkHflPcFI1HSDLtrXpvuCetT5TeBGvU2QBY28CQZcyRz+KL41gxZoPUqWGr/pqU 389Sm27F5TdZskXfNQJI6i25RwFsA0FdpSINSCIM7gD0XWHEdprp0J8wvxGHHZ2b5YqN kITrMtCwie/r5ViybXXY5TmsA1t6XLeB+7+nATSxJQKk1wu9Bvq4yj7HViUWdOaVrkZ2 oTg8Ce8PgK54GZVKWhy1uQGu/LeH2YBL3BMCK6O66dN9DnWeT9JTgN1hFgOJT2FokJDb 5RVQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=+UANCdE0N8oCGdhKgUtb0uDn7EqsTvt1xG/15Bm7bDw=; fh=i1fHfqb3ms9PQICjX9LbYyHHX00fft5d6t57sCy1Fok=; b=T7i6+I0qJS7gF01WvUKGhjpe56ZrIeoytM2uK+EuhcXN6qh17SW2fzADa0+n0hDUvX YDV+WuYfvFx0/KDT9CuhPMUpFSqfofSbds+cmTo6UpZe7mK6rH2gz9eLEfLg/ggqMYDH 5a+hw315RsWPPI3+OcErNC9Jhb5pVUmjJg/wuXZrfD28yjlZVGyIMabLHT1AHbRxQgjG nqqdceSqFnML3qTDwXJ9MHyEXF+8bcK7m5BTDpjP3g8T0vZKZZp8KoHaJ9NZnjW05fM1 oA/rLG2GwIANwzky7rLtiaafau9Vpx/oSP7MGL+tBDXkqHkNf2ykvctkPKDNfJRjEunD 82uA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DTqv9C3b; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88907-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88907-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h30-20020a056a00001e00b006e5832224bcsi3879563pfk.83.2024.03.01.10.24.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:24:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88907-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DTqv9C3b; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88907-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88907-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4C7A828BEB3 for ; Fri, 1 Mar 2024 18:22:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9738F3EA73; Fri, 1 Mar 2024 18:19:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DTqv9C3b" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B3DC83D995; Fri, 1 Mar 2024 18:18:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317139; cv=none; b=F3M7419Pm7P3Wu3GKl/u7+Zz0M2GN5dBfTya6atQ8A9TUfgwppu3eVaYWm2FWr9fdedBUEJkgbcTE87cHDVRKSLnPpETq5mtrjKS0DEB+Mb0vVms8NA6Odx4cNH7OrslKFft1rEXEjU4bf7Ehv73Cl0INe3YC+C9cqS2mwYLKfM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317139; c=relaxed/simple; bh=pbqWEmCOrykbN/GmGwrYxgoy7cTcujW3whDie7ZBw5g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EWmVGVFOZgI15ZS4w4rh7DgKSphXC2wNt3nb4pEje++VnBh9ooSqxa+eHSf9nMJFVMp3EinJrylSUD6a1wA3tAJfqEl+eRfBFNku/YHjnnToquhzDU4bgVAGXYNho57vKvC9Xqj/++Exvkkdl5UzvKxuSdyRY8nUVYKhm/8MIfU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DTqv9C3b; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E684C43330; Fri, 1 Mar 2024 18:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317139; bh=pbqWEmCOrykbN/GmGwrYxgoy7cTcujW3whDie7ZBw5g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=DTqv9C3bboz/UoIlDOPGanIwf0RoRP+8hosq5krfQ+0ep6bGthSf4s7vXPwmH+BWH UICkaPn3KcpFdTQDLJBYc0R+T0Z9ZgYpjC3nQtrH1UnF9kIlqt+RUNwCYsbLclu5Fu SO0n8tOWGc1dHiqpIr76XsxxvpMw0IfL/2AaEONUufrSTMabcCSPkla0zWzGJHKR3V DT7Hsld9g7ndILI6RgUcODIMAz5daZTlvILV1htx3PZMyYEGoFMLBNDk25akvrmpnB 3KHgLLkYJa9O6u03PRYyz76ypD3/yBLkmEBpfjvUmIp6tgKpv6Y37F2tn8vPrX0erV TioarPwAMdUcg== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:33 +0100 Subject: [PATCH net-next 09/15] selftests: mptcp: add mptcp_lib_check_output helper Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-9-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2654; i=matttbe@kernel.org; h=from:subject:message-id; bh=6G31hnNo4MBSwHsVBP5DRx+fol84lvZ27A4ZWK/RMcQ=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl4hv0fr8VDllyWbt545znoPYiaNbnRbSvoaZCw kAPBIRufj+JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeIb9AAKCRD2t4JPQmmg c9EAD/9l8P/kyWHAIO+BWefN0NfyktQogWxXy01+AiE4kA3q9k6K7NDfU0977yhMlbi5sluK8A6 A1H4r6/0I5rryLJAF7eMPmxtiRpeq78oQh4l3zoyjwAx1pXajvHgj7eKVcLxL2w72Qb4bvftgdp oXbjqwnGITYzzFTB9Qwj1R88YgRUt1cPYYyawB5u674WZj4lmKUzFPkNUZiSKYyLtxynX9OEgJL RiCSQO+fXw+XXscCmjNSTDrlq/k7bz2DFapPTU8uw9sAhZSIk/VQ9vfbMO3k1n7blnw0K+zKic/ NrUsTSJIsnrdBNbobaCCzFgzxdhqIxT1JDJmLh5hQNv2HGjwdTCQdPKamtxBPTdyE23erqSJHiE D5w01t+d4V5Qdjly3iPXSLWG4xaZvxV9LH2EO7xgQhLuVO+U3+frjE07LarPfn5uFhU1xld++pE LdrYl1pBrrP++/dGwkukmUI4cfMABl1VJW0WxdLaVuw8hp47lcYkC5Kv0TdPblGmWVoY2iGDSLJ 8GOZ8KcYx99iNsQbmjnXTHOI8Ai14Twf21n+i59WusIwYME1gjBtgrZ1Zhye828zqfQD0faCVim ArwmOhM4GoVpAAnwS39C/tKmQrlw7o9oFnF4mucq3V7UJND21R0sLKkGdu+fEkhVIl2OxAMas5a qHk5eb8Rx00koVg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792349245367585753 X-GMAIL-MSGID: 1792349245367585753 From: Geliang Tang Extract the main part of check() in pm_netlink.sh into a new helper named mptcp_lib_check_output in mptcp_lib.sh. This helper will be used for userspace dump addresses tests. Co-developed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 23 +++++++++++++++++++++++ tools/testing/selftests/net/mptcp/pm_netlink.sh | 18 +++++++----------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 108a1e12436c..438f557aac90 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -319,3 +319,26 @@ mptcp_lib_wait_local_port_listen() { sleep 0.1 done } + +mptcp_lib_check_output() { + local err="${1}" + local cmd="${2}" + local expected="${3}" + local cmd_ret=0 + local out + + if ! out=$(${cmd} 2>"${err}"); then + cmd_ret=${?} + fi + + if [ ${cmd_ret} -ne 0 ]; then + mptcp_lib_print_err "[FAIL] command execution '${cmd}' stderr" + cat "${err}" + return 2 + elif [ "${out}" = "${expected}" ]; then + return 0 + else + mptcp_lib_print_err "[FAIL] expected '${expected}' got '${out}'" + return 1 + fi +} diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh index ebfefae71e13..705106d60db5 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -54,21 +54,17 @@ check() local cmd="$1" local expected="$2" local msg="$3" - local out=`$cmd 2>$err` - local cmd_ret=$? + local rc=0 printf "%-50s" "$msg" - if [ $cmd_ret -ne 0 ]; then - echo "[FAIL] command execution '$cmd' stderr " - cat $err - mptcp_lib_result_fail "${msg} # error ${cmd_ret}" + mptcp_lib_check_output "${err}" "${cmd}" "${expected}" || rc=${?} + if [ ${rc} -eq 2 ]; then + mptcp_lib_result_fail "${msg} # error ${rc}" ret=1 - elif [ "$out" = "$expected" ]; then - echo "[ OK ]" + elif [ ${rc} -eq 0 ]; then + mptcp_lib_print_ok "[ OK ]" mptcp_lib_result_pass "${msg}" - else - echo -n "[FAIL] " - echo "expected '$expected' got '$out'" + elif [ ${rc} -eq 1 ]; then mptcp_lib_result_fail "${msg} # different output" ret=1 fi From patchwork Fri Mar 1 18:18:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 209009 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp67088dyc; Fri, 1 Mar 2024 10:24:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUQl73d88RQF7qfIZDFZ+TNyzqRNZRKopaomX3G2hJWqnz79+/PqfxhPr5gwCey3Pq0mDa+074LxlIXQ6Fn7UXQg2XUlQ== X-Google-Smtp-Source: AGHT+IHwoWuDcG2F0N5XbQ3lMIjFEJV+nOMlVjM3U6RBpDBbDqxhXx4yHCUaGWMcmD+7FRmNxh5X X-Received: by 2002:a05:6a20:244a:b0:1a1:e70:3195 with SMTP id t10-20020a056a20244a00b001a10e703195mr2701282pzc.8.1709317450865; Fri, 01 Mar 2024 10:24:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709317450; cv=pass; d=google.com; s=arc-20160816; b=Q6w8FaqI69SDEsWntjUZhfQfjeOBhAFycVP6ttCZPf+HzKV34F7hQHLIuey1NRM3H1 i5TFxp3cVCSEc4WM6NUcUXDThk1dhl+3uA2eazCjMzaZx+MECBRkVyKmaUTRGqbEmm/j kX5wlYt5sPXNpYjvmP2HVi6/Dx0Xx2IIDgR1+iyh5GYO4sbWkmLmZrJJX5KU3tgvt00q tR+0DCbrBo14nuIZdHaNq9QKWLOjdySnaDPUm5O2TUd9dpJ0MPVIJqh4ZtpC1CYWuWg+ 0d9qjpt5ZcYUWsEF0hElXJAe0NtF0VRH1/vo2I7iRZuOtmIK1tF12PLDzPN4zWdYsiDt 7WpQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=EqGxGtdWJUU+g3dxLzJXNjpZJdpOaP9VfsCF2itEnak=; fh=i1fHfqb3ms9PQICjX9LbYyHHX00fft5d6t57sCy1Fok=; b=aoctllrAnbF4oS6XxZiNZc7LccPQXHrskWiNEL/ADU7zJnOalcUnb6AggJgcrPjjzO sRAAsiOPFeAUjRjFxfLvQRI3mpYEY2h44KbICmI1Uo8FWfzWbuTQJD1Z+F/uwtHXDCjq SOMdoP4gX4lnGzOmWG8JXi1Fa+C9vQ1WKMTHc08brRrl0kuphKNEpZP5AAwNNoGhuBZy xhx5H5Y2UA6xjIxNyFuMHJ6bameAYL8zB0/nc8Tono03qaeNe10NweOMvyXTruXEYfeJ 3e+f5kSXXo6MEsCgEnScWiC71imjhxoC0dvQqr60SUq4bfrPS+/hYMBUNZDzqzOwxRHh WvjQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iI3zz6tS; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88908-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88908-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t70-20020a638149000000b005d8c18c7c65si4055285pgd.671.2024.03.01.10.24.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:24:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88908-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iI3zz6tS; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88908-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88908-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 548E528C9FF for ; Fri, 1 Mar 2024 18:22:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC7EF3F8F4; Fri, 1 Mar 2024 18:19:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iI3zz6tS" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BCA4F3EA7A; Fri, 1 Mar 2024 18:19:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317142; cv=none; b=ca8+ckd1Q6Rvd4u1RCtYzXFMVGF620jScC/WnIkfchO34vRC2FYn158Xxg8f5M9evjCi+kHNWXM95p+iz9jnXegIoZVbImOgiew8AJkm1pPQrY/lphhAMJYPl2tH3mPdWvuajtWUq0a264DQN3E5hNFWGn2toshhDmB2NTOY3Us= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317142; c=relaxed/simple; bh=Y+h8oi0OzfKxtVKGinXDMV0yOHevjFEPPPzMtpCcEz8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e7mG+K1g1ZXhC+ik3WMKGQwy75xK2NFFqCHYg9nvpaFaPEkwDbpfQrtxJRdi//D54+eH+YpKJ9bBJiHoLBtsDhfG7KjESRNPLT1+ZIuktpPtPMr8UauZzYEOLkPZYFWuwk17ZR25LioH2CtHYysyxao1w/pV2LN07m2P0b52Hm8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iI3zz6tS; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 128B3C43394; Fri, 1 Mar 2024 18:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317142; bh=Y+h8oi0OzfKxtVKGinXDMV0yOHevjFEPPPzMtpCcEz8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=iI3zz6tSSekg302o4vmsisle/5Q/bA0tqRpzsam2mFL6Wj9I6kJJ/qM3Xjo+QpAJD UZ4xGKSiGy3+6ffJEvq824NfyfXrKJ/CpsLwpiBbGyi5XjzSPQVFtl+RUIm+iuKOO+ PZFinei0fIuvz/1P46l7J7Sz3vzUTmwpXcI5zYLsd4PbBQuwptvYqFCnXI28Wh32kd W0wz+249j1HBUboChVKQx/YMTJnJzJEDWEnGR28RrFngMo2fJUudXawyREW09q8m+h 7TL5aE7oWAIb5+c0SAwplJnBNPR2pOmNBJeSReuICapa6Fp2hmOnpmtkZth+raWBK+ 9hY5T1BznGhYw== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:34 +0100 Subject: [PATCH net-next 10/15] selftests: mptcp: dump userspace addrs list Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-10-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4013; i=matttbe@kernel.org; h=from:subject:message-id; bh=3qSB2EnzUGbXo6d4U4snvlpAoOYOPE6h5qmbyjUUfLE=; b=kA0DAAgB9reCT0JpoHMByyZiAGXiG/SiQLHs83eh+Ot8YPNJ0iGE42bRFZjz6ShCFTpem784w IkCMwQAAQgAHRYhBOjLhfdodwV6bif3eva3gk9CaaBzBQJl4hv0AAoJEPa3gk9CaaBz/MUQAMDK LK7xpf+MlxWTFum7uz/dMbZ+HJfX9y0ghh5V1L0VlQHJ9mDsYaA1MSdyXDwmxNjN6jpnZzKnylo wWXFrDIr4bxyLxtbCiWIX6Wr2Si+AaZIiu3Y+WlP80F95ZTrx+mLNmsG/UkoINAk2clTAMjhOG1 OxTDuGNvyDuXfBw0odEp4pZ2iKQNU6cXqvBg2uyxp9/aOe1QXVwJe5lGaBzgGqGWW8aQuHphKG6 3XdXwgN9dKjKIc2fQ9vHYFgcDt/xqksMjqox0e7FxziWySKshbxyRmHY+iGL2Ory8VQwSzMVtYl nq2LNSgioRwvt8KYKXlTdk5OHssyd8WuCqiQBuokY2xC9HDS+NEv+C0BDp8XH6KW25Tci+6n95Z iaBI8s8Q8dFTfJ2G4+RGXQujekludO4b301fHg5sHXfdSReLuGleVjRzf+kyZqbfHcv2eSiER1H g3W9P+jbeS5CICUGX9UbFy5Tjaz573/0i615wkJ5dJhQPx3QFcgOULFgG4fzh57AW2Db9IK96Dt A89Gy+pIII0/AZfmZrRDmOngEpj9LfapoNt9J5aVm94LPo2gapTKze6kG5zFoQ5gVWKcvYgJwap y6594E8m5qNqsVg4N9H2I6v6pZZex7AbmHb6kcv6VjKm0VkDKy1DLrpnTYXUNUJ0A7up3Wt0ing GC8Vt X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792349255552385219 X-GMAIL-MSGID: 1792349255552385219 From: Geliang Tang This patch adds a new helper userspace_pm_dump() to dump addresses for the userspace PM. Use this helper to check whether an ID 0 subflow is listed in the output of dump command after creating an ID 0 subflow in "userspace pm create id 0 subflow" test. Dump userspace PM addresses list in "userspace pm add & remove address" test and in "userspace pm create destroy subflow" test. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 61 +++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 1267d5708e13..8b6430642706 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -21,6 +21,7 @@ cinfail="" cinsent="" tmpfile="" cout="" +err="" capout="" ns1="" ns2="" @@ -189,6 +190,7 @@ init() { cin=$(mktemp) cinsent=$(mktemp) cout=$(mktemp) + err=$(mktemp) evts_ns1=$(mktemp) evts_ns2=$(mktemp) @@ -204,6 +206,7 @@ cleanup() rm -f "$sin" "$sout" "$cinsent" "$cinfail" rm -f "$tmpfile" rm -rf $evts_ns1 $evts_ns2 + rm -f "$err" cleanup_partial } @@ -3356,6 +3359,50 @@ userspace_pm_rm_sf() wait_rm_sf $1 "${cnt}" } +check_output() +{ + local cmd="$1" + local expected="$2" + local msg="$3" + local rc=0 + + mptcp_lib_check_output "${err}" "${cmd}" "${expected}" || rc=${?} + if [ ${rc} -eq 2 ]; then + fail_test "fail to check output # error ${rc}" + elif [ ${rc} -eq 0 ]; then + print_ok + elif [ ${rc} -eq 1 ]; then + fail_test "fail to check output # different output" + fi +} + +# $1: ns +userspace_pm_dump() +{ + local evts=$evts_ns1 + local tk + + [ "$1" == "$ns2" ] && evts=$evts_ns2 + tk=$(mptcp_lib_evts_get_info token "$evts") + + ip netns exec $1 ./pm_nl_ctl dump token $tk +} + +userspace_pm_chk_dump_addr() +{ + local ns="${1}" + local exp="${2}" + local check="${3}" + + print_check "dump addrs ${check}" + + if mptcp_lib_kallsyms_has "mptcp_userspace_pm_dump_addr$"; then + check_output "userspace_pm_dump ${ns}" "${exp}" + else + print_skip + fi +} + userspace_tests() { # userspace pm type prevents add_addr @@ -3447,10 +3494,16 @@ userspace_tests() chk_mptcp_info subflows 2 subflows 2 chk_subflows_total 3 3 chk_mptcp_info add_addr_signal 2 add_addr_accepted 2 + userspace_pm_chk_dump_addr "${ns1}" \ + $'id 10 flags signal 10.0.2.1\nid 20 flags signal 10.0.3.1' \ + "signal" userspace_pm_rm_addr $ns1 10 userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $SUB_ESTABLISHED + userspace_pm_chk_dump_addr "${ns1}" \ + "id 20 flags signal 10.0.3.1" "after rm_addr 10" userspace_pm_rm_addr $ns1 20 userspace_pm_rm_sf $ns1 10.0.3.1 $SUB_ESTABLISHED + userspace_pm_chk_dump_addr "${ns1}" "" "after rm_addr 20" chk_rm_nr 2 2 invert chk_mptcp_info subflows 0 subflows 0 chk_subflows_total 1 1 @@ -3471,8 +3524,14 @@ userspace_tests() chk_join_nr 1 1 1 chk_mptcp_info subflows 1 subflows 1 chk_subflows_total 2 2 + userspace_pm_chk_dump_addr "${ns2}" \ + "id 20 flags subflow 10.0.3.2" \ + "subflow" userspace_pm_rm_addr $ns2 20 userspace_pm_rm_sf $ns2 10.0.3.2 $SUB_ESTABLISHED + userspace_pm_chk_dump_addr "${ns2}" \ + "" \ + "after rm_addr 20" chk_rm_nr 1 1 chk_mptcp_info subflows 0 subflows 0 chk_subflows_total 1 1 @@ -3492,6 +3551,8 @@ userspace_tests() chk_mptcp_info subflows 0 subflows 0 chk_subflows_total 1 1 userspace_pm_add_sf $ns2 10.0.3.2 0 + userspace_pm_chk_dump_addr "${ns2}" \ + "id 0 flags subflow 10.0.3.2" "id 0 subflow" chk_join_nr 1 1 1 chk_mptcp_info subflows 1 subflows 1 chk_subflows_total 2 2 From patchwork Fri Mar 1 18:18:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 209004 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp66188dyc; Fri, 1 Mar 2024 10:23:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV2bNaFe1NUwr5/U/3cLSwm3C9QIfbZT0QbErRHzP+KUcNQ2N2tfBMbAlqdREIdljb8q/MJsBMQqwE1QnQQOLhl1W/0aA== X-Google-Smtp-Source: AGHT+IHJLWpTlMPZELWFzX6ciHPIu71n9YN3tdf+0XSImumt4VmnZxsaNIRkrUFqn88la6ic2uby X-Received: by 2002:a50:8749:0:b0:566:47dc:47e3 with SMTP id 9-20020a508749000000b0056647dc47e3mr2000613edv.15.1709317382445; Fri, 01 Mar 2024 10:23:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709317382; cv=pass; d=google.com; s=arc-20160816; b=aw+4WGmoIUyg72KiPFVRtOLgHsrCKqRm9d1ab8pCbJn5FaoRo4TW/IZxyILW1To52g PFCznHr5vJvKWe7nHqeBpz9aH+qCPUG7M2XoMZPZr1mYhhUSHemOoplE1YIWs9to3qCv IYPwsdJ2WRaj9TuLi/9SLC6ZfD05e+ap+M9U37AOp1qYcM4AWjdSUyJeSqK6ON4jeoGL DrDdzV6qwtGQmkwp1VwUw3QMUMBw407ITa0hOgkdJAtg2FhdO4BTBg3AdoS+me7tFuwM jzyVTSPaa0iUEp4GGie0NB7oWCQ1XOW190Cvccy5bWlGmOYNXWuyWrBdDzOg3uTQbH3D 3E6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=9M+LV68f3NTySiVCMpgQwqLqxLKP6GP/vUCKJiZxDMY=; fh=i1fHfqb3ms9PQICjX9LbYyHHX00fft5d6t57sCy1Fok=; b=YfnKoer9FTzYn3nXgyNmTQLqh+BZxxsMiwIHfnQuKdDAqW27PhC6xN/2BEONFA1Anx +FQZyOkaE3NudAWCCv1PrlwGZi33MnLt+kBY7Q8nY1iaYkNqXiFtvOiusraHV7yQdK18 K3c4lo0R50x5nmyi93o0a2z9bClqKuKe/uvKM1oFg2YodGEj3WEZvby3RVMS9uQRJ1ZO kXXDcO/546oGvsUtvtJQRxWKDSJ6Z2AiDA35FleEcIVT0w+NRicTXq0cEYjibAy+71mZ CUSKxd03juyA1t4IHJwVvc8UqA7Bp/xraxeDx7Nj5csEiTayJqdLcsM3QcEs3RVULtdY 2u0A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pXBjRdJs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88909-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88909-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b89-20020a509f62000000b00566d6cfda92si658218edf.475.2024.03.01.10.23.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:23:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88909-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pXBjRdJs; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88909-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88909-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D9CFA1F21F64 for ; Fri, 1 Mar 2024 18:23:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C657E2943F; Fri, 1 Mar 2024 18:19:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pXBjRdJs" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0A4EE3F9C7; Fri, 1 Mar 2024 18:19:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317146; cv=none; b=SXY/acuxrayTMMRcficutyJAoc5fLOoAWZOtPnwcwNY9iTGaEjHJ9t43oGowsp7OE7HjuVcaRpwjnWkEzJ9H7LKQAK0dNQlk87hzFU0uvKmXUMjMYWi51zYW2FVXdyok1b0Gins/U+po9YsE+D8uRqu+1mbTXvNJiCxy5gF7+Fs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317146; c=relaxed/simple; bh=z/5POAELw1PHTkVL0aqXKZ5amRaEjiv/LOrcYZGujqc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uGhjyEmfAD+3x3Jn/WV6K9KRJYc0wEIV+daUHrsTOqsnknuOE6xLDV6/kWDtT/DkekWfZeFYtJU+NEe6LW+rjD/qQU/Hmi2DuUyGAbJhnyOBy1vu/PQ+GVhUujF91XdOIEZYz9y5i7LOyjtkkBaXT6bqvIwWRcdPQXoM9rZysWQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pXBjRdJs; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18A2FC433F1; Fri, 1 Mar 2024 18:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317145; bh=z/5POAELw1PHTkVL0aqXKZ5amRaEjiv/LOrcYZGujqc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pXBjRdJsjTX2aMxgusbAG43/sFVEVjmA/oF5b4FcGeSye8BdxfabE0RqGdqt1+LFZ BWJhS8bV1pATTKQ+6nGWjq5NtC8vX3jBV5R4k6m4nr7uT90eKGpBJCnN+2BKFdJ7ds ZxYTS0iHOQaapvsli3BT/oD8NNyB0YOOky9sdHEXLXQxEyK4tvAKxE00iKKQru+yxO nN3ihxMyfkP92IpQm4RxqnNWXNDurENgCkrhp+Li1i/+XbZ+KeuN7OSqU58jlSQSh2 sSwfH1Hm9M+p1a5R758Nv5emRXWQmr/+jCYEW4XnPDphLWWQJ1cTj+T39XkcysHinP 0dhykl4z98WKQ== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:35 +0100 Subject: [PATCH net-next 11/15] mptcp: add userspace_pm_lookup_addr_by_id helper Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-11-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2595; i=matttbe@kernel.org; h=from:subject:message-id; bh=U2czlffcBsy4JlpV9GrJ3SPQqb0W1M1Z+QVuJlygMyU=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl4hv1DXnxGU86u3wUasNTA8QFyoFvBQucpOmXZ 1v1MjR1e2CJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeIb9QAKCRD2t4JPQmmg cwByEADlh9JuiXdIH3gjlDlCDPYGEdHxapyKQXxIXXRBmgUrOJhHthPWmshqMr6AXAW+yl/mAgD VkFTZQolxOCP85yq8GDJQezz39PzT4tSvcEu9tPg7ZHQB23NuZS4pct7Luw+yt52cc/nMu93CH9 KY8sTo6XxVYlEs7SfBAPRkn56wZdoUyRuRRPy3/D7LaqREm5w2//cSTAoIhlCWkCo3voG1kjr8I QmD7TWIA48hSP60Ngq/5ltiFIZI44AIcGcX6k55psYp9oK7Fb7UBq0GipGl9O+aUpCgV2EKo9B4 6E50oCTa8tBOxthFkn6xAj+pZ+v8rXw/my4pAnoVY5cTbdnQBgmTN1EFN4lbwkmDA0UIhbz3rmT UTmGBXvu/R5Xl9QUsnMsMTvploHuRwyVotQ8oEgI6uvWf9zBDF5ybvOHSW7PclDaoFL4hDWfcXr QunqEwFiB5XJ1BKN7Mvh78u3C+FXiNC0rTtHAZbkz/Gah91eNSKgqOw0eMy9m9x8KRkxkgl25bR r9pV8NY+LF5Ugz1G2PdhK27XRs+v/3VVN8SxkCrFUPw1gOUSHwZW+T1AHxpVMXfuMqA+WqGuEyP YqEllHkGiVp1QqHYU1O+0GmZlb6BSx3U1JCD5ZFU+2M8geJ16d0OgA+SC+q8STkr68WMHs0hgEh 12VbdYyuu/Rxy0Q== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792349183355496185 X-GMAIL-MSGID: 1792349183355496185 From: Geliang Tang Corresponding __lookup_addr_by_id() helper in the in-kernel netlink PM, this patch adds a new helper mptcp_userspace_pm_lookup_addr_by_id() to lookup the address entry with the given id on the userspace pm local address list. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_userspace.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 3bd13e94b568..20cbcb62cd8c 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -106,19 +106,26 @@ static int mptcp_userspace_pm_delete_local_addr(struct mptcp_sock *msk, return -EINVAL; } +static struct mptcp_pm_addr_entry * +mptcp_userspace_pm_lookup_addr_by_id(struct mptcp_sock *msk, unsigned int id) +{ + struct mptcp_pm_addr_entry *entry; + + list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { + if (entry->addr.id == id) + return entry; + } + return NULL; +} + int mptcp_userspace_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id, u8 *flags, int *ifindex) { - struct mptcp_pm_addr_entry *entry, *match = NULL; + struct mptcp_pm_addr_entry *match; spin_lock_bh(&msk->pm.lock); - list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { - if (id == entry->addr.id) { - match = entry; - break; - } - } + match = mptcp_userspace_pm_lookup_addr_by_id(msk, id); spin_unlock_bh(&msk->pm.lock); if (match) { *flags = match->flags; @@ -261,7 +268,7 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) { struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN]; struct nlattr *id = info->attrs[MPTCP_PM_ATTR_LOC_ID]; - struct mptcp_pm_addr_entry *match = NULL; + struct mptcp_pm_addr_entry *match; struct mptcp_pm_addr_entry *entry; struct mptcp_sock *msk; LIST_HEAD(free_list); @@ -298,13 +305,7 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) lock_sock(sk); - list_for_each_entry(entry, &msk->pm.userspace_pm_local_addr_list, list) { - if (entry->addr.id == id_val) { - match = entry; - break; - } - } - + match = mptcp_userspace_pm_lookup_addr_by_id(msk, id_val); if (!match) { GENL_SET_ERR_MSG(info, "address with specified id not found"); release_sock(sk); From patchwork Fri Mar 1 18:18:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 209011 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp67297dyc; Fri, 1 Mar 2024 10:24:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVNMcHaGw3dGOSuOff5DIrm2xiIslDKLdwyZTPi9U9YzLJspQA7pL+Tzd+3BNyOYOHlXxFf9O8JTNZ7S8ZwZxI+Z8P1Vw== X-Google-Smtp-Source: AGHT+IHS9xqgGitpDST8pe8+RS+WSOOk/fjoMZUuC19KeY8UIk6czgZQWPVD+Vf4O4B9IFtFv+4J X-Received: by 2002:a17:903:2445:b0:1da:2c01:fef5 with SMTP id l5-20020a170903244500b001da2c01fef5mr2896962pls.56.1709317468010; Fri, 01 Mar 2024 10:24:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709317467; cv=pass; d=google.com; s=arc-20160816; b=vTIkjnbIh9nWy8f78d35Y1HfwCFFVhz+wEw+ajFxEhKk99LYDekhH7gtrXA3z2vlzB x+F+J+VzUMQyqw8tM315mmfUvuFJYaaM5EGs1Sn1DOlSea8VaeO0kB0U7kSjmEzAMnE3 joyCcHkHnzxB5tkeVMB5yn9z24CQYM7Ccs/aIGXOArLxia8wquNBOgkoAVeTTcbzfU72 KqYoSzOmyPG+sFmC5OKUhSvCjVlAbnKMQyPqxLn+bpsbTNHCCy8NPXtzpQOIHJ72kJZu BgkxLYa4TB5tnaG+HCsx/PrjAlIXcI3hQt8D9AXXSTblcPRL/VrSpDq2FEIkkOKIoB0w 97lQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=0NLA9non3hfpuggNOv1yDGOdH/ERbpvazAJ03IQ67cw=; fh=i1fHfqb3ms9PQICjX9LbYyHHX00fft5d6t57sCy1Fok=; b=PcgEfvl0oV1SCMfECf+V+xhTu0gOtEOiFoCTw4g1Q9w6cGjQ0zk5EMd84iOpmMURGl YDj5/bfBM11ytSjJUMYYPNkBFmg7RwqWNkJ+560qVyFzXMmfNklMZYDpDNqW1mn8r/6C xL6i4qzNYetnSqeLW0rXtis4LP21DpxuBG/1nD60pmuZ8+xiz78+ZvvgZ8rlrQDOYFE1 IH5YJ9On4ZfXz1eqMM7H+7JMwwBIeMfCqvd7ITM/aa/ghyfMlz8zPKR+ME3zEP8K5IBT 0QKocrPr3eRdq5s58Efs7Jq6fOUlDpbka+/z4692dObiDpxBame+0Rc8HGkVWHQpfdq7 Yzaw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Nmf2yNpu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88910-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88910-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y8-20020a17090322c800b001dcad9d9e7dsi4240204plg.576.2024.03.01.10.24.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:24:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88910-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Nmf2yNpu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88910-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88910-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C576B283508 for ; Fri, 1 Mar 2024 18:23:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CBD2A481D1; Fri, 1 Mar 2024 18:19:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Nmf2yNpu" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CABB63EA95; Fri, 1 Mar 2024 18:19:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317148; cv=none; b=cbRc1SOsy4jMcle5DvajSBKLr4sXg/C8At14W53XwLJpAyd6MiI+tXRn2bIVGNtjwB2VTzBtsX9UGcnV+KOgEC3HAR4E11ndMSoW0z+kCCzFNOrjRwE91blMqKzzh73HSarGRp1202I3W4Q53P7vr9H21RY12A/MdTQvKkSlD0s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317148; c=relaxed/simple; bh=tHamsSu2PawSNJB14dKAoQh031PkcNlcqRe8m9+N4mc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=E6S57sNVpi65bDQSUfZqFOHFLQyLL2Y08lKrM8P5464p2fVbxJI6rWC/zf8y8LyRc3K9M6YJlN/u2RrqoTBLcU58PNjT14cHgnhmXT5PeU+9tMocuHPxizT29XheP7T6aPMQVfEOurIt0bJhBnRPBpkaXIJNCEKA+YxIkYfrnl4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Nmf2yNpu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 218B8C43390; Fri, 1 Mar 2024 18:19:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317148; bh=tHamsSu2PawSNJB14dKAoQh031PkcNlcqRe8m9+N4mc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Nmf2yNpujL2CHG661S5q7iJdLcHamibB9G2a5K33DMTKqnxKmm6fOrxxfpnNcBvEr 9bbQdwHvUZ+Ll8fCUX3fvqeT1xX1jbgeYTB6D2Q4wzwFoypR5fldRNdyHL6c8jbhJx 8la90ah2+OOV565Z/3gtGHwQvoi5L8b1mAyVMhKCGZm0wFBCI+h31Hqx6YK/q6y0Kr jL85E0CFl1BRdGtgKrEeTGOW2y7rdbI6lFRzQ0pgDnEmx26WQtWGrHuvYGp8SKMBVh 8BrQRp1CpJxBuIiAz5d8eVyCTHoOT+a2kDscxOU+CWK4449HnDrXvLe652W04zdUQH FbhIKlDKrZUvQ== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:36 +0100 Subject: [PATCH net-next 12/15] mptcp: implement mptcp_userspace_pm_get_addr Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-12-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3385; i=matttbe@kernel.org; h=from:subject:message-id; bh=XPYkNYFkRqDS+13nMn34SF5wNQUL95yNz7wdaGXQ2tw=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl4hv14pbx2noDI54Mo4L2YVHo34EtkFMByEi9M E9TS62MN92JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeIb9QAKCRD2t4JPQmmg cyc1D/9R+4npbNXeI6GHXHnqxjS7MlLAgkJv6RXNzICibMNDOPUQzi/SBC0j8dCMwTka1bOqYCz zSRZOnNKL80pYLxVQ+qgjYYNDoo5NkbX5sRBb4Jp4BdcTSLVC/KcVxdMXqRx7HmSo1swqf7EYs9 GxGHJc3NVLep7oq77qlaycUE0Jq452W46yFrpjvbynf7BgpKi6U6qoTBdoGl7vS+RLnKxFg1rPv hihfxbbAis2pst6aQfi7IjCJlTzyh5v9l2RBBk/m52m9tV7Kq/B99s4pKMe6IVf3zniuAvXlSwu 06+Hox4O1g8uTeGrhZ498TjPW4GI3nthvQ9bg/xrPNWQaKB+dWy8EZh03lMoK8oyD6gBN1Oi4s+ Ae6zq5rIJPLxkqDA3g2WKyPwUCDUNDU8o+8ot7FblQxb0IuoN4NLndvcdwQmk2BAYFDMLl4l4Fk Ks7+Sd6oseNHdk2jMxE3nZPakmHN5Pe+9su/pRBohHHWGB0dBSwiOvCSX1GXmO/CqaHB3HeFYo3 GCRG1xQpKP5GZaRTY21AeQprLZt88xqTnwF2wjBCT/+Y0IKpvVfLUbKL/s1f6Odf2EXNi+k9kzT zGbUA8av9eMv9ZG/INYIFyHEuS1Krz/9MarP4CAOcJ/ewhb2nBHa5+9cSkZtCzGxZElUsX8SUSa rwZzz0pz/6fPSwQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792349273464867318 X-GMAIL-MSGID: 1792349273464867318 From: Geliang Tang This patch implements mptcp_userspace_pm_get_addr() to get an address from userspace pm address list according the given 'token' and 'id'. Use nla_get_u32() to get the u32 value of 'token', then pass it to mptcp_token_get_sock() to get the msk. Pass 'msk' and 'id' to the helper mptcp_userspace_pm_lookup_addr_by_id() to get the address entry. Put this entry to userspace using mptcp_pm_nl_put_entry_info(). Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_userspace.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ net/mptcp/protocol.h | 2 ++ 2 files changed, 76 insertions(+) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 20cbcb62cd8c..b9809d988693 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -638,3 +638,77 @@ int mptcp_userspace_pm_dump_addr(struct sk_buff *msg, sock_put(sk); return ret; } + +int mptcp_userspace_pm_get_addr(struct sk_buff *skb, + struct genl_info *info) +{ + struct nlattr *attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR]; + struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN]; + struct mptcp_pm_addr_entry addr, *entry; + struct net *net = sock_net(skb->sk); + struct mptcp_sock *msk; + struct sk_buff *msg; + int ret = -EINVAL; + struct sock *sk; + void *reply; + + msk = mptcp_token_get_sock(net, nla_get_u32(token)); + if (!msk) { + NL_SET_ERR_MSG_ATTR(info->extack, token, "invalid token"); + return ret; + } + + sk = (struct sock *)msk; + + if (!mptcp_pm_is_userspace(msk)) { + GENL_SET_ERR_MSG(info, "invalid request; userspace PM not selected"); + goto out; + } + + ret = mptcp_pm_parse_entry(attr, info, false, &addr); + if (ret < 0) + goto out; + + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); + if (!msg) { + ret = -ENOMEM; + goto out; + } + + reply = genlmsg_put_reply(msg, info, &mptcp_genl_family, 0, + info->genlhdr->cmd); + if (!reply) { + GENL_SET_ERR_MSG(info, "not enough space in Netlink message"); + ret = -EMSGSIZE; + goto fail; + } + + lock_sock(sk); + spin_lock_bh(&msk->pm.lock); + entry = mptcp_userspace_pm_lookup_addr_by_id(msk, addr.addr.id); + if (!entry) { + GENL_SET_ERR_MSG(info, "address not found"); + ret = -EINVAL; + goto unlock_fail; + } + + ret = mptcp_nl_fill_addr(msg, entry); + if (ret) + goto unlock_fail; + + genlmsg_end(msg, reply); + ret = genlmsg_reply(msg, info); + spin_unlock_bh(&msk->pm.lock); + release_sock(sk); + sock_put(sk); + return ret; + +unlock_fail: + spin_unlock_bh(&msk->pm.lock); + release_sock(sk); +fail: + nlmsg_free(msg); +out: + sock_put(sk); + return ret; +} diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 69338a6c040f..bf708ddbef5f 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1047,6 +1047,8 @@ int mptcp_pm_nl_dump_addr(struct sk_buff *msg, struct netlink_callback *cb); int mptcp_userspace_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb); +int mptcp_userspace_pm_get_addr(struct sk_buff *skb, + struct genl_info *info); static inline u8 subflow_get_local_id(const struct mptcp_subflow_context *subflow) { From patchwork Fri Mar 1 18:18:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 209053 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp96563dyc; Fri, 1 Mar 2024 11:10:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV7GrHOwd2+0ZItGUsB7N/AdQLgquSz7QTWxLa1dmT4iJh3bMHBGNffeEUSz4TB7+OjqMO3rqIgRLDLBU/gDwSZyC37SQ== X-Google-Smtp-Source: AGHT+IH5z0gZmLoWlZ90CBU/t8g2tTP6RUW28kTbzkTim++iJtbCzZ0eGSEeyBvsZfsqEFPmNhBB X-Received: by 2002:a05:6a20:7350:b0:1a0:ecac:ebcf with SMTP id v16-20020a056a20735000b001a0ecacebcfmr2842404pzc.32.1709320209335; Fri, 01 Mar 2024 11:10:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709320209; cv=pass; d=google.com; s=arc-20160816; b=V19YKtG1sZds944QZOasrlJ11IbhtWVUX83JtD23ILLUAvAMY+ERDrmIYAJqqhqjVM prox+ASwXsw/xWgewa4Nvf0w9i/DvUrCo3ULXJp9OPxZCRNM28ga67JtqSZYP1nzNtwf tDCEAzt24VNkqpuQqqHYu62jfAFsjxX75NYw98SGh6K/WeGi1NjtIE2X4ewg/7EPVU7Q lAFK3VGMTB9ua8BD8an3M3csandLgWMvY35t5y6p3ggPFO3lg9AH2FN57PyOY7k5/vho qsGrKxsZXDjGMlfkuR4sDTGoeF8syidlOQNOvFCRe7xl5RVK7BORbYW7+++6mh+mIZRZ voBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=c0khZuA67325wgarE/NQfuExiIdJdkGr9H3B3oZT+Jo=; fh=i1fHfqb3ms9PQICjX9LbYyHHX00fft5d6t57sCy1Fok=; b=kntlqZY0ZlhuqiVuV24ICyKXQUc/R6/Fw4BD/Sxgh4HujFCLfTqVE5rHZ0NeLtS85t vyK2JCYyMOZUl9ucmJ4hS+JYLLtJHOYIsnIhw1vtlzr53UGoOvR7OO863PlbrOo/PqAd +viPdiwHi/1ohQ/8Kxv2w00YK036/d/u/ksjuyArGHbsEx25ssT7BShI8+M66HzJW1eU F8C8GVmHxZUMzcID1KYT2XOihDNoialQjj0ZFAtuVQuBnxlFjZfH/q44idNlxeBjghdM RWYlwcpnf8s8HnJD0HIeo8e2APuQfxRqDRME+kRSDLinqjyQdBapnr/xsklkwXzLp6xU xqZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mb6KLFwz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88911-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88911-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s8-20020a632c08000000b005dc3e74657csi4027661pgs.478.2024.03.01.11.10.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:10:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88911-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mb6KLFwz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88911-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88911-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BD66AB25D40 for ; Fri, 1 Mar 2024 18:23:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BF5B6E60B; Fri, 1 Mar 2024 18:19:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Mb6KLFwz" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 275EB4AEE3; Fri, 1 Mar 2024 18:19:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317152; cv=none; b=ZQjz1YaVihHjOCPmZ1iW2NeF4x3YVIDzorCSCSUvID/1l4BbC/zsPfdy2SvoWP4VcjiR+fTFHzo/LIAW5oMjH3EePStf6kjEvKc8LoTxNYlaF89GzDLaPcNf8FwNr7/pP1MPqI5YHbPj2s0TooDBsAsRn/gT84S/IEJPsfSniVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317152; c=relaxed/simple; bh=ftxWlvSkyud4JIR0kHVv+D1eaBJrq53jEN4m1t5wNmg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sPdgjcUsXNew2IZ/HYw6FUvO5bib3L7QFuPOyRg2qJ+0iw/xpha3MffVPCHdtyHzy/9S2TTcJoiVbQL12C3d2u26yZDgBvUiqZGvAFuUw/LwtOTB563kDsiFCNUtte0+vwPgRAymP0dwalRpG+HW+jXvjq/NL5yMuSHYVfNk7sw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Mb6KLFwz; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 277E9C433F1; Fri, 1 Mar 2024 18:19:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317151; bh=ftxWlvSkyud4JIR0kHVv+D1eaBJrq53jEN4m1t5wNmg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Mb6KLFwzppaCk202Z4xfKBuoC6NfaivMwcKdi1p3avxGd7G2Y2Z2/B5OGYsMFf2Ej /A5JiNvdKXfgqTsQ/S1wQCeNjuKWEVntw5scRK6UpDe3FsJk+j7dIX5ai3k+RshQgx JUU/qXmQLd52J0cULQ+5vSTaApPlAgXMQTJQxBmNSop7lKgTl6onYkL0X4+d46cRqr i06ee2kzEXKCYB2H0aAYOIsQgdeikxTABbWyJqNtKOAii0Uo7MKDLs09X8tMdaxD/8 2hWd/iGzpWURgKozflsVGDyj5GedLgO2948kdBVhvLm5+8ZJIibq3Y6eWu/uK2V3T2 V4F4nm7rJ/0Nw== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:37 +0100 Subject: [PATCH net-next 13/15] mptcp: get addr in userspace pm list Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-13-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2919; i=matttbe@kernel.org; h=from:subject:message-id; bh=kWrNtSIvcuktz5WQJgULwtb+VPOtTG0YHa/xJdB0O+E=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl4hv1HEblhPOiq8/DzZwl5AJz9GirvRxq3Ajkv IFLOmauDk6JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeIb9QAKCRD2t4JPQmmg cxeDD/98ij393Txa86ah0ySNUhx1S1MCisDTw8MC6dA6Aww4ElVxTDCH6xtIq12foeWKibFHoKn G0BCLgbDyCS8slPnw/oSvfq/1tKx7OJTYWq0R9IbSb11/E8HjJ3qOe81pO1SMZ3NXwJy30pZNe0 HE+1E9+nY5TaPZAZ8KKjyiHMLkueEZZpDBF5ryV92kyU4Mdz+GZyzYM+1ph3bjINxSVB4mcVZLN Bjl2MU0oYvYVEOWpBssxZ+j1Fdw1a10E3lHGZPjmhZs5ztfBbamVfJC4JloiO5ktuLYqIYsAilP E7mq+xs/pNIzUBz3hKEDzvBMxdWoza74HiHVTtxF/QJthPKofaxe0uoJAMf7LCmvQDuR+vDpuXD 8SJ7qf6g6MI/CtxzF41ngRy3neAE7mgzN1hdG2G2gYyQIDu1KHg7cMv6ivHeBIebJTjMTSn/8Y+ f7FbtNlB0WYMqpoBBLGQh7Xznzhd5kFVtF6YwO58jW6INsZNstVrIq0GZ8pr50WyCWJRYQp6iXN K5cAv2EGHwoU1hdsYrEgBTJNgs1RYtPnOF7cx+fMAh7taQvz8W50lOsGK6dxzoWA10NUVyJND5M K64kAksDd43UDaCLABF3BI5txGTN7Ydlgr1pDi9Es9FgTXa5g4ybSDZyZKGSpBeR2J4139QC5EW iOCFZHVjGp8lBZw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792352147585154945 X-GMAIL-MSGID: 1792352147585154945 From: Geliang Tang This patch renames mptcp_pm_nl_get_addr_doit() as a dedicated in-kernel netlink PM get addr function mptcp_pm_nl_get_addr(). and invoke a new wrapper mptcp_pm_get_addr() in mptcp_pm_nl_get_addr_doit. If a token is gotten in the wrapper, that means a userspace PM is used. So invoke mptcp_userspace_pm_get_addr() to get addr in userspace PM list. Otherwise, invoke mptcp_pm_nl_get_addr(). Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm.c | 7 +++++++ net/mptcp/pm_netlink.c | 7 ++++++- net/mptcp/protocol.h | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 193198cec74a..b4bdd92a5648 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -441,6 +441,13 @@ int mptcp_pm_get_flags_and_ifindex_by_id(struct mptcp_sock *msk, unsigned int id return mptcp_pm_nl_get_flags_and_ifindex_by_id(msk, id, flags, ifindex); } +int mptcp_pm_get_addr(struct sk_buff *skb, struct genl_info *info) +{ + if (info->attrs[MPTCP_PM_ATTR_TOKEN]) + return mptcp_userspace_pm_get_addr(skb, info); + return mptcp_pm_nl_get_addr(skb, info); +} + int mptcp_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb) { const struct genl_info *info = genl_info_dump(cb); diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 5fae35b6b305..16f8bd47f4b8 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1672,7 +1672,7 @@ int mptcp_nl_fill_addr(struct sk_buff *skb, return -EMSGSIZE; } -int mptcp_pm_nl_get_addr_doit(struct sk_buff *skb, struct genl_info *info) +int mptcp_pm_nl_get_addr(struct sk_buff *skb, struct genl_info *info) { struct nlattr *attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR]; struct pm_nl_pernet *pernet = genl_info_pm_nl(info); @@ -1722,6 +1722,11 @@ int mptcp_pm_nl_get_addr_doit(struct sk_buff *skb, struct genl_info *info) return ret; } +int mptcp_pm_nl_get_addr_doit(struct sk_buff *skb, struct genl_info *info) +{ + return mptcp_pm_get_addr(skb, info); +} + int mptcp_pm_nl_dump_addr(struct sk_buff *msg, struct netlink_callback *cb) { diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index bf708ddbef5f..264b73a8b48a 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1047,6 +1047,8 @@ int mptcp_pm_nl_dump_addr(struct sk_buff *msg, struct netlink_callback *cb); int mptcp_userspace_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb); +int mptcp_pm_get_addr(struct sk_buff *skb, struct genl_info *info); +int mptcp_pm_nl_get_addr(struct sk_buff *skb, struct genl_info *info); int mptcp_userspace_pm_get_addr(struct sk_buff *skb, struct genl_info *info); From patchwork Fri Mar 1 18:18:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 209007 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp66853dyc; Fri, 1 Mar 2024 10:23:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXcwK7HnFV5X9hCoWMnmMCDMsFJ+MnzQT3oVOf5uekjRZS5jJvCYEU4o03bKMT9nQuFXBn+5mhmkQCqGkVCqaADUfFZbg== X-Google-Smtp-Source: AGHT+IEnK9zH/3Lr87StMxDSlY/iDfcaiDppRfgAOU1i3mTQmDzzVqhZM+l5BbFekPWUzJR7SXcF X-Received: by 2002:a17:906:8309:b0:a40:46f1:7263 with SMTP id j9-20020a170906830900b00a4046f17263mr1650626ejx.22.1709317435152; Fri, 01 Mar 2024 10:23:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709317435; cv=pass; d=google.com; s=arc-20160816; b=PIgsvjUK9MTqbFxRLu4hPVrZM93AgYscexco7sL1WXJZGVRuRXx49NSw9tAByHoHTI iSB9xR2ab3i0ffdKe96Bf4PdYbEufeDkPQYp/FHQFyByupZPz/QP+5qKMpWqLm5V3+hD tqbjvQypRvBJc1cuJEZehpwZRbl4XjwIaXvSVnni471x2ldeESChsELRGnhFvS57wQZa PMG05z5qNK4x6hYgWm5tKM/x3dIBf3C/Ks2sDXVq/g7QeIa0czp2OA8A35c/YwketIhi JvOiOpkdAx6qa0uA86kcAR+S9v8xxHcC/PqYwu9fGmNAq3urIOVjBX13wpXz+mIZHO89 Yepw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=U9I3MFQcStiTE3S0U850JPa9KMQ5Yi4QM+RuSIJQTzE=; fh=i1fHfqb3ms9PQICjX9LbYyHHX00fft5d6t57sCy1Fok=; b=AhXewmX3Kl5C+BvLR1wT4ef5B/UeXtwfk3FmE+Pqb9QtXB9DpM3CfYinWHg22RkUYC okhmIVTRP6Td6f5ppngUvWdYOwc8zhsEf/lomfhDr9d6yLRvVZszjWTBN3fICRUDbRp0 XBm56SoFJ1X0EanSxYYb+4sM5sF+ofBvhnLSTBZ7daTH/luLYFw1Z7V14TOPGUmWQYSL MoFtMfs3qScxNgccSohDR5urS4+A8rvJLe19KCpdBBokK+I1WIf+o86JoBTnYK8sxLiz orgsBHCl1tpHmxDf18NIX6xg8C0FoztrpBYWCpUCnbz4koQl9TlzaWmJZpltZY2XBJkL O/4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Bgu1pkY6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88912-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88912-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id r18-20020a170906a21200b00a441c25379bsi1687094ejy.538.2024.03.01.10.23.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:23:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88912-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Bgu1pkY6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88912-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88912-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C134F1F2290D for ; Fri, 1 Mar 2024 18:23:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 853B870CC8; Fri, 1 Mar 2024 18:19:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Bgu1pkY6" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D7236374DE; Fri, 1 Mar 2024 18:19:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317154; cv=none; b=DqkDTcsa15k8SYLTZHfKVHLryjsCN01CmwZskXLTgDoTHjo4CzDwgIevwBQ2rQN+Msth+JcjXm+Goad9lMRIZ15fzkyIowApotodMeGESjrWuESXTBvEwcA52ESFRlxKCOVmjN6hA3hsDVITnRq04cMHwrgwEybSLL1W1zKd8nY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317154; c=relaxed/simple; bh=LKKRXAQDeznSeSGZgyri0Elpb067Wit+9V4bsKMplLc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e12ZxbHiBYRqeRCxWzO4dD3yTbBWfltG+Gmfswh0+EjmpVCaVzdyb+hRK6ERtROnO5pOXlFuNhN9PRMbP5/R7bSV+S/OUVZ79dlSX6rdjWEGylHfFm8K0eoiOuMtBBJ3W6LhXkehftDwtDykpyHqbQZ3O3D3/04QRTbs4MbLTJU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Bgu1pkY6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F2BEC433B1; Fri, 1 Mar 2024 18:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317154; bh=LKKRXAQDeznSeSGZgyri0Elpb067Wit+9V4bsKMplLc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Bgu1pkY6lZ6lRn2NgOtPV9HYjnrFLWERcd9B5JaN13TVJOA4P5sQZlXgq+Dn98bqL SqkCe0NDTTaxHtKa2FDW9SwT8L0y1UmjbamwsZFmFVp8yIuNXgsvf4FZHBBejorBXS gMaBbDCXCWlPzzG+hZY1wuUgv3fkd5BhI0BK4HnAJzginYpQ7m9kt+wxzZTrsEBLUX aTmK19TABHJ25ScQj1CprwqPBwt/nRwgarcusqceT/X31/0fh1u5AEBqSOgvQH75vh a0nKaCu9isPwO0Vx7hmQIaaf47PEOeHuaelAgTnf5RUhQT1knM0uV6dci2YdKEoe2M vk8go7aXKbLow== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:38 +0100 Subject: [PATCH net-next 14/15] selftests: mptcp: add token for get_addr Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-14-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1985; i=matttbe@kernel.org; h=from:subject:message-id; bh=GwkN08kvH5E6tSspi17jY2/Q58omi0RtHA/WgsW19NU=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl4hv1MjKGD1qufgkowxU4PO2oA/hN4gMeRs9B2 8Udijpb8ZWJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeIb9QAKCRD2t4JPQmmg c334EADiVT85vg+jS9bXT/9r2CIxGWnoWrNijo0prhSnSVYQP53jn82GAfHTh8AZk4/Td4mUaeV clzpaBipVM+WcHgjfZXiAkScY0V1JX9Hz7ASobo5ladJRaEWbRThX+6OH5iniTgNSw1Her0QTLU 4j//8rmlH4YpX2XPm8myBXcYGX8rMZIFpWDWjQIqpNkNKhkPsMry0KFT92T1aZN+OkT4iH9JDg0 NqPmv+kb66o6gP7wlPHrPvdy0S2qL5G1b604EgsZa4LWJDLUkafYKGa5IJ1Gwo5zF9XLPgUZHsa mDpUY/glAFkv/e32DjQQTewUMf/OqH/VGAJV28pqmBNavAiYahEWXJ+4euJIJ9rqS6rnrS6xqhy meg6k9pFutraR+vRHUo/LgXugR8k0Fi+TNhMpYDJ2xAu2Xik1HomdDn+C7R7SeDYddysobo2RoQ 0kg/x45vDtdtaoUhI/zWN1VG/QllWKOyYRsJO1h3FJznZE5/jOASjMX1MV5mi+V9sG3UVjSKQ03 Zizt/DLxptbpK6YUjMrfS2O1K8mabnpHuEP3vH5s0HZJxm/yNUS/VWKJdm2DPrFp/L6gW7rEAs3 Mp9sE/nJTX1Sey+31Hg+g+yXWhlIcEu6qhWHKmfA6LfDn+hshGk5RCH9sIJEVhIcNIv6BAgwc3r kf3qxV+P5nYviNw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792349238632633896 X-GMAIL-MSGID: 1792349238632633896 From: Geliang Tang The command get_addr() of pm_nl_ctl can be used like this in in-kernel PM: pm_nl_ctl get $id This patch adds token argument for it to support userspace PM: pm_nl_ctl get $id token $token If 'token $token' is passed to get_addr(), copy it into the kernel netlink. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c index 8d7d1b4ed28e..7426a2cbd4a0 100644 --- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c +++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c @@ -1087,6 +1087,7 @@ int get_addr(int fd, int pm_family, int argc, char *argv[]) 1024]; struct rtattr *rta, *nest; struct nlmsghdr *nh; + u_int32_t token = 0; int nest_start; u_int8_t id; int off = 0; @@ -1097,10 +1098,12 @@ int get_addr(int fd, int pm_family, int argc, char *argv[]) MPTCP_PM_VER); /* the only argument is the address id */ - if (argc != 3) + if (argc != 3 && argc != 5) syntax(argv); id = atoi(argv[2]); + if (argc == 5 && !strcmp(argv[3], "token")) + token = strtoul(argv[4], NULL, 10); nest_start = off; nest = (void *)(data + off); @@ -1116,6 +1119,15 @@ int get_addr(int fd, int pm_family, int argc, char *argv[]) off += NLMSG_ALIGN(rta->rta_len); nest->rta_len = off - nest_start; + /* token */ + if (token) { + rta = (void *)(data + off); + rta->rta_type = MPTCP_PM_ATTR_TOKEN; + rta->rta_len = RTA_LENGTH(4); + memcpy(RTA_DATA(rta), &token, 4); + off += NLMSG_ALIGN(rta->rta_len); + } + print_addrs(nh, pm_family, do_nl_req(fd, nh, off, sizeof(data))); return 0; } From patchwork Fri Mar 1 18:18:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 209010 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp67124dyc; Fri, 1 Mar 2024 10:24:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW+3puCkSxS5PJhOUAIx3tmOS/7bb82Xuiaw6b0dH1ec2FJWkw3+FA/cixdxwFZPmTymfRLc1mNEfh3ppKV3m8ehY93Ww== X-Google-Smtp-Source: AGHT+IHrNYe+MzZ4zV25zXwnmu1czboiWSZm1aHK4H7iQ2q2cLLg5BIXZVPsygNmyvWpHaCLstlB X-Received: by 2002:a05:6808:1315:b0:3c1:9c6b:c50b with SMTP id y21-20020a056808131500b003c19c6bc50bmr2903906oiv.23.1709317452597; Fri, 01 Mar 2024 10:24:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709317452; cv=pass; d=google.com; s=arc-20160816; b=HZ7Z9eR7NWOr9usPsTdIATB/7PkhKjeOHBf4yZLSUxgqtqtixrA3Hcu4ZNs5rktbuR svdg8/F3bnNIAl1p4+/ylBOoLj3qfV/KXhUypB4bwbJweLmWiqIyOj6SI73yISIuc1zY 2LYEZzsP+hZIErHyOmAThRo1pONooXF/0lv/fB/yvhCrMxYnKp36o7crkiCZgBUx0AY/ aYuMl0ll4xLoWpXz3tmlH8ix0RgIYYP9Z+3ira0guGvdQXultCyDXj2c8vNfmCj5eiQY p38ffPTz4tqGW26G1/hHtSchV9bjgwnwOz2W+CW6KmE2NijA0GX3qdtlPMHw5h+Mn5l8 zeSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=8+wODhxL4rmqRmibYMcOVdS/DXGIaKX1BzGuC8lJXRE=; fh=i1fHfqb3ms9PQICjX9LbYyHHX00fft5d6t57sCy1Fok=; b=MYoImH1iouYWoS7Yo2KbJmT2iZDchmBiSgTbI9BRaAHC0l8b8SRxGNMsQo0nq44GT3 TYKWCAcZxByr4b3s/3naRDpkvhLfbjS4tK+MOPYh4G2MYQ2QGtctPk8Ma3EYUKXBnZ+F 8JneB+4pJgMaxdHYjjM2GhqOxfNep9CZFuU6/CtRmOk/DDx9Oqi8Nt0TBYvZ0pua+3sU d37GQgle2NQt4B+GnQfcLpODuqXmLZk81jGOWDTfYGMYevP79lJx0q47RY2XQ1ZcxPnH mngSdYtBwirvUzX8VZ8MW635+wy88MZPhytbztXoizv35j+UvV/CQhgpHqMaAiUZdtaK e+aQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PhKTFL77; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88913-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88913-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id m11-20020a05622a054b00b0042ea5a9fcabsi4306007qtx.142.2024.03.01.10.24.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:24:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88913-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PhKTFL77; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88913-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88913-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 53E5A1C24703 for ; Fri, 1 Mar 2024 18:24:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9F1F71B37; Fri, 1 Mar 2024 18:19:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PhKTFL77" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 32645374DE; Fri, 1 Mar 2024 18:19:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317158; cv=none; b=QNwSy7AQwxxhfSBNnlSCvL8Dk7QYMpAq05kToTVyL770+2aabMRTidlk9gqqIDfNphRxpvo9/5VRHsUF1f1NmqAdUO6pou2pHqq0Ztko/AvgdPSmKXo1ueLad9e7i7xGw4K206ylHIGyyV/5o6u6+bBX/oe7C9tOEIos4G6OeYk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709317158; c=relaxed/simple; bh=+pDePtaqyPSYmYXRLXh31mTRlvMwA70fqaLVjgNNISs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FhKU35j+aAuUAYfTHmFErUOkOb6SHgV9Pd2fjf3RJFJTTrrhqzo9PyDJ835d9MKLWSaL/I7YriBVJu2sAiLE9zU5TIcEaLhCL7XA9gQuowj2XjcL1azrTL/h6l7qKfcAd/nledeXOOoU3IY9/0Gag+Ex5GCjMZKjHl2dbwsk5S4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PhKTFL77; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34BECC433C7; Fri, 1 Mar 2024 18:19:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709317157; bh=+pDePtaqyPSYmYXRLXh31mTRlvMwA70fqaLVjgNNISs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PhKTFL779Bn7mIEWdDk7sEaRkvo6OREWcxIY63SSo13+70eq/KbXwUTYrAm7d/3bZ wZoAisdFmhBdAh11LbJ8gU9jQ7QQtj/7p3X37FPli9gNewWBl+dUlYqgnFDMD7lz/I yAEF3Fsbwmx12RdKjDaTxyy/8nh4CuAIj/Vi7zOEjgy3a8IS+SdYAtIEAgv4m20327 0+69ubs/sPazslCEYQhoU5e3SgAqFz053rxCnFaCc8YflhjGP3pS6n9QT7vPexR3uz RNOnx0JFNeMwF6W38uv9ePg4zgVkUHzBPhzNA9nCuARKvvy4QEtSZAZEQx7/cBGsll gKfBQYq25w5cw== From: "Matthieu Baerts (NGI0)" Date: Fri, 01 Mar 2024 19:18:39 +0100 Subject: [PATCH net-next 15/15] selftests: mptcp: userspace pm get addr tests Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-15-dc30a420b3a0@kernel.org> References: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> In-Reply-To: <20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-0-dc30a420b3a0@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2462; i=matttbe@kernel.org; h=from:subject:message-id; bh=Uhj+aOKv+ybe2ZbgME5KF3r9u5aVSPj73T6p8b8Xs1A=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl4hv19aV6XjWIlYJ/0F0CCJ+Ls1W4mwW7X7/wn 3yn/7sEK3OJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeIb9QAKCRD2t4JPQmmg c6mfEADTCCxrJQVDiE19OVgNtcbK8ZWAtF87D0kxuaE4RUDo4GlCx71csx2vxwdr9mAPEHfSXqC Z+aVSPLohzdJZHBDVUd7UE/znABjQJTvx/pCy9o6vTmOTQb5Cewx+0xehXHZsISmo6am9PszHNG Xbf18CyEGUPvi/s23gF5P+UUkokSAd5bORywT/akRMI26RRNKDRQ++BMBPypJzwE5e/vYvZLLlx aqEfihKFIZIH80evCHeE4Df5LEAU1P2Qx5KjB+f6GACFVR9VXnljGOL/UEYCVnjdSeVB4sROiD2 x5s2Kh9k1IyvniN8ZuUiXjXrAx+wWF8dpPJQvGBuhjnWZc12I3G2XOABuULefrFwIGJMP13lX5u jTQCH9Gw6jYH35JrlDpSMlJGuBxFAmEIQAcB/HxLXG4xJpoPveHMghGGrCNQ3v/5icGNsB0x5pA gelkkthBgvQJWAzDxcI29rh734dpjemDgm8oE77z4ug5G53iDJr7rVfRVl4kmZ3dxE1qAxJ4ehi 3JIgoN9RP1kJS9nwldJ8nc9hiB2eOm5Y5bH1pg0PRETkxvdRItvoHUFXYJfC9xWOlr6C3tO/z13 I75W+WAcjddkSxDHoTt8kglGLgO5whSBNiERmWkAGfAtv+5EnhtUoKm+6b6RNttMTvVfQb75bxp XDuyts/BjE9tHQA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792349256934725575 X-GMAIL-MSGID: 1792349256934725575 From: Geliang Tang This patch adds a new helper userspace_pm_get_addr() in mptcp_join.sh. In it, parse the token value from the output of 'pm_nl_ctl events', then pass it to pm_nl_ctl get_addr command. Use this helper in userspace pm dump tests. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 8b6430642706..955ee651dcd5 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -3388,6 +3388,18 @@ userspace_pm_dump() ip netns exec $1 ./pm_nl_ctl dump token $tk } +# $1: ns ; $2: id +userspace_pm_get_addr() +{ + local evts=$evts_ns1 + local tk + + [ "$1" == "$ns2" ] && evts=$evts_ns2 + tk=$(mptcp_lib_evts_get_info token "$evts") + + ip netns exec $1 ./pm_nl_ctl get $2 token $tk +} + userspace_pm_chk_dump_addr() { local ns="${1}" @@ -3403,6 +3415,21 @@ userspace_pm_chk_dump_addr() fi } +userspace_pm_chk_get_addr() +{ + local ns="${1}" + local id="${2}" + local exp="${3}" + + print_check "get id ${id} addr" + + if mptcp_lib_kallsyms_has "mptcp_userspace_pm_get_addr$"; then + check_output "userspace_pm_get_addr ${ns} ${id}" "${exp}" + else + print_skip + fi +} + userspace_tests() { # userspace pm type prevents add_addr @@ -3497,6 +3524,8 @@ userspace_tests() userspace_pm_chk_dump_addr "${ns1}" \ $'id 10 flags signal 10.0.2.1\nid 20 flags signal 10.0.3.1' \ "signal" + userspace_pm_chk_get_addr "${ns1}" "10" "id 10 flags signal 10.0.2.1" + userspace_pm_chk_get_addr "${ns1}" "20" "id 20 flags signal 10.0.3.1" userspace_pm_rm_addr $ns1 10 userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $SUB_ESTABLISHED userspace_pm_chk_dump_addr "${ns1}" \ @@ -3527,6 +3556,7 @@ userspace_tests() userspace_pm_chk_dump_addr "${ns2}" \ "id 20 flags subflow 10.0.3.2" \ "subflow" + userspace_pm_chk_get_addr "${ns2}" "20" "id 20 flags subflow 10.0.3.2" userspace_pm_rm_addr $ns2 20 userspace_pm_rm_sf $ns2 10.0.3.2 $SUB_ESTABLISHED userspace_pm_chk_dump_addr "${ns2}" \