aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_fastopen.c
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2018-02-27 22:12:38 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2018-02-27 22:12:38 +0000
commit1c714531e8b70ac5931b0fb7f66d0d72d56ed48b (patch)
tree33d7802727c5cccd6c6a9d50c7ea326aa7d7c093 /sys/netinet/tcp_fastopen.c
parentfb7275bedb20e362401aa8bcf0e298e8f4bf5a17 (diff)
downloadsrc-1c714531e8b70ac5931b0fb7f66d0d72d56ed48b.tar.gz
src-1c714531e8b70ac5931b0fb7f66d0d72d56ed48b.zip
When checking the TCP fast cookie length, conststently also check
for the minimum length. This fixes a bug where cookies of length 2 bytes (which is smaller than the minimum length of 4) is provided by the server. Sponsored by: Netflix, Inc.
Notes
Notes: svn path=/head/; revision=330089
Diffstat (limited to 'sys/netinet/tcp_fastopen.c')
-rw-r--r--sys/netinet/tcp_fastopen.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/netinet/tcp_fastopen.c b/sys/netinet/tcp_fastopen.c
index 9176c0d640bd..d9ec9524033f 100644
--- a/sys/netinet/tcp_fastopen.c
+++ b/sys/netinet/tcp_fastopen.c
@@ -1071,7 +1071,8 @@ tcp_fastopen_ccache_create(struct tcp_fastopen_ccache_bucket *ccb,
cce->cce_server_ip.v6 = inc->inc6_faddr;
}
cce->server_port = inc->inc_fport;
- if ((cookie_len <= TCP_FASTOPEN_MAX_COOKIE_LEN) &&
+ if ((cookie_len >= TCP_FASTOPEN_MIN_COOKIE_LEN) &&
+ (cookie_len <= TCP_FASTOPEN_MAX_COOKIE_LEN) &&
((cookie_len & 0x1) == 0)) {
cce->server_mss = mss;
cce->cookie_len = cookie_len;