Skip to content

Commit

Permalink
net: mptcp: don't hang in mptcp_sendmsg() after TCP fallback
Browse files Browse the repository at this point in the history
it's still possible for packetdrill to hang in mptcp_sendmsg(), when the
MPTCP socket falls back to regular TCP (e.g. after receiving unsupported
flags/version during the three-way handshake). Adjust MPTCP socket state
earlier, to ensure correct functionality of mptcp_sendmsg() even in case
of TCP fallback.

Fixes: 767d3de ("net: mptcp: don't hang before sending 'MP capable with data'")
Fixes: 1954b86 ("mptcp: Check connection state before attempting send")
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
dcaratti authored and davem330 committed Mar 24, 2020
1 parent b69bbab commit c3c123d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 0 additions & 4 deletions net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,10 +1055,6 @@ void mptcp_finish_connect(struct sock *ssk)
WRITE_ONCE(msk->write_seq, subflow->idsn + 1);
WRITE_ONCE(msk->ack_seq, ack_seq);
WRITE_ONCE(msk->can_ack, 1);
if (inet_sk_state_load(sk) != TCP_ESTABLISHED) {
inet_sk_state_store(sk, TCP_ESTABLISHED);
sk->sk_state_change(sk);
}
}

static void mptcp_sock_graft(struct sock *sk, struct socket *parent)
Expand Down
6 changes: 6 additions & 0 deletions net/mptcp/subflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,15 @@ static void subflow_v6_init_req(struct request_sock *req,
static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
{
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
struct sock *parent = subflow->conn;

subflow->icsk_af_ops->sk_rx_dst_set(sk, skb);

if (inet_sk_state_load(parent) != TCP_ESTABLISHED) {
inet_sk_state_store(parent, TCP_ESTABLISHED);
parent->sk_state_change(parent);
}

if (!subflow->conn_finished) {
pr_debug("subflow=%p, remote_key=%llu", mptcp_subflow_ctx(sk),
subflow->remote_key);
Expand Down

0 comments on commit c3c123d

Please sign in to comment.