Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
mptcp:fm: recreate subflows after an error
Browse files Browse the repository at this point in the history
If a subflow is closed because of an error, it will be recreated if
create_on_err parameter is set.

For that, we need to store the previously recorded error (sk->sk_err)
and look at it when closing the subflow.

Note that here, we limit the retry on ETIMEDOUT error, like it was done
before. Otherwise, we might end up looping on subflow-creations, if we
are sending a SYN+MP_JOIN that results in a TCP-RST (ECONNREFUSED).

Fixes: 133537d (mptcp: Recreate subflows after a timeout)
Signed-off-by: Matthieu Baerts <[email protected]>
Signed-off-by: Christoph Paasch <[email protected]>
  • Loading branch information
matttbe authored and cpaasch committed Jan 23, 2019
1 parent 849e3ed commit ed30364
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/net/mptcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ struct mptcp_tcp_sock {
u8 path_index;
u8 loc_id;
u8 rem_id;
u8 sk_err;

#define MPTCP_SCHED_SIZE 16
u8 mptcp_sched[MPTCP_SCHED_SIZE] __aligned(8);
Expand Down
3 changes: 3 additions & 0 deletions net/mptcp/mptcp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,9 @@ static void mptcp_sock_def_error_report(struct sock *sk)
}
}

/* record this info that can be used by PM after the sf close */
tp->mptcp->sk_err = sk->sk_err;

if (mpcb->infinite_mapping_rcv || mpcb->infinite_mapping_snd ||
mpcb->send_infinite_mapping) {
struct sock *meta_sk = mptcp_meta_sk(sk);
Expand Down
8 changes: 8 additions & 0 deletions net/mptcp/mptcp_fullmesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1686,12 +1686,16 @@ static void full_mesh_delete_subflow(struct sock *sk)
{
struct fullmesh_priv *fmp = fullmesh_get_priv(tcp_sk(sk)->mpcb);
struct mptcp_fm_ns *fm_ns = fm_get_ns(sock_net(sk));
struct sock *meta_sk = mptcp_meta_sk(sk);
struct mptcp_loc_addr *mptcp_local;
int index, i;

if (!create_on_err)
return;

if (!mptcp_can_new_subflow(meta_sk))
return;

rcu_read_lock_bh();
mptcp_local = rcu_dereference_bh(fm_ns->local);

Expand Down Expand Up @@ -1741,6 +1745,10 @@ static void full_mesh_delete_subflow(struct sock *sk)

out:
rcu_read_unlock_bh();

/* re-schedule the creation of failed subflows */
if (tcp_sk(sk)->mptcp->sk_err == ETIMEDOUT || sk->sk_err == ETIMEDOUT)
full_mesh_create_subflows(meta_sk);
}

/* Output /proc/net/mptcp_fullmesh */
Expand Down

0 comments on commit ed30364

Please sign in to comment.