From nobody Sun Dec 22 03:27:38 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 A5E7D18BC1C for ; Mon, 7 Oct 2024 10:53:39 +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=1728298419; cv=none; b=KAz/XU5W3I9NfNXiC8YmlsqpNjaKefsaehquu+ZEfaWzY1DqPzZSBD7n2MIwkUf3Qv3IBC/oMhr/IPp1SJn/lOx88v30H0nstrMxvg3bxkG/Lz5mQkXq2uEXcj+EeNVVOPcD92Ocoo/7EdKdQFDcV7RDym49eqbx5CLQ1Qf//JY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728298419; c=relaxed/simple; bh=VCj8skfMlHHGk08KV+De8lYpKM477DBc/su6MnYOkL0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TXrtSFOR7BuZvLrV5OSwzJLz2AY8rkAT7EgF2Kd7wtg1KY4QhFQeMr906WUh8w8wW2wb/9uLWRxt94xatR3/F/VUQAtJfaEoTDkAyzeUIRiCD7IW1zQlyb5uesUw7QVkJ5sGCd7hKGJfqXF1WgwPL0HmTy48/lEulAV6pi4QNyY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fvYdbNEa; 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="fvYdbNEa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DF39C4CEC6; Mon, 7 Oct 2024 10:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728298419; bh=VCj8skfMlHHGk08KV+De8lYpKM477DBc/su6MnYOkL0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fvYdbNEapQsQbGPh7kCl7NXcTShIFEAvkzt3HaStQWtOk2KNfa3+JdMqsan6qy3EL 6WB0aW/D/j56u7p8V5d5qj1mzz9HK4aP1r3iAL9zA56yCD95G+9BeaRGvG2QD0/iqJ ZN2RzxEKwE0uFjPwqvo6IWAt7Iih0ZHSdYoP37N3HfQDIjjj/dZlOlLZMtv9wDPVJQ N1dBFkVrVyfGz4jW2RvAFO6bjdUL9FQs6y2kGYqse6W5FzP+UjVQmsZgbzzd446rVK tk/TePdg2C/9a7G9NY9yp50TBhBsSlPoCkjCxG8FRl8oAMYE4eyUki/oFs8OZUbfVX A/03AIvkkV6gg== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v3 07/10] mptcp: change local as mptcp_pm_addr_entry Date: Mon, 7 Oct 2024 18:53:19 +0800 Message-ID: <9e69cd9e599a65f6f0b69d56e65197bd15f4ebdc.1728298100.git.tanggeliang@kylinos.cn> 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 3c5591af0a80..5d6801ff48ca 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