summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_input.c
diff options
context:
space:
mode:
authorfrantzen <frantzen@openbsd.org>2004-04-26 18:12:25 +0000
committerfrantzen <frantzen@openbsd.org>2004-04-26 18:12:25 +0000
commit5011cf9884bedb774cdf82761a58d1af00975b2c (patch)
tree1b4cd242c4f7a36f4fd56218d51e52996dfc4162 /sys/netinet/tcp_input.c
parentoh we need to model check and not crank > 256 for older cards... do that later (diff)
downloadwireguard-openbsd-5011cf9884bedb774cdf82761a58d1af00975b2c.tar.xz
wireguard-openbsd-5011cf9884bedb774cdf82761a58d1af00975b2c.zip
- allow the user to force the TCP mss below the fail-safe 216 with a low
interface MTU. - break a tcp_output() -> tcp_mtudisc() -> tcp_output() infinite recursion when the TCP mss ends up larger than the interface MTU (when the if_mtu is smaller than the tcp header). connections will still stall feedback from itojun@, claudio@ and provos and testing from beck@
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r--sys/netinet/tcp_input.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index f0cffa74bb5..57c2a850dae 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.164 2004/04/20 20:05:29 markus Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.165 2004/04/26 18:12:25 frantzen Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -3068,13 +3068,15 @@ tcp_mss(tp, offer)
* If we compute a larger value, return it for use in sending
* a max seg size option, but don't store it for use
* unless we received an offer at least that large from peer.
- * However, do not accept offers under 216 bytes.
+ * However, do not accept offers under 216 bytes unless the
+ * interface MTU is actually that low.
*/
if (offer > 0)
tp->t_peermss = offer;
if (tp->t_peermss)
mss = min(mss, tp->t_peermss);
- mss = max(mss, 216); /* sanity - at least max opt. space */
+ /* sanity - at least max opt. space */
+ mss = max(mss, min(216, ifp->if_mtu - iphlen - sizeof(struct tcphdr)));
/*
* maxopd stores the maximum length of data AND options