[Midnightbsd-cvs] src: tcp_syncache.c: Pick the smallest possible TCP window scaling
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Fri May 16 19:38:39 EDT 2008
Log Message:
-----------
Pick the smallest possible TCP window scaling factor that will still allow us ot scale up to sb_max aka
kern.ipc.maxsockbuf.
Anything larger will cause window scaling corruption on some firewalls. (other end will think unscaled)
Obtained from: FreeBSD revision 1.131
Modified Files:
--------------
src/sys/netinet:
tcp_syncache.c (r1.2 -> r1.3)
-------------- next part --------------
Index: tcp_syncache.c
===================================================================
RCS file: /home/cvs/src/sys/netinet/tcp_syncache.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/netinet/tcp_syncache.c -L sys/netinet/tcp_syncache.c -u -r1.2 -r1.3
--- sys/netinet/tcp_syncache.c
+++ sys/netinet/tcp_syncache.c
@@ -966,14 +966,28 @@
int wscale = 0;
/*
- * Compute proper scaling value from buffer space:
- * Place window scale into sweet spot where it is
- * about one fourth of the MSS. This allows us to
- * scale the receive buffer over a wide range while
- * not losing any efficiency or fine granularity.
+ * Pick the smallest possible scaling factor that
+ * will still allow us to scale up to sb_max, aka
+ * kern.ipc.maxsockbuf.
+ *
+ * We do this because there are broken firewalls that
+ * will corrupt the window scale option, leading to
+ * the other endpoint believing that our advertised
+ * window is unscaled. At scale factors larger than
+ * 5 the unscaled window will drop below 1500 bytes,
+ * leading to serious problems when traversing these
+ * broken firewalls.
+ *
+ * With the default maxsockbuf of 256K, a scale factor
+ * of 3 will be chosen by this algorithm. Those who
+ * choose a larger maxsockbuf should watch out
+ * for the compatiblity problems mentioned above.
+ *
+ * RFC1323: The Window field in a SYN (i.e., a <SYN>
+ * or <SYN,ACK>) segment itself is never scaled.
*/
while (wscale < TCP_MAX_WINSHIFT &&
- (0x1 << wscale) < tcp_minmss)
+ (TCP_MAXWIN << wscale) < sb_max)
wscale++;
sc->sc_request_r_scale = wscale;
sc->sc_requested_s_scale = to->to_requested_s_scale;
More information about the Midnightbsd-cvs
mailing list