From nobody Sun Dec 22 08:26:51 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 B40F21D0BBE for ; Wed, 2 Oct 2024 15:02:13 +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=1727881333; cv=none; b=nkhnxF8yZz07dqdOQj8fDXLfr2CV+jke2AjUyeD+UdPVWmBKUz2TAy0cMAnn/h0acLKPMVPyNQY4eU/5lF6xQ4q4DQ4uCWDA1MVqdUOWDOdq6jLJmnjkZ3i1MX3lYaJLav03cfDErOeHUb13LK0kzwCfAY7R1cAAXtbFTAJFOrs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727881333; c=relaxed/simple; bh=x5ZDptBZP7lvUt5corPdiXuOHk/QPqpKMiJOvNlcDto=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b6reZt82Wxt/x654WtctG7LGSAEWywylc6oyZIQXzjXEo90n1iqQB9+NbQjDkB4IrdankX6r9zvD8qmmaiHcpG/LRO5qkTQ8l7QASGKBo6UN2T2HS3uoJnlR8W2aY+8btLJHIp6mTqg4fXHUX4VK3uKEA3zglIlSbjOg9QsaD+4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Rr6nDfLI; 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="Rr6nDfLI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9E31C4CECD; Wed, 2 Oct 2024 15:02:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727881333; bh=x5ZDptBZP7lvUt5corPdiXuOHk/QPqpKMiJOvNlcDto=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rr6nDfLIP5A5jtTPrCiZBzZ0HQayBwSHniQxyqyAPsPw1/+znArHCUefLao2Q65e7 DlOxpjtmJh/kU8FEC2NrEvsP4idGntmiPVZVLyIHIaX+2XWWYIps6K4BWnag3e3Vhx QGCb6/Yq33Y0mtlNFPs2/ffqfUovZYoXTGFcdvp4KyNhZ5KFueHnxDPcGxBej2UVzt Hfss8y8P/hQpXrfFF6sPgff+gwH/4L5aN2xcjhhwhi1Vbx5MTBAZMiBHGn3cDzdE/J 4EClxQhtXEAP+Dty9ElybDWfql3TFIre2iFQC9y90jzNPaKFvhkCW6SaulM4orT8MS exOs0M/YmYSXA== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v2 6/9] mptcp: change local as mptcp_pm_addr_entry Date: Wed, 2 Oct 2024 23:01:56 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 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 Generally, in the path manager interfaces, the local address is defined as an mptcp_pm_addr_entry type address, while the remote address is defined as an mptcp_addr_info one: (struct mptcp_pm_addr_entry *local, struct mptcp_addr_info *remote) But subflow_destroy() interface uses two mptcp_addr_info type parameters. This patch changes the first one to mptcp_pm_addr_entry type and use helper mptcp_pm_parse_entry() to parse it instead of using mptcp_pm_parse_addr(). Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index f4a4fa465136..9ff441beebe6 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -463,7 +463,7 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *sk= b, struct genl_info *info { struct nlattr *raddr =3D info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; struct nlattr *laddr =3D info->attrs[MPTCP_PM_ATTR_ADDR]; - struct mptcp_addr_info addr_l; + struct mptcp_pm_addr_entry local; struct mptcp_addr_info addr_r; struct mptcp_sock *msk; struct sock *sk, *ssk; @@ -480,7 +480,7 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *sk= b, struct genl_info *info =20 sk =3D (struct sock *)msk; =20 - err =3D mptcp_pm_parse_addr(laddr, info, &addr_l); + err =3D mptcp_pm_parse_entry(laddr, info, true, &local); if (err < 0) { NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr"); goto destroy_err; @@ -493,35 +493,34 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *= skb, struct genl_info *info } =20 #if IS_ENABLED(CONFIG_MPTCP_IPV6) - if (addr_l.family =3D=3D AF_INET && ipv6_addr_v4mapped(&addr_r.addr6)) { - ipv6_addr_set_v4mapped(addr_l.addr.s_addr, &addr_l.addr6); - addr_l.family =3D AF_INET6; + if (local.addr.family =3D=3D AF_INET && ipv6_addr_v4mapped(&addr_r.addr6)= ) { + ipv6_addr_set_v4mapped(local.addr.addr.s_addr, &local.addr.addr6); + local.addr.family =3D AF_INET6; } - if (addr_r.family =3D=3D AF_INET && ipv6_addr_v4mapped(&addr_l.addr6)) { - ipv6_addr_set_v4mapped(addr_r.addr.s_addr, &addr_r.addr6); + if (addr_r.family =3D=3D AF_INET && ipv6_addr_v4mapped(&local.addr.addr6)= ) { + ipv6_addr_set_v4mapped(addr_r.addr.s_addr, &local.addr.addr6); addr_r.family =3D AF_INET6; } #endif - if (addr_l.family !=3D addr_r.family) { + if (local.addr.family !=3D addr_r.family) { GENL_SET_ERR_MSG(info, "address families do not match"); err =3D -EINVAL; goto destroy_err; } =20 - if (!addr_l.port || !addr_r.port) { + if (!local.addr.port || !addr_r.port) { GENL_SET_ERR_MSG(info, "missing local or remote port"); err =3D -EINVAL; goto destroy_err; } =20 lock_sock(sk); - ssk =3D mptcp_nl_find_ssk(msk, &addr_l, &addr_r); + ssk =3D mptcp_nl_find_ssk(msk, &local.addr, &addr_r); if (ssk) { struct mptcp_subflow_context *subflow =3D mptcp_subflow_ctx(ssk); - struct mptcp_pm_addr_entry entry =3D { .addr =3D addr_l }; =20 spin_lock_bh(&msk->pm.lock); - mptcp_userspace_pm_delete_local_addr(msk, &entry); + mptcp_userspace_pm_delete_local_addr(msk, &local); spin_unlock_bh(&msk->pm.lock); mptcp_subflow_shutdown(sk, ssk, RCV_SHUTDOWN | SEND_SHUTDOWN); mptcp_close_ssk(sk, ssk, subflow); --=20 2.43.0