mptcp: add the incoming RM_ADDR support
This patch added the RM_ADDR option parsing logic: We parsed the incoming options to find if the rm_addr option is received, and called mptcp_pm_rm_addr_received to schedule PM work to a new status, named MPTCP_PM_RM_ADDR_RECEIVED. PM work got this status, and called mptcp_pm_nl_rm_addr_received to handle it. In mptcp_pm_nl_rm_addr_received, we closed the subflow matching the rm_id, and updated PM counter. Suggested-by: Matthieu Baerts <matthieu.baerts@tessares.net> Suggested-by: Paolo Abeni <pabeni@redhat.com> Suggested-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: Geliang Tang <geliangtang@gmail.com> Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
5cb104ae55
commit
d0876b2284
@@ -268,6 +268,40 @@ void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
|
||||
spin_lock_bh(&msk->pm.lock);
|
||||
}
|
||||
|
||||
void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk)
|
||||
{
|
||||
struct mptcp_subflow_context *subflow, *tmp;
|
||||
struct sock *sk = (struct sock *)msk;
|
||||
|
||||
pr_debug("address rm_id %d", msk->pm.rm_id);
|
||||
|
||||
if (!msk->pm.rm_id)
|
||||
return;
|
||||
|
||||
if (list_empty(&msk->conn_list))
|
||||
return;
|
||||
|
||||
list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) {
|
||||
struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
|
||||
int how = RCV_SHUTDOWN | SEND_SHUTDOWN;
|
||||
long timeout = 0;
|
||||
|
||||
if (msk->pm.rm_id != subflow->remote_id)
|
||||
continue;
|
||||
|
||||
spin_unlock_bh(&msk->pm.lock);
|
||||
mptcp_subflow_shutdown(sk, ssk, how);
|
||||
__mptcp_close_ssk(sk, ssk, subflow, timeout);
|
||||
spin_lock_bh(&msk->pm.lock);
|
||||
|
||||
msk->pm.add_addr_accepted--;
|
||||
msk->pm.subflows--;
|
||||
WRITE_ONCE(msk->pm.accept_addr, true);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static bool address_use_port(struct mptcp_pm_addr_entry *entry)
|
||||
{
|
||||
return (entry->addr.flags &
|
||||
|
Reference in New Issue
Block a user