From: gfree.wind@foxmail.com
To: pablo@netfilter.org, netfilter-devel@vger.kernel.org
Cc: Gao Feng <fgao@ikuai8.com>
Subject: [PATCH nf-next] netfilter: tcp: Use TCP_MAX_WSCALE instead of literal 14
Date: Wed, 19 Apr 2017 09:23:42 +0800 [thread overview]
Message-ID: <1492565022-110676-1-git-send-email-gfree.wind@foxmail.com> (raw)
From: Gao Feng <fgao@ikuai8.com>
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>
---
net/netfilter/nf_conntrack_proto_tcp.c | 7 +++----
net/netfilter/nf_synproxy_core.c | 4 ++--
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index b122e9d..741acdc 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -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;
}
diff --git a/net/netfilter/nf_synproxy_core.c b/net/netfilter/nf_synproxy_core.c
index abe03e8..a504e87 100644
--- a/net/netfilter/nf_synproxy_core.c
+++ b/net/netfilter/nf_synproxy_core.c
@@ -66,8 +66,8 @@
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;
--
1.9.1
next reply other threads:[~2017-04-19 1:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-19 1:23 gfree.wind [this message]
2017-04-19 15:58 ` [PATCH nf-next] netfilter: tcp: Use TCP_MAX_WSCALE instead of literal 14 Pablo Neira Ayuso
2017-04-19 16:22 ` Eric Dumazet
2017-04-19 19:57 ` Pablo Neira Ayuso
2017-04-19 20:38 ` Pablo Neira Ayuso
2017-04-20 0:44 ` Gao Feng
2017-04-20 12:07 ` Eric Dumazet
2017-04-21 1:28 ` Gao Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1492565022-110676-1-git-send-email-gfree.wind@foxmail.com \
--to=gfree.wind@foxmail.com \
--cc=fgao@ikuai8.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).