Message ID | 20240301-upstream-net-next-20240301-mptcp-userspace-pm-dump-addr-v1-8-dc30a420b3a0@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-88906-ouuuleilei=gmail.com@vger.kernel.org> 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 <ouuuleilei@gmail.com> (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 <ouuuleilei@gmail.com>; 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)" <matttbe@kernel.org> 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: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 <martineau@kernel.org>, Geliang Tang <geliang@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Shuah Khan <shuah@kernel.org> Cc: Geliang Tang <tanggeliang@kylinos.cn>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" <matttbe@kernel.org> 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 |
Series |
mptcp: userspace pm: 'dump addrs' and 'get addr'
|
|
Commit Message
Matthieu Baerts (NGI0)
March 1, 2024, 6:18 p.m. UTC
From: Geliang Tang <tanggeliang@kylinos.cn> 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 <tanggeliang@kylinos.cn> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> --- 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; }