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=ZTjJgx4v; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id E34155A026D for ; Wed, 29 Apr 2026 07:21:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1777440103; bh=YQRhbqzE1XQSvj7OOn5ZJntNxzYS7G4ZXcSnsWs2vYM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZTjJgx4vJ/FyhDUjBvlSzMW43BQ9/n3Jj6x5CMovJBdvKbGWWEzvTsjWff3J6hZyh Ac11gEJokHUItcNoITYeHtzqMxZ5oaC9Vje+I1EjFq0j9wh6USKF9aJIKMwggyXmC0 b6OgnDCTebNk/KBNdzTiiKnnnwlH6yhJK4eXGIBi0eMtGMiplo/3OUnTc7oOA7svvu y6NqVU55ck/KOmuueWlF5HPaa4V3W6kUxNonKN64K+inFELy3YUKj6mJiJrr2fgHqd bSd8OF9Q/BT6x7482upQg3Zk4Q956xPX54xHAV0QMnQl1wrU+mN8/yMDcQdvvSBo76 qIYDxEtoIVPhA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4g55JR5bm7z4wV2; Wed, 29 Apr 2026 15:21:43 +1000 (AEST) Date: Wed, 29 Apr 2026 15:18:42 +1000 From: David Gibson To: Jon Maloy Subject: Re: [PATCH v5 11/18] pesto, conf: Have pesto connect to passt and check versions Message-ID: References: <20260421062516.2601204-1-david@gibson.dropbear.id.au> <20260421062516.2601204-12-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="324qMnz7rqbj4A4p" Content-Disposition: inline In-Reply-To: Message-ID-Hash: UHQKEMOMUIBA4UNFMGGKQK6GVUUKTPBS X-Message-ID-Hash: UHQKEMOMUIBA4UNFMGGKQK6GVUUKTPBS 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: Stefano Brivio , 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: --324qMnz7rqbj4A4p Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Apr 26, 2026 at 09:45:06AM -0400, Jon Maloy wrote: >=20 >=20 > On 2026-04-21 02:25, David Gibson wrote: > > Start implementing pesto in earnest. Create a control/configuration > > socket in passt. Have pesto connect to it and retrieve a server greeti= ng > > Perform some basic version checking. >=20 > [...] >=20 > > /** > > * conf() - Process command-line arguments and set configuration > > * @c: Execution context > > @@ -1189,9 +1227,10 @@ void conf(struct ctx *c, int argc, char **argv) > > {"migrate-exit", no_argument, NULL, 29 }, > > {"migrate-no-linger", no_argument, NULL, 30 }, > > {"stats", required_argument, NULL, 31 }, > > + {"conf-path", required_argument, NULL, 'c' }, > > { 0 }, > > }; > > - const char *optstring =3D "+dqfel:hs:F:I:p:P:m:a:n:M:g:i:o:D:S:H:461t= :u:T:U:"; > > + const char *optstring =3D "+dqfel:hs:c:F:I:p:P:m:a:n:M:g:i:o:D:S:H:46= 1t:u:T:U:"; > > const char *logname =3D (c->mode =3D=3D MODE_PASTA) ? "pasta" : "pas= st"; > > bool opt_t =3D false, opt_T =3D false, opt_u =3D false, opt_U =3D fa= lse; > > char userns[PATH_MAX] =3D { 0 }, netns[PATH_MAX] =3D { 0 }; > > @@ -1449,6 +1488,13 @@ void conf(struct ctx *c, int argc, char **argv) > > c->fd_tap =3D -1; > > break; > > + case 'c': > > + ret =3D snprintf(c->control_path, sizeof(c->control_path), > > + "%s", optarg); > > + if (ret <=3D 0 || ret >=3D (int)sizeof(c->sock_path)) >=20 > s/sizeof(c->sock_path)/sizeof(c->config_path)/ Oops, yes. [snip] > > @@ -122,5 +128,42 @@ int main(int argc, char **argv) > > debug("debug_flag=3D%d, path=3D\"%s\"", debug_flag, argv[optind]); > > - die("pesto is not implemented yet"); > > + if ((s =3D socket(AF_UNIX, SOCK_STREAM, 0)) < 0) > > + die_perror("Failed to create AF_UNIX socket"); > > + > > + ret =3D snprintf(a.sun_path, sizeof(a.sun_path), "%s", argv[optind]); > > + if (ret <=3D 0 || ret >=3D (int)sizeof(a.sun_path)) > > + die("Invalid socket path \"%s\"", argv[1]); >=20 > s/argv[1]/argv[optind] for consistency. And again. This is not just for consistency, but for correctness (of the error message). Depending on the command line, optind may not be equal to 1. --=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 --324qMnz7rqbj4A4p Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmnxlKgACgkQzQJF27ox 2GdPrhAAkG46FIuQYLm7XCKMMxt/c2isc5ZkTp044b6VE9TWPOJTkPdCd8ox4HhS FPZJsRP/Cl+775ryGp76vbZTjImBdEUZYchiJuFPuv5fshiN16vvHpGCiYlBFPae 1tUCU/Qi3P55fYVUaG2KO2iEXhs8gxEyLX8Xoq5XRDA1SxprqYJKYMDW8Z1wV5UE 1sDwroirSJTsn0Oy1bVphIAaiZh1G3X3VxejTDTHMqDl6hRemQBPOYj8n2CVv480 dWL4eVPTIBkeVWv3V0PdqfxSMI04LeGaMHgvX6fQ9YbOnL8xzUEd4fkdRbye559H 34GLWXvoKB7O5/1wSuWqjpRfrLWadUPEcUNV4MbRw7OFi/62KdXsymfhCFxtLMgu FbtFzTCT6hPS5yh8EvDFVIWticYoI1ZUkCxWWGmDMaJW2U3yTJwQnfajWuntrRWW H8FtdovNxNOoZKm84VDuaipZU3ymWBHC8Ezzqyqhv5/nyMMK/bb3m+Ikn5ZWFDpl sTMelzQ5XrqTa4zFjMqQD99yhW1KvqwZj0kud/2y7PPRtA7WLOVX176nA3Z/yPJ6 JpKUjP9tyLsANIUzuljduhUncupy74yiiDnCv40MSixVfy40MZmsgJtxt5iXx3b/ 9e9xbOB1vToLvXFcUC1dGQyJ6HCnirBX3k7yn6QI3c3dVmseCbs= =n2GV -----END PGP SIGNATURE----- --324qMnz7rqbj4A4p--