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

Commit

Permalink
mptcp: Fix: Correct version-negotiation when SYN-cookies are set
Browse files Browse the repository at this point in the history
We need to check for the negotiated version when SYN-cookies are set.

Fixes: c9b4b66 ("mptcp: Add MPTCP version control")
Signed-off-by: Christoph Paasch <cpaasch@apple.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
(cherry picked from commit 8b05397)
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
  • Loading branch information
cpaasch authored and matttbe committed Jul 20, 2018
1 parent 5723e3d commit 80b661f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion net/mptcp/mptcp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ static void mptcp_reqsk_new_mptcp(struct request_sock *req,
const struct tcp_sock *tp = tcp_sk(sk);

inet_rsk(req)->saw_mpc = 1;

/* MPTCP version agreement */
if (mopt->mptcp_ver >= tp->mptcp_ver)
mtreq->mptcp_ver = tp->mptcp_ver;
Expand All @@ -316,11 +317,18 @@ static void mptcp_reqsk_new_mptcp(struct request_sock *req,
}

static int mptcp_reqsk_new_cookie(struct request_sock *req,
const struct sock *sk,
const struct mptcp_options_received *mopt,
const struct sk_buff *skb)
{
struct mptcp_request_sock *mtreq = mptcp_rsk(req);

/* MPTCP version agreement */
if (mopt->mptcp_ver >= tcp_sk(sk)->mptcp_ver)
mtreq->mptcp_ver = tcp_sk(sk)->mptcp_ver;
else
mtreq->mptcp_ver = mopt->mptcp_ver;

rcu_read_lock_bh();
spin_lock(&mptcp_tk_hashlock);

Expand Down Expand Up @@ -2338,7 +2346,7 @@ void mptcp_reqsk_init(struct request_sock *req, const struct sock *sk,
mtreq->dss_csum = mopt.dss_csum;

if (want_cookie) {
if (!mptcp_reqsk_new_cookie(req, &mopt, skb))
if (!mptcp_reqsk_new_cookie(req, sk, &mopt, skb))
/* No key available - back to regular TCP */
inet_rsk(req)->mptcp_rqsk = 0;
return;
Expand Down

0 comments on commit 80b661f

Please sign in to comment.