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

Commit

Permalink
mptcp: Support randomized Timestamps on SYN-Cookies
Browse files Browse the repository at this point in the history
Since commit 84b114b ("tcp: randomize timestamps on syncookies"),
the TCP-stack supports randomized timestamps on SYN-cookies. We need to
handle this correctly as well in MPTCP.

Fixes: 3ab6fb6 ("Merge tag 'v4.12' into mptcp_trunk")
Signed-off-by: Christoph Paasch <[email protected]>
Signed-off-by: Matthieu Baerts <[email protected]>
  • Loading branch information
cpaasch authored and matttbe committed Mar 8, 2019
1 parent 79d7578 commit 95520ec
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions include/net/mptcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ int mptcp_create_master_sk(struct sock *meta_sk, __u64 remote_key,
int mptcp_check_req_fastopen(struct sock *child, struct request_sock *req);
int mptcp_check_req_master(struct sock *sk, struct sock *child,
struct request_sock *req, const struct sk_buff *skb,
int drop);
int drop, u32 tsoff);
struct sock *mptcp_check_req_child(struct sock *meta_sk,
struct sock *child,
struct request_sock *req,
Expand Down Expand Up @@ -1389,7 +1389,8 @@ static inline int mptcp_check_req_master(const struct sock *sk,
const struct sock *child,
const struct request_sock *req,
const struct sk_buff *skb,
int drop)
int drop,
u32 tsoff)
{
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/syncookies.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb,
if (!child)
goto listen_overflow;

ret = mptcp_check_req_master(sk, child, req, skb, 0);
ret = mptcp_check_req_master(sk, child, req, skb, 0, tsoff);
if (ret < 0)
return NULL;

Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/tcp_minisocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
goto listen_overflow;

if (own_req && !is_meta_sk(sk)) {
int ret = mptcp_check_req_master(sk, child, req, skb, 1);
int ret = mptcp_check_req_master(sk, child, req, skb, 1, 0);
if (ret < 0)
goto listen_overflow;

Expand Down
3 changes: 2 additions & 1 deletion net/mptcp/mptcp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2180,7 +2180,7 @@ int mptcp_check_req_fastopen(struct sock *child, struct request_sock *req)

int mptcp_check_req_master(struct sock *sk, struct sock *child,
struct request_sock *req, const struct sk_buff *skb,
int drop)
int drop, u32 tsoff)
{
struct sock *meta_sk = child;
int ret;
Expand All @@ -2201,6 +2201,7 @@ int mptcp_check_req_master(struct sock *sk, struct sock *child,
} else {
/* Thus, we come from syn-cookies */
refcount_set(&req->rsk_refcnt, 1);
tcp_sk(meta_sk)->tsoffset = tsoff;
if (!inet_csk_reqsk_queue_add(sk, req, meta_sk)) {
bh_unlock_sock(meta_sk);
sock_put(meta_sk);
Expand Down

0 comments on commit 95520ec

Please sign in to comment.