Skip to content

Commit

Permalink
mptcp: add addr into pm anno_list
Browse files Browse the repository at this point in the history
Add address into pm anno_list in mptcp_nl_cmd_sf_create(). Remove
it when connecting fails.

By doing this, the "REMOVE" command also works with subflows that have
been created via the "SUB_CREATE" command instead of restricting to
the addresses that have been announced via the "ANNOUNCE" command.

Fixes: d9a4594 ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE")
Link: multipath-tcp/mptcp_net-next#379
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
  • Loading branch information
geliangtang authored and intel-lab-lkp committed Apr 25, 2023
1 parent 3370671 commit c4a1d38
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions net/mptcp/pm_userspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,14 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info)
goto create_err;
}

spin_lock_bh(&msk->pm.lock);
if (!mptcp_pm_alloc_anno_list(msk, &local)) {
mptcp_userspace_pm_delete_local_addr(msk, &local);
spin_unlock_bh(&msk->pm.lock);
goto create_err;
}
spin_unlock_bh(&msk->pm.lock);

lock_sock(sk);

err = __mptcp_subflow_connect(sk, &addr_l, &addr_r);
Expand All @@ -335,6 +343,7 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info)

if (err) {
spin_lock_bh(&msk->pm.lock);
mptcp_pm_remove_anno_list_by_saddr(msk, &addr_l);
mptcp_userspace_pm_delete_local_addr(msk, &local);
spin_unlock_bh(&msk->pm.lock);
}
Expand Down

0 comments on commit c4a1d38

Please sign in to comment.