public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Jon Maloy <jmaloy@redhat.com>,
	passt-dev@passt.top, David Gibson <dgibson@redhat.com>
Subject: Re: [PATCH v5 12/18] pesto: Expose list of pifs to pesto and optionally display
Date: Sun, 03 May 2026 23:56:27 +0200 (CEST)	[thread overview]
Message-ID: <20260503235626.6d5ff978@elisabeth> (raw)
In-Reply-To: <afGUbjAwsBk4osu2@zatzit>

On Wed, 29 Apr 2026 15:17:34 +1000
David Gibson <david@gibson.dropbear.id.au> wrote:

> On Sun, Apr 26, 2026 at 09:45:14AM -0400, Jon Maloy wrote:
> > 
> > 
> > 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.
> > > 
> > > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > > ---
> > >   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(-)
> > >   
> > 
> > [...]
> >   
> > > 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 versions */
> > >   #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)
> > >   	      == 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)  
> > 
> > You forgot to remove this one.  
> 
> Oops, yes.

Fixed in v6.

> > > + * @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 <netinet/in.h>
> > > +#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 = 0,
> > > +	PIF_NONE_ = PIF_NONE,  
> > 
> > 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:
> > 
> > enum pif_type {
> > 
> >       PIF_HOST = 1,
> > 
> >       PIF_TAP,
> >       PIF_SPLICE,
> > 
> >       PIF_NUM_TYPES,
> >   };  
> 
> I could, but I think this makes the connection between the public
> PIF_NONE and the private PIF_* less obvious.
> 
> > 
> > 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.

Left as it was in v6.

-- 
Stefano


  reply	other threads:[~2026-05-03 21:56 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21  6:24 [PATCH v5 00/18] RFC: Dynamic configuration update implementation David Gibson
2026-04-21  6:24 ` [PATCH v5 01/18] conf, fwd: Stricter rule checking in fwd_rule_add() David Gibson
2026-04-25 13:31   ` Jon Maloy
2026-04-27  3:20     ` David Gibson
2026-05-03 21:56       ` Stefano Brivio
2026-04-21  6:25 ` [PATCH v5 02/18] fwd_rule: Move ephemeral port probing to fwd_rule.c David Gibson
2026-04-21  6:25 ` [PATCH v5 03/18] fwd, conf: Move rule parsing code to fwd_rule.[ch] David Gibson
2026-04-24 21:59   ` Jon Maloy
2026-04-24 22:36   ` Jon Maloy
2026-05-03 21:56     ` Stefano Brivio
2026-04-21  6:25 ` [PATCH v5 04/18] fwd_rule: Move conflict checking back within fwd_rule_add() David Gibson
2026-04-21  6:25 ` [PATCH v5 05/18] fwd: Generalise fwd_rules_info() David Gibson
2026-04-21  6:25 ` [PATCH v5 06/18] pif: Limit pif names to 128 bytes David Gibson
2026-04-21  6:25 ` [PATCH v5 07/18] fwd_rule: Fix some format specifiers David Gibson
2026-04-21  6:25 ` [PATCH v5 08/18] tap, repair: Use SOCK_NONBLOCK and SOCK_CLOEXEC on Unix sockets David Gibson
2026-04-21  6:25 ` [PATCH v5 09/18] pesto: Introduce stub configuration tool David Gibson
2026-04-21  6:25 ` [PATCH v5 10/18] pesto, log: Share log.h (but not log.c) with pesto tool David Gibson
2026-04-21  6:25 ` [PATCH v5 11/18] pesto, conf: Have pesto connect to passt and check versions David Gibson
2026-04-26 13:45   ` Jon Maloy
2026-04-29  5:18     ` David Gibson
2026-05-03 21:56       ` Stefano Brivio
2026-04-21  6:25 ` [PATCH v5 12/18] pesto: Expose list of pifs to pesto and optionally display David Gibson
2026-04-26 13:45   ` Jon Maloy
2026-04-29  5:17     ` David Gibson
2026-05-03 21:56       ` Stefano Brivio [this message]
2026-04-21  6:25 ` [PATCH v5 13/18] ip: Prepare ip.[ch] for sharing with pesto tool David Gibson
2026-04-21  6:25 ` [PATCH v5 14/18] inany: Prepare inany.[ch] " David Gibson
2026-04-21  6:25 ` [PATCH v5 15/18] pesto: Read current ruleset from passt/pasta and optionally display it David Gibson
2026-04-24 22:37   ` Jon Maloy
2026-04-25  7:36     ` Stefano Brivio
2026-04-29  5:19       ` David Gibson
2026-05-03 21:56         ` Stefano Brivio
2026-04-21  6:25 ` [PATCH v5 16/18] pesto: Parse and add new rules from command line David Gibson
2026-04-21  6:25 ` [PATCH v5 17/18] pesto, conf: Send updated rules from pesto back to passt/pasta David Gibson
2026-04-24 22:38   ` Jon Maloy
2026-04-25  7:36     ` Stefano Brivio
2026-04-29  5:21       ` David Gibson
2026-05-03 21:56         ` Stefano Brivio
2026-04-21  6:25 ` [PATCH v5 18/18] conf, fwd: Allow switching to new rules received from pesto David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260503235626.6d5ff978@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=dgibson@redhat.com \
    --cc=jmaloy@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).