net/ipv4: disable SMC TCP option with SYN Cookies
authorHans Wippel <hwippel@linux.vnet.ibm.com>
Fri, 23 Mar 2018 10:05:45 +0000 (11:05 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 26 Mar 2018 00:53:54 +0000 (20:53 -0400)
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>
net/ipv4/syncookies.c
net/ipv4/tcp_input.c
net/ipv6/syncookies.c

index fda37f2862c923eb8b6d0b49d9442950fc6a7446..c3387dfd725bf99bcddefb9fb4f1dc98f5dd7f23 100644 (file)
@@ -349,6 +349,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
        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);
 
index 9a1b3c1c1c1473829e6d975f97a864b9acd4a6d6..ff6cd98ce8d5b4f67d15a88040a662494f0de3b9 100644 (file)
@@ -6256,6 +6256,9 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
        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;
index e7a3a6b6cf5650f1036b875688b48f3ee2f9c967..e997141aed8c059c40e6e5f0229e256317a8b483 100644 (file)
@@ -217,6 +217,8 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
        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.