Skip to content

Commit bc58a1b

Browse files
Hans Wippeldavem330
authored andcommitted
net/ipv4: disable SMC TCP option with SYN Cookies
Currently, the SMC experimental TCP option in a SYN packet is lost on the server side when SYN Cookies are active. However, the corresponding SYNACK sent back to the client contains the SMC option. This causes an inconsistent view of the SMC capabilities on the client and server. This patch disables the SMC option in the SYNACK when SYN Cookies are active to avoid this issue. Fixes: 60e2a77 ("tcp: TCP experimental option for SMC") Signed-off-by: Hans Wippel <[email protected]> Signed-off-by: Ursula Braun <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b9ee96b commit bc58a1b

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

net/ipv4/syncookies.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
349349
req->ts_recent = tcp_opt.saw_tstamp ? tcp_opt.rcv_tsval : 0;
350350
treq->snt_synack = 0;
351351
treq->tfo_listener = false;
352+
if (IS_ENABLED(CONFIG_SMC))
353+
ireq->smc_ok = 0;
352354

353355
ireq->ir_iif = inet_request_bound_dev_if(sk, skb);
354356

net/ipv4/tcp_input.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6256,6 +6256,9 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
62566256
if (want_cookie && !tmp_opt.saw_tstamp)
62576257
tcp_clear_options(&tmp_opt);
62586258

6259+
if (IS_ENABLED(CONFIG_SMC) && want_cookie)
6260+
tmp_opt.smc_ok = 0;
6261+
62596262
tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
62606263
tcp_openreq_init(req, &tmp_opt, skb, sk);
62616264
inet_rsk(req)->no_srccheck = inet_sk(sk)->transparent;

net/ipv6/syncookies.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
217217
treq->snt_isn = cookie;
218218
treq->ts_off = 0;
219219
treq->txhash = net_tx_rndhash();
220+
if (IS_ENABLED(CONFIG_SMC))
221+
ireq->smc_ok = 0;
220222

221223
/*
222224
* We need to lookup the dst_entry to get the correct window size.

0 commit comments

Comments
 (0)