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=lXC1AQcI; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 7618F5A061E for ; Wed, 25 Mar 2026 05:44:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1774413865; bh=w/EpvJSJMI5EMjLiCSrZ1Z/1PhxYAo8XgKOnOPaAAoE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lXC1AQcIMaqTEWGUR1t7ixzbEfN+8qGlxrfJbmA+UqinZXohxCQK/5rC30nDQ9HGo w7ZEhX66KELWBjjVVPqd97pTb5EFDKoVhNS7zZr2nJnia9vVOFLOWYnd608unO1jcx cVUvf+XWqKKxFvHoezs50CxsnoKPhnbjH2xnyOL5k5/PzIPqzBRFmrt8IFLinpmo+Z s/XwD4J7gYd02bJ+9RPx9fHecoy3n1woWHAdfaGiF2swMIEUSi8Kk0VZEMCgvdn1Ba 6RyQw/+Yr0GYwpm9wrkqs725BukIakpRxg7lI+79TVR+JGRoNbWsvpYuuSNPCvyM8B YlmhzgrU4+h5w== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4fgZ7Y2qMGz4wM8; Wed, 25 Mar 2026 15:44:25 +1100 (AEDT) Date: Wed, 25 Mar 2026 15:43:40 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH v3 21/25] pesto: Read current ruleset from passt/pasta and display it Message-ID: References: <20260323073732.3158468-1-david@gibson.dropbear.id.au> <20260323073732.3158468-22-david@gibson.dropbear.id.au> <20260325015638.0760a30d@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ryXdArtkZ9CUbAwc" Content-Disposition: inline In-Reply-To: <20260325015638.0760a30d@elisabeth> Message-ID-Hash: MX2TNURDWBGEE3GROJ4SKK4RHEUMOVMP X-Message-ID-Hash: MX2TNURDWBGEE3GROJ4SKK4RHEUMOVMP 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: --ryXdArtkZ9CUbAwc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 25, 2026 at 01:56:39AM +0100, Stefano Brivio wrote: > On Mon, 23 Mar 2026 18:37:28 +1100 > David Gibson wrote: >=20 > > Implement serialisation of our current forwarding rules in conf.c, > > deserialising it to display in the pesto client. > >=20 > > Signed-off-by: David Gibson > > --- > > conf.c | 44 +++++++++++++++++++++++++++++++ > > fwd_rule.c | 40 ++++++++++++++++++++++++++++ > > fwd_rule.h | 3 +++ > > pesto.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++--- > > 4 files changed, 160 insertions(+), 4 deletions(-) > >=20 > > diff --git a/conf.c b/conf.c > > index b878db94..7f311914 100644 > > --- a/conf.c > > +++ b/conf.c > > @@ -2338,6 +2338,47 @@ static int conf_send_pifs(const struct ctx *c, i= nt fd) > > return 0; > > } > > =20 > > +/** > > + * conf_send_rules() - Send current forwarding rules to dynamic update= client (pesto) >=20 > What about: >=20 > * conf_send_rules() - Send forwarding rules to configuration client (pes= to) Done. > > + * @c: Execution context > > + * @fd: Socket to the client > > + * > > + * Return: 0 on success, -1 on failure > > + */ > > +static int conf_send_rules(const struct ctx *c, int fd) > > +{ > > + unsigned pif; > > + > > + for (pif =3D 0; pif < PIF_NUM_TYPES; pif++) { > > + const struct fwd_table *fwd =3D c->fwd[pif]; > > + unsigned i; > > + > > + if (!fwd) > > + continue; > > + > > + assert(pif); > > + > > + /* PIF id */ > > + if (write_u8(fd, pif)) > > + return -1; > > + > > + /* Number of rules */ > > + if (write_u32(fd, fwd->count)) > > + return -1; > > + > > + for (i =3D 0; i < fwd->count; i++) { > > + if (fwd_rule_write(fd, &fwd->rules[i].rule)) > > + return -1; > > + } > > + } > > + > > + /* Write 0 PIF id to finish */ > > + if (write_u8(fd, 0)) >=20 > We have PIF_NONE, shouldn't we use that to make it obvious that it's an > invalid value? Done. >=20 > > + return -1; > > + > > + return 0; > > +} > > > > [...] >=20 > I stopped reviewing here, the next patches in my series are anyway mine > and after those I guess it doesn't make sense, yet, that I review in > fine detail, as we'll probably need to change a bunch of things. Understood. --=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 --ryXdArtkZ9CUbAwc Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmnDZ/wACgkQzQJF27ox 2Gc+bg//cU2s1TPa6kXln5oynJlMZ9dYZNumLWlLAM+/VdAhaDr/6Lq5Ie1KepPP 845gB4D3BgRjG2+IMv6HSkqKwMUTIN+iNY8wwRxAmEPeQc9phF3oZAxYcNz2b8Ls 5Llw+YJOEhML3OG+/8iqKa8R/W6LG4LHSrdOgXuvoIlVJIC64lSVeHjwnkHn/5vT NCQUbBtswsd3yAG6EEt1gYMUN6DGFMwjkW1rLuBjBmokxWtkxWiw3/aOfZQg1F9k 41nRQwbVw2ztaA6LBd9W8ypbnqTTCyhioNMDCweF/bmzhSgCosGrHemQChSKAuN8 65b+h8e2XZ9EBIHsJCU9eT4WYOBsengMmRivbS6ra/TZCJECz92M6WW+tfygQukC GaHQayr2Vjws+Rt1n0Zrl+LkTd18vguTK2suKdxyqWT0UNKhVfVmm2VVKw2MhNdl 7FQrPifuNYq0qThoZBVPw0d/vczeNZf4edkKCqmwQtz/4oPTtoC+0F3PlAAvon4R 3/fHoqC36iJ3k9k+U9IT4uub1Wnsyz1ke+OJnqFutTTLP6p2kHK57JO/xvFq8iqb Y7wM0Zv7rktITPrv7pLbMlkqJsAZlSH2aGYvSct1ZnWesYEsHcu8wJSDcvuHTGkC Y9Jwt35B/Btr0UsPYWhmq/pBV7cXofkxavr0dFz2LSzn4SnzUyI= =9vWr -----END PGP SIGNATURE----- --ryXdArtkZ9CUbAwc--