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=jfzym4kI; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id B81D45A0275 for ; Sat, 08 Feb 2025 00:45:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1738971909; bh=5wyKoni0Ub/Gf2YobpREwJG5nOU0bmWcucDYo5HUY5w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jfzym4kI5hu92y1KS14crB8lEhOWaxNEmR9lL6hFBgbHwlb9MxLUJyF1KnFY/Zq1q kv7hBiHEDECAY/uCtHdFmrjJA4Ff+nO5YWlFnniLFnBBQByzP1EYS3Kp6W80Uk8f16 7FfQK9g5NDUqzRGK2lJNZBotBmZlKJmSnWSoDSn1YcyM8KetwsKlZ9m0qvf86NkFaB KcIo9DU4doBvi/8jTYShn/yDWXhQTdBVL5Dm50jcJDW83bc0Gc7Es8fT7SrCjOp9pm d9jk0KtzbDfW97fi+rBHrn6o+fFW76tJiCWrKFjFGbrx7vyhGzJgJsLD2oYYPIFjjt 1NBJEiYNFtLrQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4YqVvT5NM7z4x1w; Sat, 8 Feb 2025 10:45:09 +1100 (AEDT) Date: Sat, 8 Feb 2025 10:45:12 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] passt-repair: Send one confirmation *per command*, not *per socket* Message-ID: References: <20250207080358.3491153-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="/ngKj0uIx7gCCSnc" Content-Disposition: inline In-Reply-To: <20250207080358.3491153-1-sbrivio@redhat.com> Message-ID-Hash: TEXKAA7TPM5VLPPZZGXTSD3PVISLWFSR X-Message-ID-Hash: TEXKAA7TPM5VLPPZZGXTSD3PVISLWFSR 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 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: --/ngKj0uIx7gCCSnc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 07, 2025 at 09:03:58AM +0100, Stefano Brivio wrote: > It looks like me, myself and I couldn't agree on the "simple" protocol > between passt and passt-repair. The man page and passt say it's one > confirmation per command, but the passt-repair implementation had one > confirmation per socket instead. >=20 > This caused all sort of mysterious issues with repair mode > pseudo-randomly enabled, and leading to hours of fun (mostly not > mine). Oops. >=20 > Switch to one confirmation per command (of course). >=20 > Signed-off-by: Stefano Brivio Ouch. Reviewed-by: David Gibson > --- > passt-repair.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) >=20 > diff --git a/passt-repair.c b/passt-repair.c > index 322066a..614cee0 100644 > --- a/passt-repair.c > +++ b/passt-repair.c > @@ -63,6 +63,7 @@ int main(int argc, char **argv) > struct cmsghdr *cmsg; > struct msghdr msg; > struct iovec iov; > + int op; > =20 > prctl(PR_SET_DUMPABLE, 0); > =20 > @@ -150,25 +151,24 @@ loop: > _exit(1); > } > =20 > - for (i =3D 0; i < n; i++) { > - int o =3D cmd; > + op =3D cmd; > =20 > - if (setsockopt(fds[i], SOL_TCP, TCP_REPAIR, &o, sizeof(o))) { > + for (i =3D 0; i < n; i++) { > + if (setsockopt(fds[i], SOL_TCP, TCP_REPAIR, &op, sizeof(op))) { > fprintf(stderr, > - "Setting TCP_REPAIR to %i on socket %i: %s", o, > + "Setting TCP_REPAIR to %i on socket %i: %s", op, > fds[i], strerror(errno)); > _exit(1); > } > =20 > /* Close _our_ copy */ > close(fds[i]); > + } > =20 > - /* Confirm setting by echoing the command back */ > - if (send(s, &cmd, sizeof(cmd), 0) < 0) { > - fprintf(stderr, "Reply to command %i: %s\n", > - o, strerror(errno)); > - _exit(1); > - } > + /* Confirm setting by echoing the command back */ > + if (send(s, &cmd, sizeof(cmd), 0) < 0) { > + fprintf(stderr, "Reply to %i: %s\n", op, strerror(errno)); > + _exit(1); > } > =20 > goto loop; --=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 --/ngKj0uIx7gCCSnc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmemmwcACgkQzQJF27ox 2GdudA/8DxkI4NRnC6avP8AWaxlgXdHo+2duFlZj3BEcIK6UW4plOCWz3bJEY89g I9vS4fmVo1T2swIWrraTe2oBWV0VfFRgQHXQSdSFFKpKTPv9x1ZuMRIViNaKhFwT YkC1jXA8p0cgX8Wmx2ZrrJ87XEwxMZkeW0E9YopItFY8mIthrIrjxPNVvFlNj+wt VBxaLxSD1bS1l6LqFLNDoZ1JBOUe15cF2vfrdbnIvvVEUmrbZBIIOInUZUxtP+W6 tS1iKh/tdGc6qvlwQ+ErZbRAszMPWCDYg7E/eagszPn3WWsGlC94WCIC72D4GdlS DHWU7IQLnZnCu7NKQLIgAT0EXaQpHev2PxAmg9iRNFwVWwWbSY/9HJ5ABsdEWIv3 ebhIxu9p6r1eo+YcEXA284xjid+xIUZKn71xqzhfReRDHxGQSZrizp78K8OOGsje M3ULWNTOFLvzzDQza7yRyjPk0Qoq5l8rcx7jbPbvr5JbV4VrjOl2aZXbKbnF566D fRL+i473/9W7mtSv+/P8H9faLLw1HyD6FzcjZSqjfke1k7zTwt9iKEkNX89qzR2/ v2NJOvkY/gOtI71WR+PowGVeE29l0a6bHlEjnbsEpoWaK8FMpJtdcD67V7gh9z3D kX79erovZCmI1vqXYzgzcKNqlpGjw1c5cD82mOtdiRF5bVS67Ik= =P7S8 -----END PGP SIGNATURE----- --/ngKj0uIx7gCCSnc--