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>
This commit is contained in:
committed by
David S. Miller
parent
5e35141066
commit
589c49cbf9
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user