diff options
author | Gao Feng <fgao@ikuai8.com> | 2017-04-04 21:09:48 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-05 07:50:32 -0700 |
commit | 589c49cbf9674808fd4ac9b7c17155abc0686f86 (patch) | |
tree | 7065ecc4a28f72a6fd73570a0b793d92fee62e88 /net/ipv4/tcp_input.c | |
parent | 5e351410667ab0bf0dd1845730cba8b2211781e7 (diff) | |
download | lwn-589c49cbf9674808fd4ac9b7c17155abc0686f86.tar.gz lwn-589c49cbf9674808fd4ac9b7c17155abc0686f86.zip |
net: tcp: Define the TCP_MAX_WSCALE instead of literal number 14
Define one new macro TCP_MAX_WSCALE instead of literal number '14',
and use U16_MAX instead of 65535 as the max value of TCP window.
There is another minor change, use rounddown(space, mss) instead of
(space / mss) * mss;
Signed-off-by: Gao Feng <fgao@ikuai8.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index a75c48f62e27..ed6606cf5b3e 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -3759,11 +3759,12 @@ void tcp_parse_options(const struct sk_buff *skb, !estab && sysctl_tcp_window_scaling) { __u8 snd_wscale = *(__u8 *)ptr; opt_rx->wscale_ok = 1; - if (snd_wscale > 14) { - net_info_ratelimited("%s: Illegal window scaling value %d >14 received\n", + if (snd_wscale > TCP_MAX_WSCALE) { + net_info_ratelimited("%s: Illegal window scaling value %d > %u received\n", __func__, - snd_wscale); - snd_wscale = 14; + snd_wscale, + TCP_MAX_WSCALE); + snd_wscale = TCP_MAX_WSCALE; } opt_rx->snd_wscale = snd_wscale; } |