Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp465958lqg; Fri, 1 Mar 2024 10:23:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW2wZsexSXrgolceoXo/6AUxCtFIHapws10Ojk1NrXL8rlQkHdpr/TlCU3WGnUnmLFPyh6f9W1I/mkikl6n1oKoF4xYKwvvw0yfWJwB6w== X-Google-Smtp-Source: AGHT+IFwxRSYoT0VwQvQf2hsxy0zkiOp/T1Od1t1p9Tj0QBM0TeNy8Jo73pomAdHcJ/+lUkToBwB X-Received: by 2002:a0c:9e9a:0:b0:68f:6c38:c4aa with SMTP id r26-20020a0c9e9a000000b0068f6c38c4aamr2665107qvd.35.1709317408500; Fri, 01 Mar 2024 10:23:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709317408; cv=pass; d=google.com; s=arc-20160816; b=aVqd5goMqO/z7+rNQMfKWD70kAPZSqF6JRXGEtdMvkpurddg1w3Ar2a4hE8ZlW039v 6lPmawk858mUo7oVIKZFwwRNEj4xihj5oJN3Q8dKE+NwejCny78Ts49Qx+3k4AFBR5Ru G+s6Jhn3BY8SDI4PNxXliB/aG2nJdNIE2Ppn8ewQan+1zmur6IwH16E3FxtRux9QcFoB SowOa86XJbebn+ZCEDdfR5tZk/IEXeu4mZgOTMPRilgwUxAeLbKBtkqF6iU6Vz/kVOWM ibs0gdHq/h2ud+AX29goJPrK3raLfbqEEcynwFEKetNAlNsxZ6nQRVS2bvUzspRNF9mR 4qIg== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88911-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 ke12-20020a056214300c00b0068c9dbda5bcsi3953890qvb.389.2024.03.01.10.23.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 10:23:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88911-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=Mb6KLFwz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88911-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88911-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 254AC1C24630 for ; Fri, 1 Mar 2024 18:23:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1406E5F546; Fri, 1 Mar 2024 18:19:13 +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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 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); -- 2.43.0