Blob Blame History Raw
From: Stefan Raspl <raspl@linux.ibm.com>
Subject: net/ipv4: disable SMC TCP option with SYN Cookies
Patch-mainline: v4.16
Git-commit: bc58a1baf2a97838a422ce4e75180c4b680e7a9b
References: FATE#325694, LTC#167874, bsc#1113480

Summary:     net/smc: SMC-R MVP
Description: Add latest upstream patches to push SMC-R to the MVP level

Upstream-Description:

             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: 60e2a7780793b ("tcp: TCP experimental option for SMC")
             Signed-off-by: Hans Wippel <hwippel@linux.vnet.ibm.com>
             Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
             Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Stefan Raspl <raspl@linux.ibm.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 net/ipv4/syncookies.c |    2 ++
 net/ipv4/tcp_input.c  |    3 +++
 net/ipv6/syncookies.c |    2 ++
 3 files changed, 7 insertions(+)

--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -346,6 +346,8 @@ struct sock *cookie_v4_check(struct sock
 	req->ts_recent		= tcp_opt.saw_tstamp ? tcp_opt.rcv_tsval : 0;
 	treq->snt_synack	= 0;
 	treq->tfo_listener	= false;
+	if (IS_ENABLED(CONFIG_SMC))
+		ireq->smc_ok = 0;
 
 	ireq->ir_iif = inet_request_bound_dev_if(sk, skb);
 
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6285,6 +6285,9 @@ int tcp_conn_request(struct request_sock
 	if (want_cookie && !tmp_opt.saw_tstamp)
 		tcp_clear_options(&tmp_opt);
 
+	if (IS_ENABLED(CONFIG_SMC) && want_cookie)
+		tmp_opt.smc_ok = 0;
+
 	tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
 	tcp_openreq_init(req, &tmp_opt, skb, sk);
 	inet_rsk(req)->no_srccheck = inet_sk(sk)->transparent;
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -216,6 +216,8 @@ struct sock *cookie_v6_check(struct sock
 	treq->snt_isn = cookie;
 	treq->ts_off = 0;
 	treq->txhash = net_tx_rndhash();
+	if (IS_ENABLED(CONFIG_SMC))
+		ireq->smc_ok = 0;
 
 	/*
 	 * We need to lookup the dst_entry to get the correct window size.