diff options
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 24f1630b2afb..031cf72cd05c 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -5378,8 +5378,8 @@ static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack, | |||
5378 | { | 5378 | { |
5379 | struct tcp_sock *tp = tcp_sk(sk); | 5379 | struct tcp_sock *tp = tcp_sk(sk); |
5380 | struct sk_buff *data = tp->syn_data ? tcp_write_queue_head(sk) : NULL; | 5380 | struct sk_buff *data = tp->syn_data ? tcp_write_queue_head(sk) : NULL; |
5381 | u16 mss = tp->rx_opt.mss_clamp; | 5381 | u16 mss = tp->rx_opt.mss_clamp, try_exp = 0; |
5382 | bool syn_drop; | 5382 | bool syn_drop = false; |
5383 | 5383 | ||
5384 | if (mss == tp->rx_opt.user_mss) { | 5384 | if (mss == tp->rx_opt.user_mss) { |
5385 | struct tcp_options_received opt; | 5385 | struct tcp_options_received opt; |
@@ -5391,16 +5391,25 @@ static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack, | |||
5391 | mss = opt.mss_clamp; | 5391 | mss = opt.mss_clamp; |
5392 | } | 5392 | } |
5393 | 5393 | ||
5394 | if (!tp->syn_fastopen) /* Ignore an unsolicited cookie */ | 5394 | if (!tp->syn_fastopen) { |
5395 | /* Ignore an unsolicited cookie */ | ||
5395 | cookie->len = -1; | 5396 | cookie->len = -1; |
5397 | } else if (tp->total_retrans) { | ||
5398 | /* SYN timed out and the SYN-ACK neither has a cookie nor | ||
5399 | * acknowledges data. Presumably the remote received only | ||
5400 | * the retransmitted (regular) SYNs: either the original | ||
5401 | * SYN-data or the corresponding SYN-ACK was dropped. | ||
5402 | */ | ||
5403 | syn_drop = (cookie->len < 0 && data); | ||
5404 | } else if (cookie->len < 0 && !tp->syn_data) { | ||
5405 | /* We requested a cookie but didn't get it. If we did not use | ||
5406 | * the (old) exp opt format then try so next time (try_exp=1). | ||
5407 | * Otherwise we go back to use the RFC7413 opt (try_exp=2). | ||
5408 | */ | ||
5409 | try_exp = tp->syn_fastopen_exp ? 2 : 1; | ||
5410 | } | ||
5396 | 5411 | ||
5397 | /* The SYN-ACK neither has cookie nor acknowledges the data. Presumably | 5412 | tcp_fastopen_cache_set(sk, mss, cookie, syn_drop, try_exp); |
5398 | * the remote receives only the retransmitted (regular) SYNs: either | ||
5399 | * the original SYN-data or the corresponding SYN-ACK is lost. | ||
5400 | */ | ||
5401 | syn_drop = (cookie->len <= 0 && data && tp->total_retrans); | ||
5402 | |||
5403 | tcp_fastopen_cache_set(sk, mss, cookie, syn_drop); | ||
5404 | 5413 | ||
5405 | if (data) { /* Retransmit unacked data in SYN */ | 5414 | if (data) { /* Retransmit unacked data in SYN */ |
5406 | tcp_for_write_queue_from(data, sk) { | 5415 | tcp_for_write_queue_from(data, sk) { |