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=BjKhv40c; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 0F1385A0262 for ; Wed, 29 Apr 2026 07:21:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1777440103; bh=+JKROYQG5NJ8Ax3z/VMatOr4Mz/wt4FfYszE/6JXWIw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BjKhv40cp5LmErByTLibUrSnK9lxqbpvhTMZPLChusNQ1zxJ2wOKoAA3KFDuXl1Cp grQp4VT+1VEBVhtZx80XZEWpLCgszo+F8SoY1OfXs6NVoXlRl+pds3eqeFIiwGblwH 3lhZwEmF0SlQF++DjWR8h7CAvXfIiZ9XBhIUmOwSJ0cNB9zPso4ejPMm8orRSvDmzv bnKsUunZn7AxsU0OEaekkB6k/OjvXDB2j0oBHGanWjnkT1sZn7V3g0JRT19XhsWVFQ 1IjacOz2ncTlUMeYYNsXNcl673x5kLfe9NQVUSRyDXMErCmm/k9pbjHMgrD7TlGKD8 oB2oidNypcO8w== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4g55JR5PCnz4whd; Wed, 29 Apr 2026 15:21:43 +1000 (AEST) Date: Wed, 29 Apr 2026 15:17:34 +1000 From: David Gibson To: Jon Maloy Subject: Re: [PATCH v5 12/18] pesto: Expose list of pifs to pesto and optionally display Message-ID: References: <20260421062516.2601204-1-david@gibson.dropbear.id.au> <20260421062516.2601204-13-david@gibson.dropbear.id.au> <6b108478-260d-4df6-abfd-cc66c279b693@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ehSWGTPPhip8qZlS" Content-Disposition: inline In-Reply-To: <6b108478-260d-4df6-abfd-cc66c279b693@redhat.com> Message-ID-Hash: UROODHCFMYOLUK5KIKHSFTILGT4656L7 X-Message-ID-Hash: UROODHCFMYOLUK5KIKHSFTILGT4656L7 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, David Gibson , Stefano Brivio 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: --ehSWGTPPhip8qZlS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Apr 26, 2026 at 09:45:14AM -0400, Jon Maloy wrote: >=20 >=20 > On 2026-04-21 02:25, David Gibson wrote: > > Extend the dynamic update protocol to expose the pif indices and names > > from a running passt/pasta to the pesto tool. pesto records that data > > and, if requested with a new --show flag, prints it out. > >=20 > > Signed-off-by: David Gibson > > --- > > Makefile | 1 + > > common.h | 2 + > > conf.c | 41 ++++++++++++++++ > > pesto.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > > pesto.h | 19 +++++++- > > pif.h | 4 +- > > serialise.c | 4 ++ > > serialise.h | 1 + > > util.h | 2 - > > 9 files changed, 200 insertions(+), 6 deletions(-) > >=20 >=20 > [...] >=20 > > diff --git a/pesto.h b/pesto.h > > index 92d4df3a..ac4c2b58 100644 > > --- a/pesto.h > > +++ b/pesto.h > > @@ -17,18 +17,33 @@ > > /* Version 0 is reserved for unreleased / unsupported experimental ve= rsions */ > > #define PESTO_PROTOCOL_VERSION 0 > > +/* Maxmimum size of a pif name, including \0 */ > > +#define PIF_NAME_SIZE (128) > > +#define PIF_NONE 0 > > + > > /** > > * struct pesto_hello - Server introduction message > > - * @magic: PESTO_SERVER_MAGIC > > - * @version: Version number > > + * @magic: PESTO_SERVER_MAGIC > > + * @version: Version number > > + * @pif_name_size: Server's value for PIF_NAME_SIZE > > */ > > struct pesto_hello { > > char magic[8]; > > uint32_t version; > > + uint32_t pif_name_size; > > } __attribute__ ((__packed__)); > > static_assert(sizeof(PESTO_SERVER_MAGIC) > > =3D=3D sizeof(((struct pesto_hello *)0)->magic), > > "PESTO_SERVER_MAGIC has wrong size"); > > +/** > > + * struct pesto_pif_info - Message with basic metadata about a pif > > + * @resv_: Alignment gap (must be 0) >=20 > You forgot to remove this one. Oops, yes. > > + * @name: Name (\0 terminated) > > + */ > > +struct pesto_pif_info { > > + char name[PIF_NAME_SIZE]; > > +} __attribute__ ((__packed__)); > > + > > #endif /* PESTO_H */ > > diff --git a/pif.h b/pif.h > > index 90dd3a32..d7708603 100644 > > --- a/pif.h > > +++ b/pif.h > > @@ -11,6 +11,7 @@ > > #include > > +#include "pesto.h" > > #include "epoll_type.h" > > union inany_addr; > > @@ -24,7 +25,7 @@ union sockaddr_inany; > > */ > > enum pif_type { > > /* Invalid or not present pif */ > > - PIF_NONE =3D 0, > > + PIF_NONE_ =3D PIF_NONE, >=20 > This looks a bit weird. Yes, but it seemed less weird that the other approaches I could think of to do what I needed. The key point here is that the specific value of PIF_NONE is locked as part of the configuration protocol. The values of all other pif indices are (intentionally) passt internal and should not be known by the client. > As fara as I can see this one is never used. Yes, that's correct. > If it is important that PIF_NONE is zero and PIF_HOST is 1, It's important that PIF_NONE is zero. It's not important that PIF_HOST is 1. > you could just do: >=20 > enum pif_type { >=20 > PIF_HOST =3D 1, >=20 > PIF_TAP, > PIF_SPLICE, >=20 > PIF_NUM_TYPES, > }; I could, but I think this makes the connection between the public PIF_NONE and the private PIF_* less obvious. >=20 > or > #define PESTO_PIF_END 0 > in pesto.h > and leave this one as is. I could - indeed an earlier draft did essentially this. Hoewver, that wouldn't enforce that PIF_NONE is equal to the terminator value, which it should be. >=20 > /jon >=20 > [...] >=20 > item) - (array) < ARRAY_SIZE(array); (item)++) >=20 --=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 --ehSWGTPPhip8qZlS Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmnxlGUACgkQzQJF27ox 2GfnQw//dKcNl3PkxOYeLTb/ZjrV9sMZ242+aiGOCFkefkRneVrphHjRGd3rOWys FzoYpf9fbmucOVGmWeQLQU9xvKrhvLvz1ddsLD3PjML3FpsDTzzTRj/tZvwsrylG AdXd80VSf8S140t7kovAP/RElePqRCXt4gZGYDBRH8/cUt5qdZ9x5i+9PZWFP2KZ qlOZcVu5GItM9A2oJ3W66Ov4ml1YqiCYr6BBIaWvq4PIcC7a0EBtFXg5LkvOl4ma 8SKVeh/rHsIs2FvsmshkJXjsyxncy6NBEFW0qtyr7QTeqEbbMZM9Vc7dI6cjhNK+ F/UoG4pnx/Tv7zu4zS0rZ/VzjPNODv98MCRhMsfNfjpTGHhNOqZJbjn3bqgQZEUK 8d62VJrYxRcGszGp2TRenh5iAGK+FtHRFm/BCIkTBntdIRVM53KjgKTz79KBm32c ihZlFRbt1GnoFQG/DQpUyQY36AZp6ZTuSX7squ+mYBcCLvsvtignP6CVFD4cP5mn HO75zddSj/YS+ui/uT1yGlnB2xls+orRARuy+72khjHt5FZ0zxR5uw0gLB8VzoME HOocZqkqI52BXPsjOczVC7PWtTTYsv5XIaLuFQoS0qcH9dlNqEowiKyWWHpPP5Zg xqYQd+uPrw3l/0p64z9fV2fzDQYxR65AjLqR634lL3hBLpd/zEE= =GzP1 -----END PGP SIGNATURE----- --ehSWGTPPhip8qZlS--