Skip to content

Commit ae5fd10

Browse files
Geliang Tangintel-lab-lkp
authored andcommitted
mptcp: update local address flags when setting it
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. Use mptcp_userspace_pm_lookup_addr() helper to find the address entry on userspace_pm_local_addr_list, if bkup is true, set the flags of the address entry with FLAG_BACKUP, otherwise, clear FLAG_BACKUP. Fixes: 892f396 ("mptcp: netlink: issue MP_PRIO signals from userspace PMs") Signed-off-by: Geliang Tang <[email protected]>
1 parent 7af4565 commit ae5fd10

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

net/mptcp/pm_userspace.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info)
562562
struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN];
563563
struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR];
564564
struct net *net = sock_net(skb->sk);
565+
struct mptcp_pm_addr_entry *entry;
565566
struct mptcp_sock *msk;
566567
int ret = -EINVAL;
567568
struct sock *sk;
@@ -603,6 +604,16 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info)
603604
if (loc.flags & MPTCP_PM_ADDR_FLAG_BACKUP)
604605
bkup = 1;
605606

607+
spin_lock_bh(&msk->pm.lock);
608+
entry = mptcp_userspace_pm_lookup_addr(msk, &loc.addr);
609+
if (entry) {
610+
if (bkup)
611+
entry->flags |= MPTCP_PM_ADDR_FLAG_BACKUP;
612+
else
613+
entry->flags &= ~MPTCP_PM_ADDR_FLAG_BACKUP;
614+
}
615+
spin_unlock_bh(&msk->pm.lock);
616+
606617
lock_sock(sk);
607618
ret = mptcp_pm_nl_mp_prio_send_ack(msk, &loc.addr, &rem.addr, bkup);
608619
release_sock(sk);

0 commit comments

Comments
 (0)