summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1995-10-10 17:45:43 +0000
committerwollman <wollman@FreeBSD.org>1995-10-10 17:45:43 +0000
commitba18d18f326ce164eec388c53e9e209fc13bb425 (patch)
tree76f578437142707a98880be1d42e027397bbb46c /sys
parent5668a5f30b8fbc1b006b74162ab6e6d8e41ae048 (diff)
downloadFreeBSD-src-ba18d18f326ce164eec388c53e9e209fc13bb425.zip
FreeBSD-src-ba18d18f326ce164eec388c53e9e209fc13bb425.tar.gz
More MTU discovery: avoid over-retransmission if route changes in the
middle of a fully-open window. Also, keep track of how many retransmits we do as a result of MTU discovery. This may actually do more work than necessary, but it's an unusual condition... Suggested by: Janey Hoe <janey@lcs.mit.edu>
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/tcp_subr.c19
-rw-r--r--sys/netinet/tcp_timewait.c19
-rw-r--r--sys/netinet/tcp_var.h5
3 files changed, 22 insertions, 21 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index d166bba..0fe5d0f 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.16 1995/09/22 17:43:37 wollman Exp $
+ * $Id: tcp_subr.c,v 1.17 1995/10/03 16:54:15 wollman Exp $
*/
#include <sys/param.h>
@@ -503,6 +503,8 @@ tcp_mtudisc(inp, errno)
offered = taop->tao_mssopt;
mss = rt->rt_rmx.rmx_mtu - sizeof(struct tcpiphdr);
mss = min(mss, offered);
+ if (tp->t_maxopd <= mss)
+ return;
tp->t_maxopd = mss;
if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP &&
@@ -523,15 +525,12 @@ tcp_mtudisc(inp, errno)
tp->t_maxseg = mss;
- /*
- * Nudge TCP output. Unfortunately, we have no way to know
- * which packet that we sent is the failing one, but in the
- * vast majority of cases we expect that it will be at the
- * beginning of the window, so this should do the right
- * thing (I hope).
- */
- tp->snd_nxt = tp->snd_una;
- tcp_output(tp);
+ if (SEQ_GT(tp->snd_una, tp->t_lastmturesend)) {
+ tcpstat.tcps_mturesent++;
+ tp->t_rtt = 0;
+ tp->snd_nxt = tp->t_lastmturesend = tp->snd_una;
+ tcp_output(tp);
+ }
}
}
#endif /* MTUDISC */
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index d166bba..0fe5d0f 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.16 1995/09/22 17:43:37 wollman Exp $
+ * $Id: tcp_subr.c,v 1.17 1995/10/03 16:54:15 wollman Exp $
*/
#include <sys/param.h>
@@ -503,6 +503,8 @@ tcp_mtudisc(inp, errno)
offered = taop->tao_mssopt;
mss = rt->rt_rmx.rmx_mtu - sizeof(struct tcpiphdr);
mss = min(mss, offered);
+ if (tp->t_maxopd <= mss)
+ return;
tp->t_maxopd = mss;
if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP &&
@@ -523,15 +525,12 @@ tcp_mtudisc(inp, errno)
tp->t_maxseg = mss;
- /*
- * Nudge TCP output. Unfortunately, we have no way to know
- * which packet that we sent is the failing one, but in the
- * vast majority of cases we expect that it will be at the
- * beginning of the window, so this should do the right
- * thing (I hope).
- */
- tp->snd_nxt = tp->snd_una;
- tcp_output(tp);
+ if (SEQ_GT(tp->snd_una, tp->t_lastmturesend)) {
+ tcpstat.tcps_mturesent++;
+ tp->t_rtt = 0;
+ tp->snd_nxt = tp->t_lastmturesend = tp->snd_una;
+ tcp_output(tp);
+ }
}
}
#endif /* MTUDISC */
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index bfdb425..759b793 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_var.h 8.4 (Berkeley) 5/24/95
- * $Id: tcp_var.h,v 1.17 1995/09/22 07:40:18 peter Exp $
+ * $Id: tcp_var.h,v 1.18 1995/10/04 20:49:03 wollman Exp $
*/
#ifndef _NETINET_TCP_VAR_H_
@@ -141,6 +141,8 @@ struct tcpcb {
caddr_t t_tuba_pcb; /* next level down pcb for TCP over z */
/* More RTT stuff */
u_long t_rttupdated; /* number of times rtt sampled */
+/* For MTU discovery */
+ tcp_seq t_lastmturesend; /* seq of resend for mtu discovery */
};
/*
@@ -287,6 +289,7 @@ struct tcpstat {
u_long tcps_usedssthresh; /* times ssthresh initialized from rt*/
u_long tcps_persistdrop; /* timeout in persist state */
u_long tcps_badsyn; /* bogus SYN, e.g. premature ACK */
+ u_long tcps_mturesent; /* resends due to MTU discovery */
};
/*
OpenPOWER on IntegriCloud