From: Stephen Hemminger <shemminger@osdl.org>
To: "David S. Miller" <davem@redhat.com>
Cc: bert hubert <ahu@ds9a.nl>,
Arnaldo Carvalho de Melo <acme@conectiva.com.br>,
netdev@oss.sgi.com, alessandro.suardi@oracle.com,
phyprabab@yahoo.com, netdev@oss.sgi.com,
linux-net@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] fix tcp_default_win_scale.
Date: Tue, 6 Jul 2004 11:47:41 -0700 [thread overview]
Message-ID: <20040706114741.1bf98bbe@dell_ss3.pdx.osdl.net> (raw)
In-Reply-To: <20040706093503.GA8147@outpost.ds9a.nl>
Recent TCP changes exposed the problem that there ar lots of really broken firewalls
that strip or alter TCP options.
When the options are modified TCP gets busted now. The problem is that when
we propose window scaling, we expect that the other side receives the same initial
SYN request that we sent. If there is corrupting firewalls that strip it then
the window we send is not correctly scaled; so the other side thinks there is not
enough space to send.
I propose that the following that will avoid sending window scaling that
is big enough to break in these cases unless the tcp_rmem has been increased.
It will keep default configuration from blowing in a corrupt world.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
diff -Nru a/include/linux/sysctl.h b/include/linux/sysctl.h
--- a/include/linux/sysctl.h 2004-07-06 11:45:18 -07:00
+++ b/include/linux/sysctl.h 2004-07-06 11:45:18 -07:00
@@ -337,7 +337,7 @@
NET_TCP_BIC=102,
NET_TCP_BIC_FAST_CONVERGENCE=103,
NET_TCP_BIC_LOW_WINDOW=104,
- NET_TCP_DEFAULT_WIN_SCALE=105,
+/* NET_TCP_DEFAULT_WIN_SCALE */
NET_TCP_MODERATE_RCVBUF=106,
};
diff -Nru a/include/net/tcp.h b/include/net/tcp.h
--- a/include/net/tcp.h 2004-07-06 11:45:18 -07:00
+++ b/include/net/tcp.h 2004-07-06 11:45:18 -07:00
@@ -611,7 +611,6 @@
extern int sysctl_tcp_bic;
extern int sysctl_tcp_bic_fast_convergence;
extern int sysctl_tcp_bic_low_window;
-extern int sysctl_tcp_default_win_scale;
extern int sysctl_tcp_moderate_rcvbuf;
extern atomic_t tcp_memory_allocated;
@@ -1690,6 +1689,13 @@
*ptr++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_WINDOW << 16) | (TCPOLEN_WINDOW << 8) | (wscale));
}
+/* Default window scaling based on the size of the maximum window */
+static inline __u8 tcp_default_win_scale(void)
+{
+ int b = ffs(sysctl_tcp_rmem[2]);
+ return (b < 17) ? 0 : b-16;
+}
+
/* Determine a window scaling and initial window to offer.
* Based on the assumption that the given amount of space
* will be offered. Store the results in the tp structure.
@@ -1732,8 +1738,7 @@
space - max((space>>sysctl_tcp_app_win), mss>>*rcv_wscale) < 65536/2)
(*rcv_wscale)--;
- *rcv_wscale = max((__u8)sysctl_tcp_default_win_scale,
- *rcv_wscale);
+ *rcv_wscale = max(tcp_default_win_scale(), *rcv_wscale);
}
/* Set initial window to value enough for senders,
diff -Nru a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
--- a/net/ipv4/sysctl_net_ipv4.c 2004-07-06 11:45:18 -07:00
+++ b/net/ipv4/sysctl_net_ipv4.c 2004-07-06 11:45:18 -07:00
@@ -667,14 +667,6 @@
.proc_handler = &proc_dointvec,
},
{
- .ctl_name = NET_TCP_DEFAULT_WIN_SCALE,
- .procname = "tcp_default_win_scale",
- .data = &sysctl_tcp_default_win_scale,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = &proc_dointvec,
- },
- {
.ctl_name = NET_TCP_MODERATE_RCVBUF,
.procname = "tcp_moderate_rcvbuf",
.data = &sysctl_tcp_moderate_rcvbuf,
diff -Nru a/net/ipv4/tcp.c b/net/ipv4/tcp.c
--- a/net/ipv4/tcp.c 2004-07-06 11:45:18 -07:00
+++ b/net/ipv4/tcp.c 2004-07-06 11:45:18 -07:00
@@ -276,8 +276,6 @@
atomic_t tcp_orphan_count = ATOMIC_INIT(0);
-int sysctl_tcp_default_win_scale = 7;
-
int sysctl_tcp_mem[3];
int sysctl_tcp_wmem[3] = { 4 * 1024, 16 * 1024, 128 * 1024 };
int sysctl_tcp_rmem[3] = { 4 * 1024, 87380, 87380 * 2 };
next parent reply other threads:[~2004-07-06 18:48 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <32886.63.170.215.71.1088564087.squirrel@www.osdl.org>
[not found] ` <20040629222751.392f0a82.davem@redhat.com>
[not found] ` <20040630152750.2d01ca51@dell_ss3.pdx.osdl.net>
[not found] ` <20040630153049.3ca25b76.davem@redhat.com>
[not found] ` <20040701133738.301b9e46@dell_ss3.pdx.osdl.net>
[not found] ` <20040701140406.62dfbc2a.davem@redhat.com>
[not found] ` <20040702013225.GA24707@conectiva.com.br>
[not found] ` <20040706093503.GA8147@outpost.ds9a.nl>
2004-07-06 18:47 ` Stephen Hemminger [this message]
2004-07-06 18:58 ` Jan-Benedict Glaw
2004-07-06 20:17 ` David S. Miller
2004-07-06 20:31 ` Stephen Hemminger
2004-07-06 20:33 ` David S. Miller
2004-07-06 19:40 ` Jamie Lokier
2004-07-06 20:05 ` Stephen Hemminger
2004-07-06 20:28 ` David S. Miller
2004-07-06 20:36 ` Stephen Hemminger
2004-07-06 20:35 ` David S. Miller
2004-07-06 21:55 ` John Heffner
2004-07-06 22:50 ` David S. Miller
2004-07-07 1:32 ` John Heffner
2004-07-06 23:01 ` PLS help fix: recent 2.6.7 won't connect to anything " bert hubert
2004-07-06 20:12 ` David S. Miller
2004-07-06 22:44 ` bert hubert
2004-07-06 22:49 ` David S. Miller
2004-07-07 18:06 ` Stephen Hemminger
2004-07-07 19:31 ` Jamie Lokier
2004-07-07 19:38 ` bert hubert
2004-07-07 19:41 ` John Heffner
2004-07-09 23:14 ` David S. Miller
2004-07-06 20:00 ` Nivedita Singhvi
2004-07-06 20:16 ` David S. Miller
2004-07-06 20:26 ` David Ford
2004-07-06 20:24 ` David S. Miller
2004-07-06 23:16 ` Andi Kleen
2004-07-07 7:50 ` Chris Wedgwood
2004-07-06 23:19 ` Redeeman
2004-07-06 23:25 ` bert hubert
2004-07-07 5:39 ` Redeeman
2004-07-07 6:05 ` Redeeman
2004-07-07 19:47 ` John Heffner
2004-07-06 20:35 Tim Berti
2004-07-06 20:54 ` David Ford
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=20040706114741.1bf98bbe@dell_ss3.pdx.osdl.net \
--to=shemminger@osdl.org \
--cc=acme@conectiva.com.br \
--cc=ahu@ds9a.nl \
--cc=alessandro.suardi@oracle.com \
--cc=davem@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-net@vger.kernel.org \
--cc=netdev@oss.sgi.com \
--cc=phyprabab@yahoo.com \
/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
all inboxes | Powered by JetHome®