Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp466093lqg; Fri, 1 Mar 2024 10:23:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVTkcmklZlkbjYKadPh5yLkuIl/0SqRH+ofPeaW69kq86nxjcusMhPyOfnzhIMZd3AY5YRiFHp1SAumZYjdKZHgjhquHXj4tSZaxNReZQ== X-Google-Smtp-Source: AGHT+IHsDU/ZZ36JJwjpFczj6GUetvJSMsYVpnv5+4nIxJ+84Hd5cjC1gDyYjseAY6lZ31/onigA X-Received: by 2002:a05:6102:2ca:b0:472:a200:8e3 with SMTP id h10-20020a05610202ca00b00472a20008e3mr1208746vsh.20.1709317427181; Fri, 01 Mar 2024 10:23:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709317427; cv=pass; d=google.com; s=arc-20160816; b=MRsA6K2XrgbGtnuTXmmb2SLvvBsSj/zk/r8EoRY/DppeP2YngAahPk28xrm5Lq8Mnl 9Zgd9pWuvhomoxf8usYlDqHT285v8G29QWeQyS3Zo4SXMQHCczXQq08jr56FXHlOZqOW hKXHDSlzkQ6BsiLqTUU4dxZXS4WMyI02rX7v6Ocv47SQNIfi2Qq70m7GJvJ8niKh7D/v r12SJtQP1pBRwSdYDhq1QDcCS7ZCkmSbDCoEwrQBDgwGtpJv3McCdhyAw7YvsKkwFsqI oBHJfT69iVGj88ijFhOl68y4nFQ5CYlByY+bAn+Dq9LdDstpm/Pzj3of5nJMvpnxch/I EASQ== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88912-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id p29-20020a056102201d00b0046d3b22083csi658406vsr.264.2024.03.01.10.23.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:23:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88912-linux.lists.archive=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=Bgu1pkY6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88912-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88912-linux.lists.archive=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 614881C24BEB for ; Fri, 1 Mar 2024 18:23:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA82470044; 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="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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 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; } -- 2.43.0