diff options
author | Wei Wang <weiwan@google.com> | 2017-01-23 13:59:20 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-25 14:04:38 -0500 |
commit | 065263f40f0972d5f1cd294bb0242bd5aa5f06b2 (patch) | |
tree | c8d7915e4b9cb64a7e069b2842897af5b5c73f85 /net/ipv4/tcp_output.c | |
parent | a9c54ad2c737853b1f404b10b09da4ca7fa18597 (diff) |
net/tcp-fastopen: refactor cookie check logic
Refactor the cookie check logic in tcp_send_syn_data() into a function.
This function will be called else where in later changes.
Signed-off-by: Wei Wang <weiwan@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r-- | net/ipv4/tcp_output.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 9a1a1494b9dd..671c69535671 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -3267,23 +3267,11 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) | |||
3267 | { | 3267 | { |
3268 | struct tcp_sock *tp = tcp_sk(sk); | 3268 | struct tcp_sock *tp = tcp_sk(sk); |
3269 | struct tcp_fastopen_request *fo = tp->fastopen_req; | 3269 | struct tcp_fastopen_request *fo = tp->fastopen_req; |
3270 | int syn_loss = 0, space, err = 0; | 3270 | int space, err = 0; |
3271 | unsigned long last_syn_loss = 0; | ||
3272 | struct sk_buff *syn_data; | 3271 | struct sk_buff *syn_data; |
3273 | 3272 | ||
3274 | tp->rx_opt.mss_clamp = tp->advmss; /* If MSS is not cached */ | 3273 | tp->rx_opt.mss_clamp = tp->advmss; /* If MSS is not cached */ |
3275 | tcp_fastopen_cache_get(sk, &tp->rx_opt.mss_clamp, &fo->cookie, | 3274 | if (!tcp_fastopen_cookie_check(sk, &tp->rx_opt.mss_clamp, &fo->cookie)) |
3276 | &syn_loss, &last_syn_loss); | ||
3277 | /* Recurring FO SYN losses: revert to regular handshake temporarily */ | ||
3278 | if (syn_loss > 1 && | ||
3279 | time_before(jiffies, last_syn_loss + (60*HZ << syn_loss))) { | ||
3280 | fo->cookie.len = -1; | ||
3281 | goto fallback; | ||
3282 | } | ||
3283 | |||
3284 | if (sysctl_tcp_fastopen & TFO_CLIENT_NO_COOKIE) | ||
3285 | fo->cookie.len = -1; | ||
3286 | else if (fo->cookie.len <= 0) | ||
3287 | goto fallback; | 3275 | goto fallback; |
3288 | 3276 | ||
3289 | /* MSS for SYN-data is based on cached MSS and bounded by PMTU and | 3277 | /* MSS for SYN-data is based on cached MSS and bounded by PMTU and |