aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorGao Feng <fgao@ikuai8.com>2017-04-04 09:09:48 -0400
committerDavid S. Miller <davem@davemloft.net>2017-04-05 10:50:32 -0400
commit589c49cbf9674808fd4ac9b7c17155abc0686f86 (patch)
tree7065ecc4a28f72a6fd73570a0b793d92fee62e88 /net/ipv4/tcp_input.c
parent5e351410667ab0bf0dd1845730cba8b2211781e7 (diff)
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.c9
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,
3759 !estab && sysctl_tcp_window_scaling) { 3759 !estab && sysctl_tcp_window_scaling) {
3760 __u8 snd_wscale = *(__u8 *)ptr; 3760 __u8 snd_wscale = *(__u8 *)ptr;
3761 opt_rx->wscale_ok = 1; 3761 opt_rx->wscale_ok = 1;
3762 if (snd_wscale > 14) { 3762 if (snd_wscale > TCP_MAX_WSCALE) {
3763 net_info_ratelimited("%s: Illegal window scaling value %d >14 received\n", 3763 net_info_ratelimited("%s: Illegal window scaling value %d > %u received\n",
3764 __func__, 3764 __func__,
3765 snd_wscale); 3765 snd_wscale,
3766 snd_wscale = 14; 3766 TCP_MAX_WSCALE);
3767 snd_wscale = TCP_MAX_WSCALE;
3767 } 3768 }
3768 opt_rx->snd_wscale = snd_wscale; 3769 opt_rx->snd_wscale = snd_wscale;
3769 } 3770 }