Skip to content

Commit 122868b

Browse files
gfreewindummakynes
authored andcommitted
netfilter: tcp: Use TCP_MAX_WSCALE instead of literal 14
The window scale may be enlarged from 14 to 15 according to the itef draft https://tools.ietf.org/html/draft-nishida-tcpm-maxwin-03. Use the macro TCP_MAX_WSCALE to support it easily with TCP stack in the future. Signed-off-by: Gao Feng <fgao@ikuai8.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent be7be6e commit 122868b

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

net/netfilter/nf_conntrack_proto_tcp.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,9 @@ static void tcp_options(const struct sk_buff *skb,
419419
&& opsize == TCPOLEN_WINDOW) {
420420
state->td_scale = *(u_int8_t *)ptr;
421421

422-
if (state->td_scale > 14) {
423-
/* See RFC1323 */
424-
state->td_scale = 14;
425-
}
422+
if (state->td_scale > TCP_MAX_WSCALE)
423+
state->td_scale = TCP_MAX_WSCALE;
424+
426425
state->flags |=
427426
IP_CT_TCP_FLAG_WINDOW_SCALE;
428427
}

net/netfilter/nf_synproxy_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,
6666
case TCPOPT_WINDOW:
6767
if (opsize == TCPOLEN_WINDOW) {
6868
opts->wscale = *ptr;
69-
if (opts->wscale > 14)
70-
opts->wscale = 14;
69+
if (opts->wscale > TCP_MAX_WSCALE)
70+
opts->wscale = TCP_MAX_WSCALE;
7171
opts->options |= XT_SYNPROXY_OPT_WSCALE;
7272
}
7373
break;

0 commit comments

Comments
 (0)