Hi Geliang,
Thank you for the patch.
On 22/10/2024 11:14, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> Just like in-kernel pm, when userspace pm does set_flags, it needs to send
> out MP_PRIO signal, and also modify the flags of the corresponding address
> entry in the local address list. This patch implements the missing logic.
>
> Fixes: 892f396c8e68 ("mptcp: netlink: issue MP_PRIO signals from userspace PMs")
If it is a fix, can you extract this patch, and target mptcp-net please?
When you will do that, you will also need to add
mptcp_userspace_pm_lookup_addr() helper: can you do that in the same
patch, but using list_for_each_entry(), not mptcp_for_each_address()
(nor the new version)? That way, it will be easier to backport the patch
without having to depend on other patches or having too many changes.
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> net/mptcp/pm_userspace.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
> index d815bfa57532..ec2ac0f9c8f5 100644
> --- a/net/mptcp/pm_userspace.c
> +++ b/net/mptcp/pm_userspace.c
> @@ -543,6 +543,7 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info)
> 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_pm_addr_entry *entry;
> struct mptcp_sock *msk;
> int ret = -EINVAL;
> struct sock *sk;
> @@ -574,6 +575,16 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info)
> if (loc.flags & MPTCP_PM_ADDR_FLAG_BACKUP)
> 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;
> + }
> + spin_unlock_bh(&msk->pm.lock);
> +
> lock_sock(sk);
> ret = mptcp_pm_nl_mp_prio_send_ack(msk, &loc.addr, &rem.addr, bkup);
> release_sock(sk);
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.