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=202602 header.b=FLs1jJdD; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 070505A0265 for ; Wed, 06 May 2026 07:38:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1778045917; bh=QJC3S3GhnEBi7XDpMJ6GiJYjLyeWlszuRmKyoAhBtoE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FLs1jJdDfxbyTjK8bs874xkGPxGUb5SFDvjWvg0ugtQ9cazPEKCY3Luu241nqAAYd GTl3Yp3DCp354UEB4Urga8k2yHHjACP6urVcfv2yLgfVLdkVJnIdt3gwJeHF7mHiAM 07uhZxmVkg/1BpwpXuA8rw5ENx+GQXC689sV45axsg7REk+mwb8Zt/ukW+YoZNYiQi 5uViIr27V5C4wu1v3yoHlfm74T4j3zt/fSBRTNy/7I7A5Q/C5bh1NTp7xD/zJKdBKy HnK9uImnhhAqL3T+S2Zqhpwf5OwsZDK2boICdQwIquKqBQMCiEXQQVPVlbjtB3kmXS WWuv7rQt2ptaA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4g9PLj3kT7z4wCx; Wed, 06 May 2026 15:38:37 +1000 (AEST) Date: Wed, 6 May 2026 15:38:30 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH v8 10/19] pesto, conf: Have pesto connect to passt and check versions Message-ID: References: <20260505234719.1437340-1-sbrivio@redhat.com> <20260505234719.1437340-11-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="P8D5/1CoDMLNyJbR" Content-Disposition: inline In-Reply-To: <20260505234719.1437340-11-sbrivio@redhat.com> Message-ID-Hash: 5UQIOB6XG34JADOET6LRZ2D5FAZVLQHO X-Message-ID-Hash: 5UQIOB6XG34JADOET6LRZ2D5FAZVLQHO 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 , Laurent Vivier 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: --P8D5/1CoDMLNyJbR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 06, 2026 at 01:47:10AM +0200, Stefano Brivio wrote: > From: David Gibson >=20 > Start implementing pesto in earnest. Create a control/configuration > socket in passt. Have pesto connect to it and retrieve a server greeting > Perform some basic version checking. >=20 > Signed-off-by: David Gibson > [sbrivio: Avoid potential recursive calling between conf_accept() and > conf_close(), reported by clang-tidy] Huh. For some reason that warning didn't trip for me. Although it's technically true they can mutually recurse, I believe they're both tail calls, so it shouldn't eat the stack. > [sbrivio: In conf(), check we're not exceeding sizeof(c->control_path) > instead of sizeof(c->socket_path), and, in pesto's main(), print > argv[optind] instead of argv[1] to indicate an invalid socket path, > both reported by Jon Maloy] > [sbrivio: In pesto's main(), drop unnecessary newline from error > message, reported by Laurent] > [sbrivio: Don't use SOCK_NONBLOCK on accept4(), as that only applies > to the *new* file descriptor, which we don't want -- set O_NONBLOCK > on the listening file descriptor using fcntl()] Making the new (accepted) socket non-blocking was the intended behaviour here. We also want non-blocking for the listening socket, but that was already done in feab892c7 ("tap, repair: Use SOCK_NONBLOCK and SOCK_CLOEXEC on Unix sockets"). WIth the current design, I guess we don't want non-blocking on the accepted socket, although I don't think it actually matters very much. We will want non-blocking it when we change this to read out the updated rules incrementally, rather than all at once. [snip] > @@ -1072,6 +1080,19 @@ static void conf_open_files(struct ctx *c) > if (c->pidfile_fd < 0) > die_perror("Couldn't open PID file %s", c->pidfile); > } > + > + c->fd_control =3D -1; > + if (*c->control_path) { > + c->fd_control_listen =3D sock_unix(c->control_path); > + if (c->fd_control_listen < 0) { > + die_perror("Couldn't open control socket %s", > + c->control_path); > + } > + if (fcntl(c->fd_control_listen, F_SETFL, O_NONBLOCK)) > + die_perror("Couldn't set O_NONBLOCK on control socket"); So, this is unneccessary because of feab892c7. --=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 --P8D5/1CoDMLNyJbR Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmn608YACgkQzQJF27ox 2GfL6BAAowj9waMxZu5YeRSDLWSKwX/n6Kt6MW4PV3Z2E9S5VREutCeKsQD2CW5R Kijm2DzZo/guoCQ6Bta22U/2z8HcmECA9IbwLV7GVbJ2xdFvuw/fnN5lqBxv/paK Ch2XPi6vnuvg0D/f+mLxNbrgPjztIk938UdJS+zjgsxnDzh5mIHFsAfnPGV0wsYH K0QQuznIHB8AcQUwwzVlzb3OocrRrQGTbHFR/hRR/MEdUWV9r/QKHmM9Yv8aS2/l G7L7VyobNz/S/fZ0nkuFogsat/6bhMQn0NC9adb2ftUk/xLz6FbGlZRWPj8n22gj bKdyonh1qeRPVGMowxyNP6XvP7mNPD4h24/IwX+36gULrVTA0ghmmILhcbyVyOxv LaZaWTJ0oVG+y6VOsURUqBu65yshOCKIf1lAP8a8sV7KU+AZ7bt7GDhvAhbiqeLR b9PXDtJ9z0RrSPWAsJY8rFFfC8DH920yuOMG3G4UCs3LX+e7K1Wqei/DC4WxpYpH i5ZNc/WCR9yyM6GrOn/qbWWhsChrjgsdps15tXLLUppcmdhGJJZO556vnxS7OJ3/ nPqp7UzAI1dUMmegjIKBOghOymjp6zXMS3o9jfXzFz8lpFagaTLTk5WW3YTaPoEe 5TDUxZuev4OX/uFloeDHgob6LAzF+7mOMF78h3Ma0sqdu5BFSgg= =l9js -----END PGP SIGNATURE----- --P8D5/1CoDMLNyJbR--