]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
tcp: rename request_sock cookie_ts bit to syncookie
authorFlorian Westphal <fw@strlen.de>
Thu, 30 Jul 2020 19:25:50 +0000 (21:25 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 31 Jul 2020 23:55:32 +0000 (16:55 -0700)
Nowadays output function has a 'synack_type' argument that tells us when
the syn/ack is emitted via syncookies.

The request already tells us when timestamps are supported, so check
both to detect special timestamp for tcp option encoding is needed.

We could remove cookie_ts altogether, but a followup patch would
otherwise need to adjust function signatures to pass 'want_cookie' to
mptcp core.

This way, the 'existing' bit can be used.

Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/crypto/chelsio/chtls/chtls_cm.c
include/net/request_sock.h
net/ipv4/tcp_input.c
net/ipv4/tcp_output.c

index f924c335a1953ca9595deeca78faf2e2d9a0eb85..05520dccd906562b67ca4f489ded3a97c0edf31b 100644 (file)
@@ -1348,7 +1348,7 @@ static void chtls_pass_accept_request(struct sock *sk,
 
        oreq->rsk_rcv_wnd = 0;
        oreq->rsk_window_clamp = 0;
-       oreq->cookie_ts = 0;
+       oreq->syncookie = 0;
        oreq->mss = 0;
        oreq->ts_recent = 0;
 
index cf8b33213bbc283348fb7470c1ce8fd55cd9d508..b2eb8b4ba69780f148223e6c2337d8da73a81e02 100644 (file)
@@ -54,7 +54,7 @@ struct request_sock {
        struct request_sock             *dl_next;
        u16                             mss;
        u8                              num_retrans; /* number of retransmits */
-       u8                              cookie_ts:1; /* syncookie: encode tcpopts in timestamp */
+       u8                              syncookie:1; /* syncookie: encode tcpopts in timestamp */
        u8                              num_timeout:7; /* number of timeouts */
        u32                             ts_recent;
        struct timer_list               rsk_timer;
index a018bafd7bdf4174763086290750890cb315ca02..11a6f128e51cd4d18f55dc989b1c675b491e9e7f 100644 (file)
@@ -6519,7 +6519,6 @@ static void tcp_openreq_init(struct request_sock *req,
        struct inet_request_sock *ireq = inet_rsk(req);
 
        req->rsk_rcv_wnd = 0;           /* So that tcp_send_synack() knows! */
-       req->cookie_ts = 0;
        tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq;
        tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
        tcp_rsk(req)->snt_synack = 0;
@@ -6674,6 +6673,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
        if (!req)
                goto drop;
 
+       req->syncookie = want_cookie;
        tcp_rsk(req)->af_specific = af_ops;
        tcp_rsk(req)->ts_off = 0;
 #if IS_ENABLED(CONFIG_MPTCP)
@@ -6739,7 +6739,6 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
 
        if (want_cookie) {
                isn = cookie_init_sequence(af_ops, sk, skb, &req->mss);
-               req->cookie_ts = tmp_opt.tstamp_ok;
                if (!tmp_opt.tstamp_ok)
                        inet_rsk(req)->ecn_ok = 0;
        }
index d8f16f6a9b02efb55912e35700a08b5ee21d8877..85ff417bda7f4738491aa487fc9634442be7022c 100644 (file)
@@ -3393,7 +3393,7 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst,
        memset(&opts, 0, sizeof(opts));
        now = tcp_clock_ns();
 #ifdef CONFIG_SYN_COOKIES
-       if (unlikely(req->cookie_ts))
+       if (unlikely(synack_type == TCP_SYNACK_COOKIE && ireq->tstamp_ok))
                skb->skb_mstamp_ns = cookie_init_timestamp(req, now);
        else
 #endif