Skip to content

Commit f8ace8d

Browse files
Florian Westphaldavem330
authored andcommitted
tcp: rename request_sock cookie_ts bit to syncookie
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 <[email protected]> Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 77aec5e commit f8ace8d

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

drivers/crypto/chelsio/chtls/chtls_cm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ static void chtls_pass_accept_request(struct sock *sk,
13481348

13491349
oreq->rsk_rcv_wnd = 0;
13501350
oreq->rsk_window_clamp = 0;
1351-
oreq->cookie_ts = 0;
1351+
oreq->syncookie = 0;
13521352
oreq->mss = 0;
13531353
oreq->ts_recent = 0;
13541354

include/net/request_sock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct request_sock {
5454
struct request_sock *dl_next;
5555
u16 mss;
5656
u8 num_retrans; /* number of retransmits */
57-
u8 cookie_ts:1; /* syncookie: encode tcpopts in timestamp */
57+
u8 syncookie:1; /* syncookie: encode tcpopts in timestamp */
5858
u8 num_timeout:7; /* number of timeouts */
5959
u32 ts_recent;
6060
struct timer_list rsk_timer;

net/ipv4/tcp_input.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6519,7 +6519,6 @@ static void tcp_openreq_init(struct request_sock *req,
65196519
struct inet_request_sock *ireq = inet_rsk(req);
65206520

65216521
req->rsk_rcv_wnd = 0; /* So that tcp_send_synack() knows! */
6522-
req->cookie_ts = 0;
65236522
tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq;
65246523
tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
65256524
tcp_rsk(req)->snt_synack = 0;
@@ -6674,6 +6673,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
66746673
if (!req)
66756674
goto drop;
66766675

6676+
req->syncookie = want_cookie;
66776677
tcp_rsk(req)->af_specific = af_ops;
66786678
tcp_rsk(req)->ts_off = 0;
66796679
#if IS_ENABLED(CONFIG_MPTCP)
@@ -6739,7 +6739,6 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
67396739

67406740
if (want_cookie) {
67416741
isn = cookie_init_sequence(af_ops, sk, skb, &req->mss);
6742-
req->cookie_ts = tmp_opt.tstamp_ok;
67436742
if (!tmp_opt.tstamp_ok)
67446743
inet_rsk(req)->ecn_ok = 0;
67456744
}

net/ipv4/tcp_output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3393,7 +3393,7 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst,
33933393
memset(&opts, 0, sizeof(opts));
33943394
now = tcp_clock_ns();
33953395
#ifdef CONFIG_SYN_COOKIES
3396-
if (unlikely(req->cookie_ts))
3396+
if (unlikely(synack_type == TCP_SYNACK_COOKIE && ireq->tstamp_ok))
33973397
skb->skb_mstamp_ns = cookie_init_timestamp(req, now);
33983398
else
33993399
#endif

0 commit comments

Comments
 (0)