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: d9a4594edabf ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE")
Link: https://github.com/multipath-tcp/mptcp_net-next/issues/379
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
net/mptcp/pm_userspace.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index b494c72efe2b..47aea147e334 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -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);
@@ -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);
}
--
2.35.3