From patchwork Mon Jan 6 08:16:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13927037 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 06CB33B1A2 for ; Mon, 6 Jan 2025 08:16:26 +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=1736151389; cv=none; b=D1TV5KloIl8BDDKzf26oVNUPfXIp+0dIKlyEJjfDrA9qAQ2bFPmoR6dE8Ggqf0c2SSI6WP/5wdW0eJy3N4U84wQnMQYBBUz6UK0uqUYuPRt8GzfuL372eKouukxdGxAT7a8EjEV1xncarFHzB4bQRuR0L2h48c5nvkrRPxO7ez0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736151389; c=relaxed/simple; bh=tVvSCQIaFg7O1KP9M1bNplJoAUNRPn6YoKcoASC9WZ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ezaYBdkh8JyRfL0457f0JZYfCtoA9s0yMoGTNn1QBD9PSzehxBnjObET8R+mtFDBaketE9BemIK1sf/VhY8SbyPqrlfOOqhTW93zMm7D6nsccStkDDvvca5HX7G5eywcRCNJXFWhhihMNn1c8vwYGM0eiW80h6hozTJwkOLK2tU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r4yWUUSQ; 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="r4yWUUSQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BE4BC4CEDF; Mon, 6 Jan 2025 08:16:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736151385; bh=tVvSCQIaFg7O1KP9M1bNplJoAUNRPn6YoKcoASC9WZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r4yWUUSQxHtWSdUfpavylR1J+RHyCta1OM7JfPREg6yjdhANqXNIoZ4ObXz1UP1AU OiXuuyUkYubplGfr9yj/cHZqflHZ3yiJLpklPm55xgFBcGG51vvgFHIEHkhs/eI2sH wPQ5VLQIcvtBLWDiR0u/UnUWh1zxXAyVEM1PhomXGHyiwMRkUa0ahS0JnUD/v4bDr7 l83KOj9WJTzMUXNsGRnBLFKySJh3NUKpMY+gVroiSh4WQ0vMRxRdzfNcK/j1dObPAa Nwi+iZJDbry1qeUnKq37bJyKXXuAb5YxPllLKTdEt419B+rUeFxdqOjWSCRpdLDf91 JHXDemaUfkmwA== From: Geliang Tang To: mptcp@lists.linux.dev Cc: "Matthieu Baerts (NGI0)" Subject: [PATCH mptcp-next v7 01/11] mptcp: pm: more precise error messages Date: Mon, 6 Jan 2025 16:16:06 +0800 Message-ID: <702733ca36c469e621a3d4e9173eeda587dba85c.1736150983.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "Matthieu Baerts (NGI0)" Some errors reported by the userspace PM were vague: "this or that is invalid". It is easier for the userspace to know which part is wrong, instead of having to guess that. By splitting some error messages, NL_SET_ERR_MSG_ATTR() can be used instead of GENL_SET_ERR_MSG() in order to give an additional hint to the userspace developers about which attribute is wrong. Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_userspace.c | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index a3d477059b11..40fd2f788196 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -223,8 +223,14 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) goto announce_err; } - if (addr_val.addr.id == 0 || !(addr_val.flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) { - GENL_SET_ERR_MSG(info, "invalid addr id or flags"); + if (addr_val.addr.id == 0) { + NL_SET_ERR_MSG_ATTR(info->extack, addr, "invalid addr id"); + err = -EINVAL; + goto announce_err; + } + + if (!(addr_val.flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) { + NL_SET_ERR_MSG_ATTR(info->extack, addr, "invalid addr flags"); err = -EINVAL; goto announce_err; } @@ -530,8 +536,14 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info goto destroy_err; } - if (!addr_l.addr.port || !addr_r.port) { - GENL_SET_ERR_MSG(info, "missing local or remote port"); + if (!addr_l.addr.port) { + NL_SET_ERR_MSG_ATTR(info->extack, laddr, "missing local port"); + err = -EINVAL; + goto destroy_err; + } + + if (!addr_r.port) { + NL_SET_ERR_MSG_ATTR(info->extack, raddr, "missing remote port"); err = -EINVAL; goto destroy_err; } @@ -579,17 +591,24 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info) if (ret < 0) goto set_flags_err; + if (loc.addr.family == AF_UNSPEC) { + NL_SET_ERR_MSG_ATTR(info->extack, attr, + "invalid local address family"); + ret = -EINVAL; + goto set_flags_err; + } + if (attr_rem) { ret = mptcp_pm_parse_entry(attr_rem, info, false, &rem); if (ret < 0) goto set_flags_err; - } - if (loc.addr.family == AF_UNSPEC || - rem.addr.family == AF_UNSPEC) { - GENL_SET_ERR_MSG(info, "invalid address families"); - ret = -EINVAL; - goto set_flags_err; + if (rem.addr.family == AF_UNSPEC) { + NL_SET_ERR_MSG_ATTR(info->extack, attr_rem, + "invalid remote address family"); + ret = -EINVAL; + goto set_flags_err; + } } if (loc.flags & MPTCP_PM_ADDR_FLAG_BACKUP) From patchwork Mon Jan 6 08:16:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13927038 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 073F21D6DC9 for ; Mon, 6 Jan 2025 08:16:28 +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=1736151390; cv=none; b=ao0TZpD5tyVHo/eKeMXkSs5ozDWeY878uB6qfCidnXgzVgxrvNIqHFF+2i0mBAN2GQqrDUb1JtJYCv6VjtNcAG9HfXbT6IMkSWntUQQ31s3XWjlEztpFmk00MTe+JxtwSTQnAUTUqlS8pEsjXFfM444gAf/X2VoNTo0R3wL+rDs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736151390; c=relaxed/simple; bh=Zu8JWeqXTgWtIE1j6959Z9bCp1FFLKZWQeFSfyKFJlU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CFHwUMpGlI/RMyaCQhPDU+caAxWjNJPWVqP4GfQOLeGTisp/8GogpDoRwccglkwQWIKp+SjW2DrBzqqibhIxeytJTm+Y1V3YP5AETpd8eXWRqk4J0/4ZLFjL51/rx37SujMiiK04g/0HngCzXJVp6r5DDCIjfwcsfmApwhfcSLE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tYjOIiEf; 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="tYjOIiEf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CE2CC4CED2; Mon, 6 Jan 2025 08:16:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736151387; bh=Zu8JWeqXTgWtIE1j6959Z9bCp1FFLKZWQeFSfyKFJlU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tYjOIiEfwUGSvI+ehTi8NZil63ptVCgwiejdyyTQyM6DtbzS9VrzwrMDwHg3MoA6r KVU80VSfjjWBOcCEcFPutk09HGKXxdIFdvdntRx3rb8vnA9kp1BUA2kx+UY5PKWdex 4WgbnOpj/dSZd5ZT2V/RUgMvQZ67GzZhl/6h16prLywlcm575Xv9Rtv6HZpUQjc8I/ O9i/Ta643pIyiRBq2HdHy0TINf+R9kpDpzEN1BQJXiwRuO++xWXtPsvxX8iWgxBCnj 7MV0xXaLVxO5Xkmb7YBNBf4JM2kK6Ix2BqAfZ+XR/lX7Qa/X7zVxXbhfFS9bkZMxz/ GqzJL4OcrQ22Q== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v7 02/11] mptcp: userspace pm set_flags id support Date: Mon, 6 Jan 2025 16:16:07 +0800 Message-ID: <0d06955f697e484c18262a9806520132f07110cf.1736150983.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang Similar to in-kernel PM, this patch adds address ID support to set_flags() interface of userspace PM, allowing it to work with either an address or an address ID. When an address ID is used, mptcp_userspace_pm_lookup_addr_by_id() helper is used to look up the address entry in the local address list instead of using mptcp_userspace_pm_lookup_addr(). Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 40fd2f788196..60db72060e6e 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -577,6 +577,7 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info) struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR]; struct mptcp_pm_addr_entry *entry; struct mptcp_sock *msk; + u8 lookup_by_id = 0; int ret = -EINVAL; struct sock *sk; u8 bkup = 0; @@ -592,10 +593,13 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info) goto set_flags_err; if (loc.addr.family == AF_UNSPEC) { - NL_SET_ERR_MSG_ATTR(info->extack, attr, - "invalid local address family"); - ret = -EINVAL; - goto set_flags_err; + lookup_by_id = 1; + if (!loc.addr.id) { + NL_SET_ERR_MSG_ATTR(info->extack, attr, + "missing address ID"); + ret = -EOPNOTSUPP; + goto set_flags_err; + } } if (attr_rem) { @@ -615,17 +619,22 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info) bkup = 1; spin_lock_bh(&msk->pm.lock); - entry = mptcp_userspace_pm_lookup_addr(msk, &loc.addr); - if (entry) { - if (bkup) - entry->flags |= MPTCP_PM_ADDR_FLAG_BACKUP; - else - entry->flags &= ~MPTCP_PM_ADDR_FLAG_BACKUP; + entry = lookup_by_id ? mptcp_userspace_pm_lookup_addr_by_id(msk, loc.addr.id) : + mptcp_userspace_pm_lookup_addr(msk, &loc.addr); + if (!entry) { + spin_unlock_bh(&msk->pm.lock); + ret = -EINVAL; + goto set_flags_err; } + + if (bkup) + entry->flags |= MPTCP_PM_ADDR_FLAG_BACKUP; + else + entry->flags &= ~MPTCP_PM_ADDR_FLAG_BACKUP; spin_unlock_bh(&msk->pm.lock); lock_sock(sk); - ret = mptcp_pm_nl_mp_prio_send_ack(msk, &loc.addr, &rem.addr, bkup); + ret = mptcp_pm_nl_mp_prio_send_ack(msk, &entry->addr, &rem.addr, bkup); release_sock(sk); set_flags_err: From patchwork Mon Jan 6 08:16:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13927039 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 06AC41D6DBF for ; Mon, 6 Jan 2025 08:16:29 +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=1736151390; cv=none; b=rkVdETRZKO2HaJaKFO9fi2SQfSquTPy+xJKqqxetBkNmBeuAuvYBHy15Fuaqn6+6jdq09XsqWgffV6d7sTS6rsaTCUHe0tw287BZE5o+o9ivlfz1eTyMVhbv6LvFSiiz1UsW+cg1QVSWmncLoAof+M/SyjSL5m3BNsMTIt3eGlY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736151390; c=relaxed/simple; bh=wI6ofz3nZfUTpSPw/5n7zNyWaeSuaj6fkcS2nCy+Pm0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G/ifBVR9wZN3inmy8AeIJbPm41iCWEjdJVh6YfK/VefbYh9r9L1n2d5BjcX99alNLNzZvz8ZQ/h90fwxe7thEGC1Jqf0pgjCd83D/XVFB8W10p8tP9WKTBaXgDIHErNJobQbU2Zz2HggDjq6L5CqxxWUFnLfczkYez+n7yptnrA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KooS8Mk/; 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="KooS8Mk/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2691EC4CEE0; Mon, 6 Jan 2025 08:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736151389; bh=wI6ofz3nZfUTpSPw/5n7zNyWaeSuaj6fkcS2nCy+Pm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KooS8Mk/aUi+Q6QXnUYsDMKh6H9R0wg4D6t8lWWvg/5wz2H7Wg/wu6GJliE04tUWU /dovYaT0/GSAXoeej2iOncmKag+DEooJIhrTXmSOLuzEARLoyDboefHOGS1UeK1UVH XqLheB7ig8vc2VAawehHpzy4QJ+2Znxe/XkIAt/PfhCO/8KtpG75oANWR5XNZ8Trl5 3ORNpBWiopN/ZWdlxslIDgZH0mn5dqG0xvovluxbDOHyZMpn4q3FL8vGOt5oyNr7ew g8XsX+/ivv42/TY3LkGkVs8Vd9sss2my8wULQvAMmeKjvXmcPSDS7JiN2AIibHWDTT eMnIVUVakyY1g== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v7 03/11] mptcp: drop skb parameter of set_flags Date: Mon, 6 Jan 2025 16:16:08 +0800 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang The first parameter 'skb' in mptcp_pm_nl_set_flags() is only used to obtained the network namespace, which can also be obtained through the second parameters 'info' by using genl_info_net() helper. This patch drops these useless parameters 'skb' in all three set_flags() interfaces. Signed-off-by: Geliang Tang --- net/mptcp/pm.c | 6 +++--- net/mptcp/pm_netlink.c | 6 +++--- net/mptcp/pm_userspace.c | 2 +- net/mptcp/protocol.h | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 16c336c51940..6cd69ea9a69b 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -449,11 +449,11 @@ int mptcp_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb) return mptcp_pm_nl_dump_addr(msg, cb); } -int mptcp_pm_set_flags(struct sk_buff *skb, struct genl_info *info) +int mptcp_pm_set_flags(struct genl_info *info) { if (info->attrs[MPTCP_PM_ATTR_TOKEN]) - return mptcp_userspace_pm_set_flags(skb, info); - return mptcp_pm_nl_set_flags(skb, info); + return mptcp_userspace_pm_set_flags(info); + return mptcp_pm_nl_set_flags(info); } void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 98ac73938bd8..e9747bc948b9 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1981,13 +1981,13 @@ static int mptcp_nl_set_flags(struct net *net, return ret; } -int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct genl_info *info) +int mptcp_pm_nl_set_flags(struct genl_info *info) { struct mptcp_pm_addr_entry addr = { .addr = { .family = AF_UNSPEC }, }; struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR]; u8 changed, mask = MPTCP_PM_ADDR_FLAG_BACKUP | MPTCP_PM_ADDR_FLAG_FULLMESH; - struct net *net = sock_net(skb->sk); + struct net *net = genl_info_net(info); struct mptcp_pm_addr_entry *entry; struct pm_nl_pernet *pernet; u8 lookup_by_id = 0; @@ -2037,7 +2037,7 @@ int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct genl_info *info) int mptcp_pm_nl_set_flags_doit(struct sk_buff *skb, struct genl_info *info) { - return mptcp_pm_set_flags(skb, info); + return mptcp_pm_set_flags(info); } static void mptcp_nl_mcast_send(struct net *net, struct sk_buff *nlskb, gfp_t gfp) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 60db72060e6e..51fd84c49474 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -569,7 +569,7 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info return err; } -int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info) +int mptcp_userspace_pm_set_flags(struct genl_info *info) { struct mptcp_pm_addr_entry loc = { .addr = { .family = AF_UNSPEC }, }; struct mptcp_pm_addr_entry rem = { .addr = { .family = AF_UNSPEC }, }; diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 891ffcfd1088..df5619ae8a14 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1028,9 +1028,9 @@ bool mptcp_lookup_subflow_by_saddr(const struct list_head *list, const struct mptcp_addr_info *saddr); bool mptcp_remove_anno_list_by_saddr(struct mptcp_sock *msk, const struct mptcp_addr_info *addr); -int mptcp_pm_set_flags(struct sk_buff *skb, struct genl_info *info); -int mptcp_pm_nl_set_flags(struct sk_buff *skb, struct genl_info *info); -int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info); +int mptcp_pm_set_flags(struct genl_info *info); +int mptcp_pm_nl_set_flags(struct genl_info *info); +int mptcp_userspace_pm_set_flags(struct genl_info *info); int mptcp_pm_announce_addr(struct mptcp_sock *msk, const struct mptcp_addr_info *addr, bool echo); From patchwork Mon Jan 6 08:16:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13927040 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 E0EE91D63D7 for ; Mon, 6 Jan 2025 08:16:31 +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=1736151392; cv=none; b=XUUqVie5FVCn6/uL94kNBa3hewdh1awPuJ3/hXBcQqPRF5HDF8fNza13zt3esJzDGUvURZQ28fnOS0T4utDPlaI12dN+vRGIUgoovQbHRsGwcDFRgbPG6xfqJjrAWJ7XbWd3V0Q645q9ve/DZqAZUcdvLNtW4lq5NyhZ5DRhqTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736151392; c=relaxed/simple; bh=Es0fGTSAq3jsM2Gdf56/H16AdROutuivEISaNba6wJ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NA2P0en3tfozO8xcyrvJGJqU1GjASzuZRinZa/eKQ26AxDyfvx35+ZenmNInxipwbEDsNpF7bZKeYbDI5XL1Qe0G66zLoORrCXhg92UvLCfVCXHd7v1fb0xP+7r8lve/tKVzpTaKjYAxPhY+GuFxRw+TZ1sHqprbjPpORL6K5oM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C7fEx08t; 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="C7fEx08t" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00EC5C4CEE1; Mon, 6 Jan 2025 08:16:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736151391; bh=Es0fGTSAq3jsM2Gdf56/H16AdROutuivEISaNba6wJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C7fEx08tjuYkKeS8Q9vfk5VoqbQ/+7Ug4Ysd0Xbh2B2SDaQyJxg8hUpZQvKu6WYwr KS88doW0JveoOQFMbZbNMTbCjlfKF4LHZPX+bg+RnfW7QIZ5jy6v9irtaTSY1ZyTZf 1acM+Wx/6mUmqLNLaPpXvHk/JuN60SNJfbVAkI050lnlSePbvlRKLqQP6tc0FAh70A I8eSCPjkKI3NZeAmTftwxhWs/asL+hd1WFrH/6/x3qWvNvU7tdngv1/B6CYWdo6OaT kFHRYahu1RwEmw8ECup8dL7SL1+M+Anmz0wTqHqpZLsImcvQSmu7YMjkjsyu53Z9iq rsNx8zT2OzzoQ== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v7 04/11] mptcp: change rem type of set_flags Date: Mon, 6 Jan 2025 16:16:09 +0800 Message-ID: <28ae9ea0097ce50c8e4cc076b946d49522aa69e6.1736150983.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 type one: (struct mptcp_pm_addr_entry *local, struct mptcp_addr_info *remote) But the set_flags() interface uses two mptcp_pm_addr_entry type parameters. This patch changes the second one to mptcp_addr_info type and use helper mptcp_pm_parse_addr() to parse it instead of using mptcp_pm_parse_entry(). Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 51fd84c49474..2a00227e3f35 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -572,9 +572,9 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info int mptcp_userspace_pm_set_flags(struct genl_info *info) { struct mptcp_pm_addr_entry loc = { .addr = { .family = AF_UNSPEC }, }; - struct mptcp_pm_addr_entry rem = { .addr = { .family = AF_UNSPEC }, }; struct nlattr *attr_rem = info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR]; + struct mptcp_addr_info rem = { .family = AF_UNSPEC, }; struct mptcp_pm_addr_entry *entry; struct mptcp_sock *msk; u8 lookup_by_id = 0; @@ -603,11 +603,11 @@ int mptcp_userspace_pm_set_flags(struct genl_info *info) } if (attr_rem) { - ret = mptcp_pm_parse_entry(attr_rem, info, false, &rem); + ret = mptcp_pm_parse_addr(attr_rem, info, &rem); if (ret < 0) goto set_flags_err; - if (rem.addr.family == AF_UNSPEC) { + if (rem.family == AF_UNSPEC) { NL_SET_ERR_MSG_ATTR(info->extack, attr_rem, "invalid remote address family"); ret = -EINVAL; @@ -634,7 +634,7 @@ int mptcp_userspace_pm_set_flags(struct genl_info *info) spin_unlock_bh(&msk->pm.lock); lock_sock(sk); - ret = mptcp_pm_nl_mp_prio_send_ack(msk, &entry->addr, &rem.addr, bkup); + ret = mptcp_pm_nl_mp_prio_send_ack(msk, &entry->addr, &rem, bkup); release_sock(sk); set_flags_err: From patchwork Mon Jan 6 08:16:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13927041 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 7599C1D86C0 for ; Mon, 6 Jan 2025 08:16:33 +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=1736151393; cv=none; b=DsyRmGWWbD8Z85REyJQa4iGyYuz10Xj91enWZMe7crmjN6wQ+qKe38+yBUoZcx+pX2wDvTbI2Kg66joMKvRMoW3kUTeoCyCkk9kh0gMY+bRdWO18rjD+GoxNArjF37O/KanrXzD8bVGyPC3KfXJahyIba7RTJgbLkNyHEsYFcU8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736151393; c=relaxed/simple; bh=qh9ywY8AX1t6ZlF9ywYACC4CYHUA1cLdPm9NyNy0mH8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YWVs0H7DuoASlCqQnZ2EfASyX56hemAU4hBQ0ZtE3wZaZhsllZesg8FkjJmKreR1PPcyOqVpebor5eaxxiEeM7G+JQqE+qjweHm8hEDirVsniweXwC0T6k6qWVLQBuwGnQQCQyYeu4tVp+e0x6oD0mqmfK0zlnu3RE58G5i4g58= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k8h8aD1O; 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="k8h8aD1O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDFBEC4CEE0; Mon, 6 Jan 2025 08:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736151393; bh=qh9ywY8AX1t6ZlF9ywYACC4CYHUA1cLdPm9NyNy0mH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k8h8aD1OBYDRhtCTmST45CKUiarIldfGqV9R1pIsH6gRRS+1NAijLVBLobpFJJMjD I4QLlf0uZS+HN09fQ6nyUaHNEWSilY8Z5+tQmncCsoIa+4FIT47On0ZSUMjo+JciL8 1pzXH3RTzJG+rnZrvEHWpY37DBX2a8WPQr9wOGHiQTM+c/ftc5/kLU2YrT3Lbh8m8g V0sXErOaUB2zfn8dwhAnxbsRPzNHZKE1A9w2aWhm91XeGDoX8o3828gqMiZZlu5/bw uwSSDzr75ROHHywXRVvYreaYnrRwyNFiq+HxG7/a6+m+LMzBJRDunJAETe0YiM/ty4 RvUHJOVY4mY5A== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v7 05/11] mptcp: add local & remote parameters for set_flags Date: Mon, 6 Jan 2025 16:16:10 +0800 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch updates the interfaces set_flags to reduce repetitive code, adds two more parameters 'local' and 'remote' for them. These addresses are parsed in public helper mptcp_pm_nl_set_flags_doit(), then pass them to mptcp_pm_nl_set_flags() and mptcp_userspace_pm_set_flags(). Signed-off-by: Geliang Tang --- net/mptcp/pm.c | 8 +++-- net/mptcp/pm_netlink.c | 70 +++++++++++++++++++++++++++------------- net/mptcp/pm_userspace.c | 43 +++++------------------- net/mptcp/protocol.h | 12 +++++-- 4 files changed, 69 insertions(+), 64 deletions(-) diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c index 6cd69ea9a69b..4e851be7a177 100644 --- a/net/mptcp/pm.c +++ b/net/mptcp/pm.c @@ -449,11 +449,13 @@ int mptcp_pm_dump_addr(struct sk_buff *msg, struct netlink_callback *cb) return mptcp_pm_nl_dump_addr(msg, cb); } -int mptcp_pm_set_flags(struct genl_info *info) +int mptcp_pm_set_flags(struct mptcp_pm_addr_entry *local, + struct mptcp_addr_info *remote, + struct genl_info *info) { if (info->attrs[MPTCP_PM_ATTR_TOKEN]) - return mptcp_userspace_pm_set_flags(info); - return mptcp_pm_nl_set_flags(info); + return mptcp_userspace_pm_set_flags(local, remote, info); + return mptcp_pm_nl_set_flags(local, remote, info); } void mptcp_pm_subflow_chk_stale(const struct mptcp_sock *msk, struct sock *ssk) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index e9747bc948b9..7f5a72525bca 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1981,10 +1981,10 @@ static int mptcp_nl_set_flags(struct net *net, return ret; } -int mptcp_pm_nl_set_flags(struct genl_info *info) +int mptcp_pm_nl_set_flags(struct mptcp_pm_addr_entry *local, + struct mptcp_addr_info *remote, + struct genl_info *info) { - struct mptcp_pm_addr_entry addr = { .addr = { .family = AF_UNSPEC }, }; - struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR]; u8 changed, mask = MPTCP_PM_ADDR_FLAG_BACKUP | MPTCP_PM_ADDR_FLAG_FULLMESH; struct net *net = genl_info_net(info); @@ -1992,52 +1992,76 @@ int mptcp_pm_nl_set_flags(struct genl_info *info) struct pm_nl_pernet *pernet; u8 lookup_by_id = 0; u8 bkup = 0; - int ret; pernet = pm_nl_get_pernet(net); - ret = mptcp_pm_parse_entry(attr, info, false, &addr); - if (ret < 0) - return ret; - - if (addr.addr.family == AF_UNSPEC) { + if (local->addr.family == AF_UNSPEC) lookup_by_id = 1; - if (!addr.addr.id) { - GENL_SET_ERR_MSG(info, "missing required inputs"); - return -EOPNOTSUPP; - } - } - if (addr.flags & MPTCP_PM_ADDR_FLAG_BACKUP) + if (local->flags & MPTCP_PM_ADDR_FLAG_BACKUP) bkup = 1; spin_lock_bh(&pernet->lock); - entry = lookup_by_id ? __lookup_addr_by_id(pernet, addr.addr.id) : - __lookup_addr(pernet, &addr.addr); + entry = lookup_by_id ? __lookup_addr_by_id(pernet, local->addr.id) : + __lookup_addr(pernet, &local->addr); if (!entry) { spin_unlock_bh(&pernet->lock); GENL_SET_ERR_MSG(info, "address not found"); return -EINVAL; } - if ((addr.flags & MPTCP_PM_ADDR_FLAG_FULLMESH) && + if ((local->flags & MPTCP_PM_ADDR_FLAG_FULLMESH) && (entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) { spin_unlock_bh(&pernet->lock); GENL_SET_ERR_MSG(info, "invalid addr flags"); return -EINVAL; } - changed = (addr.flags ^ entry->flags) & mask; - entry->flags = (entry->flags & ~mask) | (addr.flags & mask); - addr = *entry; + changed = (local->flags ^ entry->flags) & mask; + entry->flags = (entry->flags & ~mask) | (local->flags & mask); + *local = *entry; spin_unlock_bh(&pernet->lock); - mptcp_nl_set_flags(net, &addr.addr, bkup, changed); + mptcp_nl_set_flags(net, &local->addr, bkup, changed); return 0; } int mptcp_pm_nl_set_flags_doit(struct sk_buff *skb, struct genl_info *info) { - return mptcp_pm_set_flags(info); + struct mptcp_pm_addr_entry loc = { .addr = { .family = AF_UNSPEC }, }; + struct nlattr *attr_rem = info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; + struct mptcp_addr_info rem = { .family = AF_UNSPEC, }; + struct nlattr *attr_loc; + int ret; + + if (GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ATTR_ADDR)) + return -EINVAL; + + attr_loc = info->attrs[MPTCP_PM_ATTR_ADDR]; + ret = mptcp_pm_parse_entry(attr_loc, info, false, &loc); + if (ret < 0) + return ret; + + if (loc.addr.family == AF_UNSPEC) { + if (!loc.addr.id) { + NL_SET_ERR_MSG_ATTR(info->extack, attr_loc, + "missing address ID"); + return -EOPNOTSUPP; + } + } + + if (attr_rem) { + ret = mptcp_pm_parse_addr(attr_rem, info, &rem); + if (ret < 0) + return ret; + + if (rem.family == AF_UNSPEC) { + NL_SET_ERR_MSG_ATTR(info->extack, attr_rem, + "invalid remote address family"); + return -EINVAL; + } + } + + return mptcp_pm_set_flags(&loc, &rem, info); } static void mptcp_nl_mcast_send(struct net *net, struct sk_buff *nlskb, gfp_t gfp) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 2a00227e3f35..0f703e06d771 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -569,12 +569,10 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info return err; } -int mptcp_userspace_pm_set_flags(struct genl_info *info) +int mptcp_userspace_pm_set_flags(struct mptcp_pm_addr_entry *local, + struct mptcp_addr_info *remote, + struct genl_info *info) { - struct mptcp_pm_addr_entry loc = { .addr = { .family = AF_UNSPEC }, }; - struct nlattr *attr_rem = info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; - struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR]; - struct mptcp_addr_info rem = { .family = AF_UNSPEC, }; struct mptcp_pm_addr_entry *entry; struct mptcp_sock *msk; u8 lookup_by_id = 0; @@ -588,42 +586,17 @@ int mptcp_userspace_pm_set_flags(struct genl_info *info) sk = (struct sock *)msk; - ret = mptcp_pm_parse_entry(attr, info, false, &loc); - if (ret < 0) - goto set_flags_err; - - if (loc.addr.family == AF_UNSPEC) { + if (local->addr.family == AF_UNSPEC) lookup_by_id = 1; - if (!loc.addr.id) { - NL_SET_ERR_MSG_ATTR(info->extack, attr, - "missing address ID"); - ret = -EOPNOTSUPP; - goto set_flags_err; - } - } - if (attr_rem) { - ret = mptcp_pm_parse_addr(attr_rem, info, &rem); - if (ret < 0) - goto set_flags_err; - - if (rem.family == AF_UNSPEC) { - NL_SET_ERR_MSG_ATTR(info->extack, attr_rem, - "invalid remote address family"); - ret = -EINVAL; - goto set_flags_err; - } - } - - if (loc.flags & MPTCP_PM_ADDR_FLAG_BACKUP) + if (local->flags & MPTCP_PM_ADDR_FLAG_BACKUP) bkup = 1; spin_lock_bh(&msk->pm.lock); - entry = lookup_by_id ? mptcp_userspace_pm_lookup_addr_by_id(msk, loc.addr.id) : - mptcp_userspace_pm_lookup_addr(msk, &loc.addr); + entry = lookup_by_id ? mptcp_userspace_pm_lookup_addr_by_id(msk, local->addr.id) : + mptcp_userspace_pm_lookup_addr(msk, &local->addr); if (!entry) { spin_unlock_bh(&msk->pm.lock); - ret = -EINVAL; goto set_flags_err; } @@ -634,7 +607,7 @@ int mptcp_userspace_pm_set_flags(struct genl_info *info) spin_unlock_bh(&msk->pm.lock); lock_sock(sk); - ret = mptcp_pm_nl_mp_prio_send_ack(msk, &entry->addr, &rem, bkup); + ret = mptcp_pm_nl_mp_prio_send_ack(msk, &entry->addr, remote, bkup); release_sock(sk); set_flags_err: diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index df5619ae8a14..d5a28ffbc1c3 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1028,9 +1028,15 @@ bool mptcp_lookup_subflow_by_saddr(const struct list_head *list, const struct mptcp_addr_info *saddr); bool mptcp_remove_anno_list_by_saddr(struct mptcp_sock *msk, const struct mptcp_addr_info *addr); -int mptcp_pm_set_flags(struct genl_info *info); -int mptcp_pm_nl_set_flags(struct genl_info *info); -int mptcp_userspace_pm_set_flags(struct genl_info *info); +int mptcp_pm_set_flags(struct mptcp_pm_addr_entry *local, + struct mptcp_addr_info *remote, + struct genl_info *info); +int mptcp_pm_nl_set_flags(struct mptcp_pm_addr_entry *local, + struct mptcp_addr_info *remote, + struct genl_info *info); +int mptcp_userspace_pm_set_flags(struct mptcp_pm_addr_entry *local, + struct mptcp_addr_info *remote, + struct genl_info *info); int mptcp_pm_announce_addr(struct mptcp_sock *msk, const struct mptcp_addr_info *addr, bool echo); From patchwork Mon Jan 6 08:16:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13927042 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 AB1C51C3F1C for ; Mon, 6 Jan 2025 08:16:35 +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=1736151395; cv=none; b=Nv+z2pNDz8ANC2Tu1U5TEXBUcCL8Vek7Q2jpfd7E/XS4bHttbsFET3CiyDqf5vx0f6kCJMIEDx9GiLdEcW9/sDlgzp94QPNB+EHhHELbF+9wnKOvcLEc0gm0Qa8gKSnyXEIfgBmGoTNwQvRNjXH4mc8nY792SvosstwY0lm74bQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736151395; c=relaxed/simple; bh=ba11fF5Q4ulNBTGhKeDU2bYkYZQgdLMIzcse2sR2i94=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P2AD9zu518UB6TKYrecolfzSGlhLY6nYuT7rFWYZRe/0Dei6fnIYOfFaJrrDSK1jf3ypwEJTNWptrkA80icH4ju1nckMW5wSAKIGuDOtBz6htOj3YIdpBCpIQb90fPHt6DP4CI6qsVY62HlDqEWmlxeb/GdGCgV6LXtr2z6uXlY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Xe9dmTwN; 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="Xe9dmTwN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A829AC4CED2; Mon, 6 Jan 2025 08:16:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736151395; bh=ba11fF5Q4ulNBTGhKeDU2bYkYZQgdLMIzcse2sR2i94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xe9dmTwNzui54AH2pl3P/VTh+FHw3uF8iO+OMqSCdYCk4IOIo1Nu3Wl0I0b8xdsEt EUpgwwen5Otbwia4C/T0OsPeu+NTYwBOmiZINIpwXPSjsqlfZK1rx0I8NcBmeT1IWa ncNf98uBpXrGuQkWoRJOHWJKQQbBw+BWcNR3a1BjGIbXysvRD+xNFVbnE0/wgrR2fb Rg4+eNfLgV072o6G7cZH0UEEVPlKG93UUCXyIZ13revxMIdzq4LRRFpMZSQlFcxImc ObsY/IJrQErWYRjPaC6/vXKIeryC80FECe65gW31L4ykAzbRuecrX9vhxMnDttbkoZ xz+tomM6JB0ig== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v7 06/11] mptcp: drop info of userspace_pm_remove_id_zero_address Date: Mon, 6 Jan 2025 16:16:11 +0800 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang The only use of 'info' parameter of userspace_pm_remove_id_zero_address() is to set an error message into it. This patch drops this parameter and sets the error message where this function is called in mptcp_pm_nl_remove_doit(). Signed-off-by: Geliang Tang --- net/mptcp/pm_userspace.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 0f703e06d771..a6580942e628 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -259,8 +259,7 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) return err; } -static int mptcp_userspace_pm_remove_id_zero_address(struct mptcp_sock *msk, - struct genl_info *info) +static int mptcp_userspace_pm_remove_id_zero_address(struct mptcp_sock *msk) { struct mptcp_rm_list list = { .nr = 0 }; struct mptcp_subflow_context *subflow; @@ -275,10 +274,8 @@ static int mptcp_userspace_pm_remove_id_zero_address(struct mptcp_sock *msk, break; } } - if (!has_id_0) { - GENL_SET_ERR_MSG(info, "address with id 0 not found"); + if (!has_id_0) goto remove_err; - } list.ids[list.nr++] = 0; @@ -336,7 +333,7 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) sk = (struct sock *)msk; if (id_val == 0) { - err = mptcp_userspace_pm_remove_id_zero_address(msk, info); + err = mptcp_userspace_pm_remove_id_zero_address(msk); goto out; } @@ -345,7 +342,6 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) spin_lock_bh(&msk->pm.lock); match = mptcp_userspace_pm_lookup_addr_by_id(msk, id_val); if (!match) { - GENL_SET_ERR_MSG(info, "address with specified id not found"); spin_unlock_bh(&msk->pm.lock); release_sock(sk); goto out; @@ -362,6 +358,11 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) err = 0; out: + if (err) + GENL_SET_ERR_MSG_FMT(info, + "address with id %u not found", + id_val); + sock_put(sk); return err; } From patchwork Mon Jan 6 08:16:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13927043 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 5CAF71A2631 for ; Mon, 6 Jan 2025 08:16:37 +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=1736151397; cv=none; b=N3ojPE8GhtUCl1u1XK6disKPd5iiMP0omeHC+KgzTP2BAOfllz6AZAHjpfWGi7cTky6WxGAQkTsIgAZRyV7xRBm8ges9g9jPj/nySgklRxhHJXOUL346oXMkmrZzQNGxO/q1GoZm+SrjcsjvdjHBcev9sfYyOUCRkjNEPCDfGGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736151397; c=relaxed/simple; bh=xSWOxaHVAXme4rpHtICrHZqLRwzJm5ZBlk3a/NYxIBI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OgXUXC5g8rvlCl74zwGzSYjQTnyLpWrTMfdXD2OuFUyRJYzuHGL7nDldNl+JbmmHKyv4m5BxXOOwAG430Xj599ZEzzOrOJv6oot4lGUEiVX8GTkqfkdF2lro3FlkP4tnxfBFJiREGik14Kxo5abMTmyUETTCNZtM2nw6c0rCLHo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QiRKUITW; 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="QiRKUITW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B18DC4CEDF; Mon, 6 Jan 2025 08:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736151396; bh=xSWOxaHVAXme4rpHtICrHZqLRwzJm5ZBlk3a/NYxIBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QiRKUITWej9Sur74ozSvKiMrVFNNqKeVuzkuMf6o3zd9201r2PGa0JJrrRl4C2KLf P184dDXB9UteqPLbc1yGXsBMyMphWkTYKgca1UeqPR35mK0DopVGYK8dpy3PuXl/pq 0yVIt0COwka+DLVn8T+b1dWGo7QHhkbhxkUNLQkQQtB/2JabKBJNcp8LGS774RP5GJ /KfevzmCB6y56riO2MsnH7mkrqHPqxr2hujNx9sRp6xrVYDOAfxJ8Aa+Jc21YS+6dR A/ycCuJ7GR9Rd+jCHrkW+WKFyAhzGfkxn5pFZjslkAnbXngJF70ZgxnYzJNWiTENyM /09y0192l54Dg== From: Geliang Tang To: mptcp@lists.linux.dev Cc: "Matthieu Baerts (NGI0)" Subject: [PATCH mptcp-next v7 07/11] mptcp: pm: use NL_SET_ERR_MSG_ATTR when possible Date: Mon, 6 Jan 2025 16:16:12 +0800 Message-ID: <4ab3a73300cdc4e2f222127e53ca66a696d3e6e6.1736150983.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "Matthieu Baerts (NGI0)" Instead of only returning a text message with GENL_SET_ERR_MSG(), NL_SET_ERR_MSG_ATTR() can help the userspace developers by also reporting which attribute is faulty. When the error is specific to an attribute, NL_SET_ERR_MSG_ATTR() is now used. The error messages have not been modified in this commit. mptcp_userspace_pm_remove_id_zero_address() has been modified to set the missing attribute. Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 16 ++++++++++------ net/mptcp/pm_userspace.c | 13 ++++++++----- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 7f5a72525bca..46a97a3bf319 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1403,18 +1403,21 @@ int mptcp_pm_nl_add_addr_doit(struct sk_buff *skb, struct genl_info *info) return ret; if (addr.addr.port && !address_use_port(&addr)) { - GENL_SET_ERR_MSG(info, "flags must have signal and not subflow when using port"); + NL_SET_ERR_MSG_ATTR(info->extack, attr, + "flags must have signal and not subflow when using port"); return -EINVAL; } if (addr.flags & MPTCP_PM_ADDR_FLAG_SIGNAL && addr.flags & MPTCP_PM_ADDR_FLAG_FULLMESH) { - GENL_SET_ERR_MSG(info, "flags mustn't have both signal and fullmesh"); + NL_SET_ERR_MSG_ATTR(info->extack, attr, + "flags mustn't have both signal and fullmesh"); return -EINVAL; } if (addr.flags & MPTCP_PM_ADDR_FLAG_IMPLICIT) { - GENL_SET_ERR_MSG(info, "can't create IMPLICIT endpoint"); + NL_SET_ERR_MSG_ATTR(info->extack, attr, + "can't create IMPLICIT endpoint"); return -EINVAL; } @@ -1608,7 +1611,7 @@ int mptcp_pm_nl_del_addr_doit(struct sk_buff *skb, struct genl_info *info) spin_lock_bh(&pernet->lock); entry = __lookup_addr_by_id(pernet, addr.addr.id); if (!entry) { - GENL_SET_ERR_MSG(info, "address not found"); + NL_SET_ERR_MSG_ATTR(info->extack, attr, "address not found"); spin_unlock_bh(&pernet->lock); return -EINVAL; } @@ -1790,7 +1793,7 @@ int mptcp_pm_nl_get_addr(struct sk_buff *skb, struct genl_info *info) rcu_read_lock(); entry = __lookup_addr_by_id(pernet, addr.addr.id); if (!entry) { - GENL_SET_ERR_MSG(info, "address not found"); + NL_SET_ERR_MSG_ATTR(info->extack, attr, "address not found"); ret = -EINVAL; goto unlock_fail; } @@ -1875,7 +1878,8 @@ static int parse_limit(struct genl_info *info, int id, unsigned int *limit) *limit = nla_get_u32(attr); if (*limit > MPTCP_PM_ADDR_MAX) { - GENL_SET_ERR_MSG(info, "limit greater than maximum"); + NL_SET_ERR_MSG_ATTR(info->extack, attr, + "limit greater than maximum"); return -EINVAL; } return 0; diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index a6580942e628..066fd89b1691 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -190,7 +190,8 @@ static struct mptcp_sock *mptcp_userspace_pm_get_sock(const struct genl_info *in } if (!mptcp_pm_is_userspace(msk)) { - GENL_SET_ERR_MSG(info, "invalid request; userspace PM not selected"); + NL_SET_ERR_MSG_ATTR(info->extack, token, + "invalid request; userspace PM not selected"); sock_put((struct sock *)msk); return NULL; } @@ -237,7 +238,8 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) err = mptcp_userspace_pm_append_new_local_addr(msk, &addr_val, false); if (err < 0) { - GENL_SET_ERR_MSG(info, "did not match address and id"); + NL_SET_ERR_MSG_ATTR(info->extack, addr, + "did not match address and id"); goto announce_err; } @@ -396,7 +398,7 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) } if (entry.flags & MPTCP_PM_ADDR_FLAG_SIGNAL) { - GENL_SET_ERR_MSG(info, "invalid addr flags"); + NL_SET_ERR_MSG_ATTR(info->extack, laddr, "invalid addr flags"); err = -EINVAL; goto create_err; } @@ -416,7 +418,8 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) err = mptcp_userspace_pm_append_new_local_addr(msk, &entry, false); if (err < 0) { - GENL_SET_ERR_MSG(info, "did not match address and id"); + NL_SET_ERR_MSG_ATTR(info->extack, laddr, + "did not match address and id"); goto create_err; } @@ -704,7 +707,7 @@ int mptcp_userspace_pm_get_addr(struct sk_buff *skb, spin_lock_bh(&msk->pm.lock); entry = mptcp_userspace_pm_lookup_addr_by_id(msk, addr.addr.id); if (!entry) { - GENL_SET_ERR_MSG(info, "address not found"); + NL_SET_ERR_MSG_ATTR(info->extack, attr, "address not found"); ret = -EINVAL; goto unlock_fail; } From patchwork Mon Jan 6 08:16:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13927044 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 30F1D1D5CD9 for ; Mon, 6 Jan 2025 08:16:38 +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=1736151399; cv=none; b=BjZJSkAiSXLx5qU4ktCKpOy0pkMbw6FfXW9JWdFZHZ22MoeD+UpUS3CDkzwD8CtcRqqHGzq4lUl+enHg2QI+/VmBOzWGlpa1C3jkFBVCGs6xOrRsjdrBjabEpcp2RrJTO7Yjgzo2ahizY1JpQ38tpYIfBLUtQ3u4pkCiN3xmJes= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736151399; c=relaxed/simple; bh=6uHMBUmfTy3WZL5C6JpXhdK+Qd+5DyOYkxhDvtI02YM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ThY5CgVqtrcISNA7aMSAGVI/Xw1iTQ5Crh9FK1ni9tDCB930M6R91eIRR7mQAB2dcI2mfRlt6kL4rcx9uN0d6eioo8v6u3XmVS923J8MbvcOmFGTEyLb6If7DZGKBvgfVNY4tAzfFqNCaFbFcre0S16eQMlbXZnGPYy7FPNjWGo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BiSb/2dp; 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="BiSb/2dp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 749EEC4CED2; Mon, 6 Jan 2025 08:16:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736151398; bh=6uHMBUmfTy3WZL5C6JpXhdK+Qd+5DyOYkxhDvtI02YM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BiSb/2dpktly+ikc/XX4tDir9mjPaEecS9wsRwgw0pjSKdt/VtWNxfRsRJPx1IeGe y3dWCcFwCM1ENLO8Q0k/5B60ekXl/q6pXNl94KAqi7pyRfAhzq4OcJfjxnK6qo0ZMd 0Bryze5+exf5ss7t8M5vef5Q5i+kOWn+vi5j6IGGMADZDUHqe5y86uuOL5ZlaSqJbp e8coIMUNExjJyufV1LWU5WTJUDyQxXe7Wem3j1LyZW6wHu/eGy2ON5R8Bg4I/4zRvZ jwM1eub3UMRQsEc7XrJKJlay83qa1vWRyubXL+VQRvADQHOfUbqERATXO+iLTGtccI PmixPCmhu+pBA== From: Geliang Tang To: mptcp@lists.linux.dev Cc: "Matthieu Baerts (NGI0)" Subject: [PATCH mptcp-next v7 08/11] mptcp: pm: improve error messages Date: Mon, 6 Jan 2025 16:16:13 +0800 Message-ID: <4078a76f5e18d55532f87e4d8a936876d356222c.1736150983.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "Matthieu Baerts (NGI0)" Some error messages were: - too generic: "missing input", "invalid request" - not precise enough: "limit greater than maximum" but what's the max? - missing: subflow not found, or connect error. This can be easily improved by being more precise, or adding new error messages. Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 5 +++-- net/mptcp/pm_userspace.c | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 46a97a3bf319..528718cb70ec 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1878,8 +1878,9 @@ static int parse_limit(struct genl_info *info, int id, unsigned int *limit) *limit = nla_get_u32(attr); if (*limit > MPTCP_PM_ADDR_MAX) { - NL_SET_ERR_MSG_ATTR(info->extack, attr, - "limit greater than maximum"); + NL_SET_ERR_MSG_ATTR_FMT(info->extack, attr, + "limit greater than maximum (%u)", + MPTCP_PM_ADDR_MAX); return -EINVAL; } return 0; diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 066fd89b1691..341db3bc191b 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -191,7 +191,7 @@ static struct mptcp_sock *mptcp_userspace_pm_get_sock(const struct genl_info *in if (!mptcp_pm_is_userspace(msk)) { NL_SET_ERR_MSG_ATTR(info->extack, token, - "invalid request; userspace PM not selected"); + "userspace PM not selected"); sock_put((struct sock *)msk); return NULL; } @@ -430,6 +430,8 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) lock_sock(sk); err = __mptcp_subflow_connect(sk, &local, &addr_r); release_sock(sk); + if (err) + GENL_SET_ERR_MSG_FMT(info, "connect error: %d", err); spin_lock_bh(&msk->pm.lock); if (err) @@ -555,6 +557,7 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info lock_sock(sk); ssk = mptcp_nl_find_ssk(msk, &addr_l.addr, &addr_r); if (!ssk) { + GENL_SET_ERR_MSG(info, "subflow not found"); err = -ESRCH; goto release_sock; } @@ -613,6 +616,8 @@ int mptcp_userspace_pm_set_flags(struct mptcp_pm_addr_entry *local, lock_sock(sk); ret = mptcp_pm_nl_mp_prio_send_ack(msk, &entry->addr, remote, bkup); release_sock(sk); + if (ret) + GENL_SET_ERR_MSG(info, "mp_prio send ack failed"); set_flags_err: sock_put(sk); From patchwork Mon Jan 6 08:16:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13927045 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 6AF1915884A for ; Mon, 6 Jan 2025 08:16:41 +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=1736151401; cv=none; b=rIC5Y5/c5tU5eO2GFFLhFHYEePLc1ttczAVhkiTsPQp7/2OInwpEPGJ3G16dTTQBbfSb8EGYTI82ygpHEA+V4ONGmDTzRhUiyivIIN+mJyS4CIndYNZpV/ITWl+xPLNl6dQfxndDyStSU9HJTltXUmH9MnASkJaO7Muc8nKmkbw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736151401; c=relaxed/simple; bh=FQgcebzF+PchMdKsoM25Kd26OJWtdwXFB5ff7XDGjNk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H94q1LlFZJj8DTAGPBD/ieHp7WNQOX8Jy8G+VJZAu0iFZCG2imByJlClc3SXxHMwxJ/h5HWiDQk9vBvET+NTSma1BC/W3UmE3dLtLTCKejmoEnJGgjXzq/FxMt41qu1kbm5KX4rfSzVqGI6E9OV76s8a9Dd7mBVDAMA3Qj633MI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=n2pAdpT8; 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="n2pAdpT8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E32EC4CEDF; Mon, 6 Jan 2025 08:16:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736151401; bh=FQgcebzF+PchMdKsoM25Kd26OJWtdwXFB5ff7XDGjNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n2pAdpT8rdK5nNiUXtECVgSPgSlWu08Fir10IsDzB5hs/F6dIogF1JF/F+a27ar4u 4G3T9bU6Od/PhPS9IZmjmMO2Qqi1cD1CFD+rkPW4c5OV0dvxfFRHvxUxtebGr8MJ/3 hifmnA9ltAii9nRK7/LEiWQ+FLfUg5ayz3wpf92qYwzUZwhbLwjIq3pcY3KcXOkVt9 spfdVdXMO9f4hjs/KUCswLKYcgIpRyaYET1Zjco6fgV1JhAj09O5UGrWtDlR26igdN RONaN1NEp9w9xhDXxYl4bw5D/fL1NCO+G9zBCI8boncaA9gGK1c9H9DEwa10OSedvL xZrGg1Nmx7/SQ== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang , Jakub Kicinski , Matthieu Baerts Subject: [PATCH mptcp-next v7 09/11] mptcp: pm: userspace: use GENL_REQ_ATTR_CHECK Date: Mon, 6 Jan 2025 16:16:14 +0800 Message-ID: <8272c35599055c36292b103ee25c50e0e731c50e.1736150983.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang A more general way to check if MPTCP_PM_ATTR_* exists in 'info' is to use GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ATTR_*) instead of directly reading info->attrs[MPTCP_PM_ATTR_*] and then checking if it's NULL. So this patch uses GENL_REQ_ATTR_CHECK() for userspace PM in mptcp_pm_nl_announce_doit(), mptcp_pm_nl_remove_doit(), mptcp_pm_nl_subflow_create_doit(), mptcp_pm_nl_subflow_destroy_doit() and mptcp_userspace_pm_get_sock(). Suggested-by: Jakub Kicinski Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_userspace.c | 41 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 341db3bc191b..201595f9ebf9 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -175,14 +175,13 @@ bool mptcp_userspace_pm_is_backup(struct mptcp_sock *msk, static struct mptcp_sock *mptcp_userspace_pm_get_sock(const struct genl_info *info) { - struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN]; struct mptcp_sock *msk; + struct nlattr *token; - if (!token) { - GENL_SET_ERR_MSG(info, "missing required token"); + if (GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ATTR_TOKEN)) return NULL; - } + token = info->attrs[MPTCP_PM_ATTR_TOKEN]; msk = mptcp_token_get_sock(genl_info_net(info), nla_get_u32(token)); if (!msk) { NL_SET_ERR_MSG_ATTR(info->extack, token, "invalid token"); @@ -201,16 +200,14 @@ static struct mptcp_sock *mptcp_userspace_pm_get_sock(const struct genl_info *in int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) { - struct nlattr *addr = info->attrs[MPTCP_PM_ATTR_ADDR]; struct mptcp_pm_addr_entry addr_val; struct mptcp_sock *msk; + struct nlattr *addr; int err = -EINVAL; struct sock *sk; - if (!addr) { - GENL_SET_ERR_MSG(info, "missing required address"); + if (GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ATTR_ADDR)) return err; - } msk = mptcp_userspace_pm_get_sock(info); if (!msk) @@ -218,6 +215,7 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) sk = (struct sock *)msk; + addr = info->attrs[MPTCP_PM_ATTR_ADDR]; err = mptcp_pm_parse_entry(addr, info, true, &addr_val); if (err < 0) { GENL_SET_ERR_MSG(info, "error parsing local address"); @@ -314,18 +312,17 @@ void mptcp_pm_remove_addr_entry(struct mptcp_sock *msk, int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) { - struct nlattr *id = info->attrs[MPTCP_PM_ATTR_LOC_ID]; struct mptcp_pm_addr_entry *match; struct mptcp_sock *msk; + struct nlattr *id; int err = -EINVAL; struct sock *sk; u8 id_val; - if (!id) { - GENL_SET_ERR_MSG(info, "missing required ID"); + if (GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ATTR_LOC_ID)) return err; - } + id = info->attrs[MPTCP_PM_ATTR_LOC_ID]; id_val = nla_get_u8(id); msk = mptcp_userspace_pm_get_sock(info); @@ -371,19 +368,17 @@ int mptcp_pm_nl_remove_doit(struct sk_buff *skb, struct genl_info *info) int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) { - struct nlattr *raddr = info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; - struct nlattr *laddr = info->attrs[MPTCP_PM_ATTR_ADDR]; struct mptcp_pm_addr_entry entry = { 0 }; struct mptcp_addr_info addr_r; + struct nlattr *raddr, *laddr; struct mptcp_pm_local local; struct mptcp_sock *msk; int err = -EINVAL; struct sock *sk; - if (!laddr || !raddr) { - GENL_SET_ERR_MSG(info, "missing required address(es)"); + if (GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ATTR_ADDR) || + GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ATTR_ADDR_REMOTE)) return err; - } msk = mptcp_userspace_pm_get_sock(info); if (!msk) @@ -391,6 +386,7 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) sk = (struct sock *)msk; + laddr = info->attrs[MPTCP_PM_ATTR_ADDR]; err = mptcp_pm_parse_entry(laddr, info, true, &entry); if (err < 0) { NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr"); @@ -404,6 +400,7 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) } entry.flags |= MPTCP_PM_ADDR_FLAG_SUBFLOW; + raddr = info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; err = mptcp_pm_parse_addr(raddr, info, &addr_r); if (err < 0) { NL_SET_ERR_MSG_ATTR(info->extack, raddr, "error parsing remote addr"); @@ -495,18 +492,16 @@ static struct sock *mptcp_nl_find_ssk(struct mptcp_sock *msk, int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info) { - struct nlattr *raddr = info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; - struct nlattr *laddr = info->attrs[MPTCP_PM_ATTR_ADDR]; struct mptcp_pm_addr_entry addr_l; struct mptcp_addr_info addr_r; + struct nlattr *raddr, *laddr; struct mptcp_sock *msk; struct sock *sk, *ssk; int err = -EINVAL; - if (!laddr || !raddr) { - GENL_SET_ERR_MSG(info, "missing required address(es)"); + if (GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ATTR_ADDR) || + GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ATTR_ADDR_REMOTE)) return err; - } msk = mptcp_userspace_pm_get_sock(info); if (!msk) @@ -514,12 +509,14 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info sk = (struct sock *)msk; + laddr = info->attrs[MPTCP_PM_ATTR_ADDR]; err = mptcp_pm_parse_entry(laddr, info, true, &addr_l); if (err < 0) { NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr"); goto destroy_err; } + raddr = info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; err = mptcp_pm_parse_addr(raddr, info, &addr_r); if (err < 0) { NL_SET_ERR_MSG_ATTR(info->extack, raddr, "error parsing remote addr"); From patchwork Mon Jan 6 08:16:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13927046 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 4BADA1D86F1 for ; Mon, 6 Jan 2025 08:16:42 +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=1736151403; cv=none; b=j7J2dClT+Hiuy3J0S/82POPBcfTPnwm7kjuoUCUqv6KMfhbWG9Ij/hVvhFxsAu+THABj/jk+rRNV5m9GzaVIcxJXHHCowNMq8Uniq02ZEcM0QuVdTCHouzAZFxtBJrI6/Edcj0Rqgfa1iVop8gnkzS7sJuxweiRM2UwsUqzCag0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736151403; c=relaxed/simple; bh=oZD1fClnFf/1kfrUw9Di63AWWA7Gv4PjDqDsDnCjAPw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Wak79ezUQz7mxIuyoqVscwYSLl/jNx+4gMeJziiMK/R877ghsyxwIjhJcxA4fdNnlrN+PIFEJtzKLiIiLgewAq7TT9FLqoJG33FAItRJzFvNkt2hDYBK0CmdWadQoZtj0LRsgCHLByQljoD7yxcxKC+LZvLN+JeL0sAsgGt3tAg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HlZXoRvn; 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="HlZXoRvn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5BB3C4CEDF; Mon, 6 Jan 2025 08:16:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736151402; bh=oZD1fClnFf/1kfrUw9Di63AWWA7Gv4PjDqDsDnCjAPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HlZXoRvnfcv3DAkzhQaynDov83283Vimm1pVtxfo1ed3z6sB/spoAEpDsgm8dBsZT SeK67bu6HGSLj/O1dw6BnejzpneJo42wDACF0ZkM7ZlXtZyfAt71rjru7XpMVlTk7S Wd6iyRT6n3Byg4Rq/etWMqOe8EBzgF/qccUHie4XN6WalypCvcD0vgptO5KsqBBCw6 IAYeKdFkfspAYNyBI2nlgGYBosrLESkmVFPm402qFZIU4/bHeypHWLXtX9gV/VVv4m xvIDZC0kn6TYIicd0eGkcnXJ+nXQI11sHHiU8yqxr6wkmeEJhVurC4zU5BN9ajHPx2 OUF8JclchECrQ== From: Geliang Tang To: mptcp@lists.linux.dev Cc: "Matthieu Baerts (NGI0)" Subject: [PATCH mptcp-next v7 10/11] mptcp: pm: remove duplicated error messages Date: Mon, 6 Jan 2025 16:16:15 +0800 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "Matthieu Baerts (NGI0)" mptcp_pm_parse_entry() and mptcp_pm_parse_addr() will already set a error message in case of parsing issue. Then, no need to override this error message with another less precise one: "error parsing address". Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_userspace.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index 201595f9ebf9..dc9ebfb06d96 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -217,10 +217,8 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info) addr = info->attrs[MPTCP_PM_ATTR_ADDR]; err = mptcp_pm_parse_entry(addr, info, true, &addr_val); - if (err < 0) { - GENL_SET_ERR_MSG(info, "error parsing local address"); + if (err < 0) goto announce_err; - } if (addr_val.addr.id == 0) { NL_SET_ERR_MSG_ATTR(info->extack, addr, "invalid addr id"); @@ -388,10 +386,8 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) laddr = info->attrs[MPTCP_PM_ATTR_ADDR]; err = mptcp_pm_parse_entry(laddr, info, true, &entry); - if (err < 0) { - NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr"); + if (err < 0) goto create_err; - } if (entry.flags & MPTCP_PM_ADDR_FLAG_SIGNAL) { NL_SET_ERR_MSG_ATTR(info->extack, laddr, "invalid addr flags"); @@ -402,10 +398,8 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) raddr = info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; err = mptcp_pm_parse_addr(raddr, info, &addr_r); - if (err < 0) { - NL_SET_ERR_MSG_ATTR(info->extack, raddr, "error parsing remote addr"); + if (err < 0) goto create_err; - } if (!mptcp_pm_addr_families_match(sk, &entry.addr, &addr_r)) { GENL_SET_ERR_MSG(info, "families mismatch"); @@ -511,17 +505,13 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info laddr = info->attrs[MPTCP_PM_ATTR_ADDR]; err = mptcp_pm_parse_entry(laddr, info, true, &addr_l); - if (err < 0) { - NL_SET_ERR_MSG_ATTR(info->extack, laddr, "error parsing local addr"); + if (err < 0) goto destroy_err; - } raddr = info->attrs[MPTCP_PM_ATTR_ADDR_REMOTE]; err = mptcp_pm_parse_addr(raddr, info, &addr_r); - if (err < 0) { - NL_SET_ERR_MSG_ATTR(info->extack, raddr, "error parsing remote addr"); + if (err < 0) goto destroy_err; - } #if IS_ENABLED(CONFIG_MPTCP_IPV6) if (addr_l.addr.family == AF_INET && ipv6_addr_v4mapped(&addr_r.addr6)) { From patchwork Mon Jan 6 08:16:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13927047 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 1AF231D89FE for ; Mon, 6 Jan 2025 08:16:44 +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=1736151405; cv=none; b=BTKOawSg/PDKU+kTcinr73q4/VdG8HDy7cfAjv0Hrr9q8FX01NsTWhRj2PcTYh4Zu1R2AaKwXtcjPiAEgTRrez2gD8Foo35xSILuJ/z5yYqiklgWpJXOF03t8MaOkyLHpa6CSNc7R0bY/KFNn0qVJZT+Vbzqw2k4nLYH9KEPsjo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736151405; c=relaxed/simple; bh=XXsvtGwi1HTSCnqPYKBlOfWs13dziJtl9pbzNFDFRK8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XtPiirY2QH8YKj7ylI5lDOlPn1t+I5l2CDPSLi1P6Dd/OBvvqP2ZvnBRoyz87i4YOAWPpJIHzAW1Sa0I3R2jVHXpZ46PfXqXr0FFOkZlcCRx516HIvTqHvoUK9EtqWmZZM3hqECWCkwxKW0XUswdHh77dvrgeL9jWsquO7DHJl8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=by3J4utT; 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="by3J4utT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EEA0C4CEDF; Mon, 6 Jan 2025 08:16:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736151404; bh=XXsvtGwi1HTSCnqPYKBlOfWs13dziJtl9pbzNFDFRK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=by3J4utTMQf2zt7fAsbeLYhc3ELcc6xRxy/BCirR0LbIcXBz92kBfioTHbJQiPE06 3Sadn7JkYkXaLTnBhV3P8S+vWqGPvMZEw+/ErI4nWZinaq5R8IaqAdCxyhPiDKY0TI 8Dav0RJ07kFNJr5dC7+rcLvRCmnMpVofJ9sGIyXByXiJikVf8q3OcozptnhwfJ3wua cWWthfNZo7s73BdkZ36xv6ijvZDi8y7bG3g1FmhnQeeEOrIoIq+59ZUFcxWpS4KwNq rIGaUAORaLt6W9A7aajSHPAI0TMa8UPPmorkP8DMKz0+Gu2c0ysWO7h5Y1T4IzD4we psK9kXY9zMgmw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: "Matthieu Baerts (NGI0)" Subject: [PATCH mptcp-next v7 11/11] mptcp: pm: mark missing address attributes Date: Mon, 6 Jan 2025 16:16:16 +0800 Message-ID: <6db9c829384bf1d23b9fa571807910edfdddca7f.1736150983.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "Matthieu Baerts (NGI0)" mptcp_pm_parse_entry() will check if the given attribute is defined. If not, it will return a generic error: "missing address info". It might then not be clear for the userspace developer which attribute is missing, especially when the command takes multiple addresses. By using GENL_REQ_ATTR_CHECK(), the userspace will get a hint about which attribute is missing, making thing clearer. Note that this is what was already done for most of the other MPTCP NL commands, this patch simply adds the missing ones. Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 18 +++++++++++++++--- net/mptcp/pm_userspace.c | 6 +++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 528718cb70ec..46852c479b43 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1393,11 +1393,15 @@ static bool mptcp_pm_has_addr_attr_id(const struct nlattr *attr, int mptcp_pm_nl_add_addr_doit(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); struct mptcp_pm_addr_entry addr, *entry; + struct nlattr *attr; int ret; + if (GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ENDPOINT_ADDR)) + return -EINVAL; + + attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR]; ret = mptcp_pm_parse_entry(attr, info, true, &addr); if (ret < 0) return ret; @@ -1590,12 +1594,16 @@ static int mptcp_nl_remove_id_zero_address(struct net *net, int mptcp_pm_nl_del_addr_doit(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); struct mptcp_pm_addr_entry addr, *entry; unsigned int addr_max; + struct nlattr *attr; int ret; + if (GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ENDPOINT_ADDR)) + return -EINVAL; + + attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR]; ret = mptcp_pm_parse_entry(attr, info, false, &addr); if (ret < 0) return ret; @@ -1767,13 +1775,17 @@ int mptcp_nl_fill_addr(struct sk_buff *skb, 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); struct mptcp_pm_addr_entry addr, *entry; struct sk_buff *msg; + struct nlattr *attr; void *reply; int ret; + if (GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ENDPOINT_ADDR)) + return -EINVAL; + + attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR]; ret = mptcp_pm_parse_entry(attr, info, false, &addr); if (ret < 0) return ret; diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index dc9ebfb06d96..801b1280a1aa 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -663,20 +663,24 @@ int mptcp_userspace_pm_dump_addr(struct sk_buff *msg, int mptcp_userspace_pm_get_addr(struct sk_buff *skb, struct genl_info *info) { - struct nlattr *attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR]; struct mptcp_pm_addr_entry addr, *entry; struct mptcp_sock *msk; struct sk_buff *msg; + struct nlattr *attr; int ret = -EINVAL; struct sock *sk; void *reply; + if (GENL_REQ_ATTR_CHECK(info, MPTCP_PM_ENDPOINT_ADDR)) + return ret; + msk = mptcp_userspace_pm_get_sock(info); if (!msk) return ret; sk = (struct sock *)msk; + attr = info->attrs[MPTCP_PM_ENDPOINT_ADDR]; ret = mptcp_pm_parse_entry(attr, info, false, &addr); if (ret < 0) goto out;