summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2000-09-25 09:41:04 +0000
committerNiels Provos <provos@cvs.openbsd.org>2000-09-25 09:41:04 +0000
commit21ec68ea5cb480546e3029e7711a3058bd602541 (patch)
treed829e6c42ada204f7a9d701c47f371c135efc3f1
parent5d20f3bacaeefec3f807d34780c431ba952d1747 (diff)
on expiry of pmtu route, retry higher mtu. okay angelos@
-rw-r--r--sys/netinet/ip_icmp.c12
-rw-r--r--sys/netinet/tcp_input.c8
-rw-r--r--sys/netinet/tcp_output.c5
-rw-r--r--sys/netinet/tcp_subr.c26
-rw-r--r--sys/netinet/tcp_var.h6
-rw-r--r--sys/sys/protosw.h5
6 files changed, 49 insertions, 13 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 8f3070a5627..a17d58bb09a 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_icmp.c,v 1.24 2000/09/20 19:11:09 angelos Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.25 2000/09/25 09:41:02 provos Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@@ -817,8 +817,18 @@ icmp_mtudisc_timeout(rt, r)
panic("icmp_mtudisc_timeout: bad route to timeout");
if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) ==
(RTF_DYNAMIC | RTF_HOST)) {
+ void *(*ctlfunc) __P((int, struct sockaddr *, void *));
+ extern u_char ip_protox[];
+ struct sockaddr_in sa;
+
+ sa = *(struct sockaddr_in *)rt_key(rt);
rtrequest((int) RTM_DELETE, (struct sockaddr *)rt_key(rt),
rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0);
+
+ /* Notify TCP layer of increased Path MTU estimate */
+ ctlfunc = inetsw[ip_protox[IPPROTO_TCP]].pr_ctlinput;
+ if (ctlfunc)
+ (*ctlfunc)(PRC_MTUINC,(struct sockaddr *)&sa, NULL);
} else {
if ((rt->rt_rmx.rmx_locks & RTV_MTU) == 0) {
rt->rt_rmx.rmx_mtu = 0;
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index afe65c4d4cb..14c135f7ee5 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.76 2000/09/23 01:07:38 chris Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.77 2000/09/25 09:41:02 provos Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -2871,8 +2871,10 @@ tcp_mss(tp, offer)
* unless we received an offer at least that large from peer.
* However, do not accept offers under 32 bytes.
*/
- if (offer && offer != -1)
- mss = min(mss, offer);
+ if (offer > 0)
+ tp->t_peermss = offer;
+ if (tp->t_peermss)
+ mss = min(mss, tp->t_peermss);
mss = max(mss, 64); /* sanity - at least max opt. space */
/*
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index f1ab4a5ab05..63d9bd94111 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_output.c,v 1.33 2000/09/20 17:00:22 provos Exp $ */
+/* $OpenBSD: tcp_output.c,v 1.34 2000/09/25 09:41:03 provos Exp $ */
/* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */
/*
@@ -512,8 +512,7 @@ send:
opt[0] = TCPOPT_MAXSEG;
opt[1] = 4;
- mss = htons((u_int16_t) tcp_mss(tp, flags & TH_ACK ?
- tp->t_maxopd : 0));
+ mss = htons((u_int16_t) tcp_mss(tp, 0));
bcopy((caddr_t)&mss, (caddr_t)(opt + 2), sizeof(mss));
optlen = 4;
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index c9fa20fb9d6..836bda2197e 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_subr.c,v 1.32 2000/09/20 17:00:23 provos Exp $ */
+/* $OpenBSD: tcp_subr.c,v 1.33 2000/09/25 09:41:03 provos Exp $ */
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
/*
@@ -811,6 +811,8 @@ tcp_ctlinput(cmd, sa, v)
notify = in_rtchange, ip = 0;
else if (cmd == PRC_MSGSIZE && ip_mtudisc)
notify = tcp_mtudisc, ip = 0;
+ else if (cmd == PRC_MTUINC)
+ notify = tcp_mtudisc_increase, ip = 0;
else if (cmd == PRC_HOSTDEAD)
ip = 0;
else if (errno == 0)
@@ -870,7 +872,7 @@ tcp_mtudisc(inp, errno)
tcp_mss(tp, -1);
}
}
-
+
/*
* Resend unacknowledged packets.
*/
@@ -879,6 +881,26 @@ tcp_mtudisc(inp, errno)
}
}
+void
+tcp_mtudisc_increase(inp, errno)
+ struct inpcb *inp;
+ int errno;
+{
+ struct tcpcb *tp = intotcpcb(inp);
+ struct rtentry *rt = in_pcbrtentry(inp);
+
+ if (tp != 0 && rt != 0) {
+ /*
+ * If this was a host route, remove and realloc.
+ */
+ if (rt->rt_flags & RTF_HOST)
+ in_rtchange(inp, errno);
+
+ /* also takes care of congestion window */
+ tcp_mss(tp, -1);
+ }
+}
+
#ifdef TCP_SIGNATURE
int
tcp_signature_tdb_attach()
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 39c03b853d2..f6a2b2989d7 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_var.h,v 1.31 2000/09/20 17:00:23 provos Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.32 2000/09/25 09:41:03 provos Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
@@ -134,7 +134,8 @@ struct tcpcb {
* for slow start exponential to
* linear switch
*/
- u_int t_maxopd; /* mss plus options */
+ u_short t_maxopd; /* mss plus options */
+ u_short t_peermss; /* peer's maximum segment size */
/*
* transmit timing stuff. See below for scale of srtt and rttvar.
@@ -345,6 +346,7 @@ void tcp_input __P((struct mbuf *, ...));
int tcp_mss __P((struct tcpcb *, int));
void tcp_mss_update __P((struct tcpcb *));
void tcp_mtudisc __P((struct inpcb *, int));
+void tcp_mtudisc_increase __P((struct inpcb *, int));
struct tcpcb *
tcp_newtcpcb __P((struct inpcb *));
void tcp_notify __P((struct inpcb *, int));
diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h
index a39e54a12f5..ebf4cfcfd08 100644
--- a/sys/sys/protosw.h
+++ b/sys/sys/protosw.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: protosw.h,v 1.3 1996/04/21 22:31:54 deraadt Exp $ */
+/* $OpenBSD: protosw.h,v 1.4 2000/09/25 09:41:02 provos Exp $ */
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
/*-
@@ -170,6 +170,7 @@ char *prurequests[] = {
*/
#define PRC_IFDOWN 0 /* interface transition */
#define PRC_ROUTEDEAD 1 /* select new route if possible ??? */
+#define PRC_MTUINC 2 /* increase in mtu to host */
#define PRC_QUENCH2 3 /* DEC congestion bit says slow down */
#define PRC_QUENCH 4 /* some one said to slow down */
#define PRC_MSGSIZE 5 /* message size forced drop */
@@ -196,7 +197,7 @@ char *prurequests[] = {
#ifdef PRCREQUESTS
char *prcrequests[] = {
- "IFDOWN", "ROUTEDEAD", "#2", "DEC-BIT-QUENCH2",
+ "IFDOWN", "ROUTEDEAD", "MTUINC", "DEC-BIT-QUENCH2",
"QUENCH", "MSGSIZE", "HOSTDEAD", "#7",
"NET-UNREACH", "HOST-UNREACH", "PROTO-UNREACH", "PORT-UNREACH",
"#12", "SRCFAIL-UNREACH", "NET-REDIRECT", "HOST-REDIRECT",