netfilter: tcp: Use TCP_MAX_WSCALE instead of literal 14
authorGao Feng <fgao@ikuai8.com>
Wed, 19 Apr 2017 01:23:42 +0000 (09:23 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 19 Apr 2017 15:55:17 +0000 (17:55 +0200)
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>
net/netfilter/nf_conntrack_proto_tcp.c
net/netfilter/nf_synproxy_core.c

index d0c0a31dfe741b9f91eab8abfb61e4326c325dfd..d61a68759deaa723ab5ce49f488f0f713cb41bcc 100644 (file)
@@ -419,10 +419,9 @@ static void tcp_options(const struct sk_buff *skb,
                                 && opsize == TCPOLEN_WINDOW) {
                                state->td_scale = *(u_int8_t *)ptr;
 
-                               if (state->td_scale > 14) {
-                                       /* See RFC1323 */
-                                       state->td_scale = 14;
-                               }
+                               if (state->td_scale > TCP_MAX_WSCALE)
+                                       state->td_scale = TCP_MAX_WSCALE;
+
                                state->flags |=
                                        IP_CT_TCP_FLAG_WINDOW_SCALE;
                        }
index abe03e869f7ba3a8bfd61f09d5e2015cc93643dc..a504e87c6ddff1b1266a901549256f29dc1973d1 100644 (file)
@@ -66,8 +66,8 @@ synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,
                        case TCPOPT_WINDOW:
                                if (opsize == TCPOLEN_WINDOW) {
                                        opts->wscale = *ptr;
-                                       if (opts->wscale > 14)
-                                               opts->wscale = 14;
+                                       if (opts->wscale > TCP_MAX_WSCALE)
+                                               opts->wscale = TCP_MAX_WSCALE;
                                        opts->options |= XT_SYNPROXY_OPT_WSCALE;
                                }
                                break;