From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202502 header.b=gM5MO5Tp; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id AEC875A0272 for ; Wed, 12 Feb 2025 01:57:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1739321833; bh=ienC29FoVGywy3YNgqffEIJTCezKQ8OpmfNdEMi5JeA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gM5MO5Tpy8I5/gnJyDBwX4QgZXLjAGDaAUglEcYp0csZ6OAj9Kmtt90Js6EbaVlVg 2ErYDfcS1ILKrQjYuMuEhzleyh1yFFLk8oPL7DaHUSQE4EgkIM6u65gRj0TVZtHxmr uMlh0Xf8L9wzgCLbnCj+ArF2XGGK47UpfU+Xbu7f8v+HNc495wM+ePa47Ftw0rNR1D +3cDUOS8mmLF5jpn9TwECUWDuDRVktHRmi5bpugM8gfIZLRGcBpZyZyvilftCggK51 IbD/fTbsh1Mj2+brUkYJlsM96ZjxkZLdaAJmMzuS97uvjGG1j+BzbMDKaQxT2ReXCH 778fb01IkDWng== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Yt0Jn1cm4z4wyh; Wed, 12 Feb 2025 11:57:13 +1100 (AEDT) Date: Wed, 12 Feb 2025 11:42:54 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] tcp: Don't discard window information on keep-alive segments Message-ID: References: <20250211195051.197798-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jpNmOnJnakat1SbC" Content-Disposition: inline In-Reply-To: <20250211195051.197798-1-sbrivio@redhat.com> Message-ID-Hash: 2XHC2CW7LW4VO6CZY537XRLNQONLCOHK X-Message-ID-Hash: 2XHC2CW7LW4VO6CZY537XRLNQONLCOHK X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, Jon Maloy X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --jpNmOnJnakat1SbC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 11, 2025 at 08:50:51PM +0100, Stefano Brivio wrote: > It looks like a detail, but it's critical if we're dealing with > somebody, such as near-future self, using TCP_REPAIR to migrate TCP > connections in the guest or container. >=20 > The last packet sent from the 'source' process/guest/container > typically reports a small window, or zero, because the guest/container > hadn't been draining it for a while. >=20 > The next packet, appearing as the target sets TCP_REPAIR_OFF on the > migrated socket, is a keep-alive (also called "window probe" in CRIU > or TCP_REPAIR-related code), and it comes with an updated window > value, reflecting the pre-migration "regular" value. >=20 > If we ignore it, it might take a while/forever before we realise we > can actually restart sending. >=20 > Fixes: 238c69f9af45 ("tcp: Acknowledge keep-alive segments, ignore them f= or the rest") > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson Although... > --- > tcp.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/tcp.c b/tcp.c > index af6bd95..2addf4a 100644 > --- a/tcp.c > +++ b/tcp.c > @@ -1664,8 +1664,10 @@ static int tcp_data_from_tap(const struct ctx *c, = struct tcp_tap_conn *conn, > tcp_send_flag(c, conn, ACK); > tcp_timer_ctl(c, conn); > =20 > - if (p->count =3D=3D 1) > + if (p->count =3D=3D 1) { =2E.. not really this patch, but this condition seems wrong to me. IIUC it's attempting to detect the last packet in the batch, which isn't necessarily the same thing as the _only_ packet in the batch. Admittedly, it probably will be for a keep-alive, but I'm having a hard time convincing myself it absolutely has to be. Should this maybe be (i + 1 =3D=3D p->count) instead? > + tcp_tap_window_update(conn, ntohs(th->window)); > return 1; > + } > =20 > continue; > } --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --jpNmOnJnakat1SbC Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmer7lsACgkQzQJF27ox 2GfdeQ//YYax6GDcOuT9zJyYKyapY1mgD24VMCrkV+kpoAjLqeRIEODaV2Dt07WA gkIIcC+z0Miq9ljikn6PntewbfOBeSGnNN0Quwkh/vFpS/fR80Y4WsZ6iPtnj1c7 sKpAv1qRQN3Otz7MqClCT7FDtlC5C+7W9nvL0LkAEn6jLKo+QTpL/t5V57EdQt4S 9aCt3IPmLO9c4rWEg5ZJXVyTrsw03dJdpGGHJC2C6YsD97G9x2g0hNjL4ygjKOq4 PRtWImNJGONH8VmGc3tM9mCr2wE6lReG1k8fsmX2LYTsBOyDqeHfyWafWrjjdB0u LDZYWC9fJObeQMGMmimQ95q+9alfC2KorR+dkWCfwlXJqEtzusAU5BfSsSfqBzIj Y8L6gviPLzmQOc+vT3R+7FUNjJVSNAKd6MnwCoAYx5xQUzP0mbyg0jxLlVQETE4W y9jLCUlBSQaEZ8pyT8fm8O7Rxg6Qy9qV6gpezsrFlgiOrT5RJITf30JXGgTA2Qzz t6ZlI1qIM/oFKLnvUW/yZOTZURnu9Ac6wttjqSaEyoYk+KXo3cbIGXVvQ8ySm2nq fuKEjfJRBq7WPqR80j0hGLlWDa+JJ7BAkYguLUxueCrPKQxzYa1RLkO/Ej7Hc10r ce9rX9BqUjOV2EniWF/2A0fZul8ZA0L8IC8+mPP5DpM4b1RCQZ4= =91q/ -----END PGP SIGNATURE----- --jpNmOnJnakat1SbC--