提交 122868b3 编写于 作者: G Gao Feng 提交者: Pablo Neira Ayuso

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: NGao Feng <fgao@ikuai8.com>
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
上级 be7be6e1
...@@ -419,10 +419,9 @@ static void tcp_options(const struct sk_buff *skb, ...@@ -419,10 +419,9 @@ static void tcp_options(const struct sk_buff *skb,
&& opsize == TCPOLEN_WINDOW) { && opsize == TCPOLEN_WINDOW) {
state->td_scale = *(u_int8_t *)ptr; state->td_scale = *(u_int8_t *)ptr;
if (state->td_scale > 14) { if (state->td_scale > TCP_MAX_WSCALE)
/* See RFC1323 */ state->td_scale = TCP_MAX_WSCALE;
state->td_scale = 14;
}
state->flags |= state->flags |=
IP_CT_TCP_FLAG_WINDOW_SCALE; IP_CT_TCP_FLAG_WINDOW_SCALE;
} }
......
...@@ -66,8 +66,8 @@ synproxy_parse_options(const struct sk_buff *skb, unsigned int doff, ...@@ -66,8 +66,8 @@ synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,
case TCPOPT_WINDOW: case TCPOPT_WINDOW:
if (opsize == TCPOLEN_WINDOW) { if (opsize == TCPOLEN_WINDOW) {
opts->wscale = *ptr; opts->wscale = *ptr;
if (opts->wscale > 14) if (opts->wscale > TCP_MAX_WSCALE)
opts->wscale = 14; opts->wscale = TCP_MAX_WSCALE;
opts->options |= XT_SYNPROXY_OPT_WSCALE; opts->options |= XT_SYNPROXY_OPT_WSCALE;
} }
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册