summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_subr.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_subr.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_subr.c')
-rw-r--r--sys/netinet/tcp_subr.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 27e9bd25203..c46ec66bc9a 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_subr.c,v 1.77 2004/03/02 12:51:12 markus Exp $ */
+/* $OpenBSD: tcp_subr.c,v 1.78 2004/04/26 18:12:25 frantzen Exp $ */
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
/*
@@ -1018,8 +1018,10 @@ tcp_mtudisc(inp, errno)
{
struct tcpcb *tp = intotcpcb(inp);
struct rtentry *rt = in_pcbrtentry(inp);
+ int change = 0;
if (tp != 0) {
+ int orig_maxseg = tp->t_maxseg;
if (rt != 0) {
/*
* If this was not a host route, remove and realloc.
@@ -1029,18 +1031,18 @@ tcp_mtudisc(inp, errno)
if ((rt = in_pcbrtentry(inp)) == 0)
return;
}
-
- if (rt->rt_rmx.rmx_mtu != 0) {
- /* also takes care of congestion window */
- tcp_mss(tp, -1);
- }
+ if (orig_maxseg != tp->t_maxseg ||
+ (rt->rt_rmx.rmx_locks & RTV_MTU))
+ change = 1;
}
+ tcp_mss(tp, -1);
/*
- * Resend unacknowledged packets.
+ * Resend unacknowledged packets
*/
tp->snd_nxt = tp->snd_una;
- tcp_output(tp);
+ if (change || errno > 0)
+ tcp_output(tp);
}
}