summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1995-12-20 17:42:28 +0000
committerwollman <wollman@FreeBSD.org>1995-12-20 17:42:28 +0000
commit901107a3b58846b2b2979e213e685b4dfb93158d (patch)
treea414c45c8283835c7bec3b4312a2dde2b29c03b9 /sys
parent44136d3b306ae79a8aa75bd27322c56cbabf7f0e (diff)
downloadFreeBSD-src-901107a3b58846b2b2979e213e685b4dfb93158d.zip
FreeBSD-src-901107a3b58846b2b2979e213e685b4dfb93158d.tar.gz
Fix a nagging divide-by-zero error resulting from the MTU discovery code
getting triggered at a bad time.
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/tcp_subr.c22
-rw-r--r--sys/netinet/tcp_timewait.c22
2 files changed, 40 insertions, 4 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index c41e84c..ee61df3 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95
- * $Id: tcp_subr.c,v 1.23 1995/12/05 17:46:43 wollman Exp $
+ * $Id: tcp_subr.c,v 1.24 1995/12/16 02:14:19 bde Exp $
*/
#include <sys/param.h>
@@ -513,7 +513,25 @@ tcp_mtudisc(inp, errno)
taop = rmx_taop(rt->rt_rmx);
offered = taop->tao_mssopt;
mss = rt->rt_rmx.rmx_mtu - sizeof(struct tcpiphdr);
- mss = min(mss, offered);
+ if (offered)
+ mss = min(mss, offered);
+ /*
+ * XXX - The above conditional probably violates the TCP
+ * spec. The problem is that, since we don't know the
+ * other end's MSS, we are supposed to use a conservative
+ * default. But, if we do that, then MTU discovery will
+ * never actually take place, because the conservative
+ * default is much less than the MTUs typically seen
+ * on the Internet today. For the moment, we'll sweep
+ * this under the carpet.
+ *
+ * The conservative default might not actually be a problem
+ * if the only case this occurs is when sending an initial
+ * SYN with options and data to a host we've never talked
+ * to before. Then, they will reply with an MSS value which
+ * will get recorded and the new parameters should get
+ * recomputed. For Further Study.
+ */
if (tp->t_maxopd <= mss)
return;
tp->t_maxopd = mss;
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index c41e84c..ee61df3 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95
- * $Id: tcp_subr.c,v 1.23 1995/12/05 17:46:43 wollman Exp $
+ * $Id: tcp_subr.c,v 1.24 1995/12/16 02:14:19 bde Exp $
*/
#include <sys/param.h>
@@ -513,7 +513,25 @@ tcp_mtudisc(inp, errno)
taop = rmx_taop(rt->rt_rmx);
offered = taop->tao_mssopt;
mss = rt->rt_rmx.rmx_mtu - sizeof(struct tcpiphdr);
- mss = min(mss, offered);
+ if (offered)
+ mss = min(mss, offered);
+ /*
+ * XXX - The above conditional probably violates the TCP
+ * spec. The problem is that, since we don't know the
+ * other end's MSS, we are supposed to use a conservative
+ * default. But, if we do that, then MTU discovery will
+ * never actually take place, because the conservative
+ * default is much less than the MTUs typically seen
+ * on the Internet today. For the moment, we'll sweep
+ * this under the carpet.
+ *
+ * The conservative default might not actually be a problem
+ * if the only case this occurs is when sending an initial
+ * SYN with options and data to a host we've never talked
+ * to before. Then, they will reply with an MSS value which
+ * will get recorded and the new parameters should get
+ * recomputed. For Further Study.
+ */
if (tp->t_maxopd <= mss)
return;
tp->t_maxopd = mss;
OpenPOWER on IntegriCloud