From 58c7a27b4ab3b76ffd2d318d1daf386981945f0e Mon Sep 17 00:00:00 2001 From: bluhm Date: Wed, 30 Jun 2021 11:26:49 +0000 Subject: [PATCH] For path MTU discovery tcp_mtudisc() should resend a TCP packet by calling tcp_output() if the TCP maximum segment size changes. But that did not work, as the new value was compared before tcp_mss() had a chance to modify it. Move the comparison and change it from not equal to greater than. It makes only sense to resend a packet immediately if it becomes smaller and is more likely to fit. OK sashan@ tobhe@ --- sys/netinet/tcp_subr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 49f3aa89765..6ec0fb79c3c 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.176 2021/02/25 02:48:21 dlg Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.177 2021/06/30 11:26:49 bluhm Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -837,15 +837,14 @@ tcp_mtudisc(struct inpcb *inp, int errno) { struct tcpcb *tp = intotcpcb(inp); struct rtentry *rt; - int change = 0; + int orig_maxseg, change = 0; if (tp == NULL) return; + orig_maxseg = tp->t_maxseg; rt = in_pcbrtentry(inp); if (rt != NULL) { - int orig_maxseg = tp->t_maxseg; - /* * If this was not a host route, remove and realloc. */ @@ -854,11 +853,12 @@ tcp_mtudisc(struct inpcb *inp, int errno) if ((rt = in_pcbrtentry(inp)) == NULL) return; } - if (orig_maxseg != tp->t_maxseg || - (rt->rt_locks & RTV_MTU)) + if (rt->rt_locks & RTV_MTU) change = 1; } tcp_mss(tp, -1); + if (orig_maxseg > tp->t_maxseg) + change = 1; /* * Resend unacknowledged packets -- 2.20.1