summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_timewait.c
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2005-05-04 13:48:44 +0000
committerandre <andre@FreeBSD.org>2005-05-04 13:48:44 +0000
commit757e9ec26720e43c8b9c56db2aae73a9f8a37a09 (patch)
tree469364b2d77732f787ef2033f8b6cd245e492edf /sys/netinet/tcp_timewait.c
parenta0f1ce3be1d4d2b35aa118f1375f259245022ed2 (diff)
downloadFreeBSD-src-757e9ec26720e43c8b9c56db2aae73a9f8a37a09.zip
FreeBSD-src-757e9ec26720e43c8b9c56db2aae73a9f8a37a09.tar.gz
If we don't get a suggested MTU during path MTU discovery
look up the packet size of the packet that generated the response, step down the MTU by one step through ip_next_mtu() and try again. Suggested by: dwmalone
Diffstat (limited to 'sys/netinet/tcp_timewait.c')
-rw-r--r--sys/netinet/tcp_timewait.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c
index 25a9266..bde7f09 100644
--- a/sys/netinet/tcp_timewait.c
+++ b/sys/netinet/tcp_timewait.c
@@ -1168,22 +1168,33 @@ tcp_ctlinput(cmd, sa, vip)
* If we got a needfrag set the MTU
* in the route to the suggested new
* value (if given) and then notify.
- * If no new MTU was suggested, then
- * we guess a new one less than the
- * current value.
- * If the new MTU is unreasonably
- * small (defined by sysctl tcp_minmss),
- * then we up the MTU value to minimum.
*/
bzero(&inc, sizeof(inc));
inc.inc_flags = 0; /* IPv4 */
inc.inc_faddr = faddr;
mtu = ntohs(icp->icmp_nextmtu);
+ /*
+ * If no alternative MTU was
+ * proposed, try the next smaller
+ * one.
+ */
+ if (!mtu)
+ mtu = ip_next_mtu(ntohs(ip->ip_len),
+ 1);
+ if (mtu < max(296, (tcp_minmss)
+ + sizeof(struct tcpiphdr)))
+ mtu = 0;
if (!mtu)
- mtu = ip_next_mtu(mtu, 1);
- if (mtu >= max(296, (tcp_minmss
- + sizeof(struct tcpiphdr))))
+ mtu = tcp_mssdflt
+ + sizeof(struct tcpiphdr);
+ /*
+ * Only cache the the MTU if it
+ * is smaller than the interface
+ * or route MTU. tcp_mtudisc()
+ * will do right thing by itself.
+ */
+ if (mtu <= tcp_maxmtu(&inc))
tcp_hc_updatemtu(&inc, mtu);
}
OpenPOWER on IntegriCloud