From nobody Fri Oct 18 06:27:20 2024 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 922398F40 for ; Thu, 18 Jan 2024 06:12:21 +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=1705558341; cv=none; b=RuGIJ1mEDqF2wH51iUwTMavfazfWON/9eSDCePNlATBiCMqXLYxvCYKuVj1ca/P9gZlB2oTaJ25Ai+oJcjgEhB08QYB6p8SJCP9l6o58CDkvRWaOAb10fwzu/A+qz3GFDN//D++3ORacNmc9MwVUJhKm2KNbJuJVix1AMwwrMnI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705558341; c=relaxed/simple; bh=o9CBd1NO651N5VsFvB/EA6MeWlTwr2IJgduTHWT6/lc=; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-Id: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; b=Gve0d+JpnFloudV1DN2nYY0Wcra7/mYvg3S2Ee+Y7MdsD6R9+ORBkJqxuh1aurH0UC/4OxB5EbKurG2qNqPfZv1qySXfmogyR8qS4zuEqGPuacvFNcyZkJ+mKTVfFPhywlV0Uxe57Y7lDS235BZxY9As6PugFRIM3/IPKMwk0Cw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KkkrqEtd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KkkrqEtd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48DA2C433A6; Thu, 18 Jan 2024 06:12:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705558341; bh=o9CBd1NO651N5VsFvB/EA6MeWlTwr2IJgduTHWT6/lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KkkrqEtdAD5snK73QI9KS4gq63YGmb0C3om7p+wV1nNZmZt1uq7wqojbmMgYG4m6t ymbQBcsEf3vrdq3qZtIycl6K09MKRXjcd6mhLdkKMloYp5Jnh6iy4WbItP3wMrgQF7 8z6AZzudbfVLRc/746cbSMHu9SVeg1sIxeKPP70tAKTZWxo1tWnH5hDc0893kP5IAS 9vfdJB/fsC/ZRQm4wDdALDbXWCErepK/T8+i6OLl+m7hMFg3b64I++qYu2hy6KlnH4 OSWLxQeqH2+vXYcbyxBEnupfjoo9AKPaw7dmfcann3uE/HYAVwoASndpVMT+OZ/8me DGOoitfbdElOg== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v10 09/23] mptcp: dump addrs in userspace pm list Date: Thu, 18 Jan 2024 14:11:49 +0800 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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 6856d10368be..481f8becc3b4 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); } =20 +int mptcp_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb) +{ + const struct genl_info *info =3D 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 1c3091fc4e1d..6fedf271e26d 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1707,8 +1707,8 @@ int mptcp_pm_nl_get_addr_doit(struct sk_buff *skb, st= ruct genl_info *info) return ret; } =20 -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 =3D sock_net(msg->sk); struct mptcp_pm_addr_entry *entry; @@ -1750,6 +1750,12 @@ int mptcp_pm_nl_get_addr_dumpit(struct sk_buff *msg, return msg->len; } =20 +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 =3D info->attrs[id]; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 6d21223ec65d..0dc3891a45d4 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1032,6 +1032,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_inf= o *skc); int mptcp_userspace_pm_get_local_id(struct mptcp_sock *msk, struct mptcp_a= ddr_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); =20 --=20 2.40.1