public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top, Jon Maloy <jmaloy@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH v6 08/18] pesto: Introduce stub configuration tool
Date: Tue, 05 May 2026 01:10:43 +0200 (CEST)	[thread overview]
Message-ID: <20260505011042.476b0f17@elisabeth> (raw)
In-Reply-To: <e147c428-86cb-4641-8889-1dd8930f5ca3@redhat.com>

On Mon, 4 May 2026 12:51:02 +0200
Laurent Vivier <lvivier@redhat.com> wrote:

> On 5/3/26 23:55, Stefano Brivio wrote:
> > From: David Gibson <david@gibson.dropbear.id.au>
> > 
> > Build a new "pesto" binary, which will become the tool to update a running
> > passt/pasta's configuration.  For now, we just build a stub binary which
> > sets up a basic environment, parses trivial command line options but does
> > nothing else.
> > 
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > Signed-off-by: Stefano Brivio <sbrivio@redhat.com>  
> 
> Reviewed-by: Laurent Vivier <lvivier@redhat.com>
> 
> One little nit below
> 
> > ---
> >   .gitignore |   2 +
> >   Makefile   |  42 +++++++++++------
> >   common.h   |  24 ++++++++++
> >   pesto.1    |  46 +++++++++++++++++++
> >   pesto.c    | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >   pesto.h    |  12 +++++
> >   util.h     |  12 +----
> >   7 files changed, 244 insertions(+), 26 deletions(-)
> >   create mode 100644 common.h
> >   create mode 100644 pesto.1
> >   create mode 100644 pesto.c
> >   create mode 100644 pesto.h
> > 
> > diff --git a/.gitignore b/.gitignore
> > index 3c16adc..3e40d9f 100644
> > --- a/.gitignore
> > +++ b/.gitignore
> > @@ -4,9 +4,11 @@
> >   /pasta
> >   /pasta.avx2
> >   /passt-repair
> > +/pesto
> >   /qrap
> >   /pasta.1
> >   /seccomp.h
> > +/seccomp_pesto.h
> >   /seccomp_repair.h
> >   /c*.json
> >   README.plain.md
> > diff --git a/Makefile b/Makefile
> > index 7875d23..030681b 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -47,19 +47,21 @@ PASST_SRCS = arch.c arp.c bitmap.c checksum.c conf.c dhcp.c dhcpv6.c \
> >   	vhost_user.c virtio.c vu_common.c
> >   QRAP_SRCS = qrap.c
> >   PASST_REPAIR_SRCS = passt-repair.c
> > -SRCS = $(PASST_SRCS) $(QRAP_SRCS) $(PASST_REPAIR_SRCS)
> > -
> > -MANPAGES = passt.1 pasta.1 qrap.1 passt-repair.1
> > -
> > -PASST_HEADERS = arch.h arp.h bitmap.h checksum.h conf.h dhcp.h dhcpv6.h \
> > -	epoll_ctl.h flow.h fwd.h fwd_rule.h flow_table.h icmp.h icmp_flow.h \
> > -	inany.h iov.h ip.h isolation.h lineread.h log.h migrate.h ndp.h \
> > -	netlink.h packet.h passt.h pasta.h pcap.h pif.h repair.h serialise.h \
> > -	siphash.h tap.h tcp.h tcp_buf.h tcp_conn.h tcp_internal.h tcp_splice.h \
> > -	tcp_vu.h udp.h udp_flow.h udp_internal.h udp_vu.h util.h vhost_user.h \
> > -	virtio.h vu_common.h
> > +PESTO_SRCS = pesto.c
> > +SRCS = $(PASST_SRCS) $(QRAP_SRCS) $(PASST_REPAIR_SRCS) $(PESTO_SRCS)
> > +
> > +MANPAGES = passt.1 pasta.1 pesto.1 qrap.1 passt-repair.1
> > +
> > +PASST_HEADERS = arch.h arp.h bitmap.h checksum.h common.h conf.h dhcp.h \
> > +	dhcpv6.h epoll_ctl.h flow.h fwd.h fwd_rule.h flow_table.h icmp.h \
> > +	icmp_flow.h inany.h iov.h ip.h isolation.h lineread.h log.h migrate.h \
> > +	ndp.h netlink.h packet.h passt.h pasta.h pcap.h pesto.h pif.h repair.h \
> > +	serialise.h siphash.h tap.h tcp.h tcp_buf.h tcp_conn.h tcp_internal.h \
> > +	tcp_splice.h tcp_vu.h udp.h udp_flow.h udp_internal.h udp_vu.h util.h \
> > +	vhost_user.h virtio.h vu_common.h
> >   QRAP_HEADERS = arp.h ip.h passt.h util.h
> >   PASST_REPAIR_HEADERS = linux_dep.h
> > +PESTO_HEADERS = common.h pesto.h
> >   
> >   C := \#include <sys/random.h>\nint main(){int a=getrandom(0, 0, 0);}
> >   ifeq ($(shell printf "$(C)" | $(CC) -S -xc - -o - >/dev/null 2>&1; echo $$?),0)
> > @@ -78,7 +80,7 @@ docdir		?= $(datarootdir)/doc/passt
> >   mandir		?= $(datarootdir)/man
> >   man1dir		?= $(mandir)/man1
> >   
> > -BASEBIN = passt qrap passt-repair
> > +BASEBIN = passt qrap passt-repair pesto
> >   ifeq ($(TARGET_ARCH),x86_64)
> >   BASEBIN += passt.avx2
> >   endif
> > @@ -100,6 +102,9 @@ seccomp.h: seccomp.sh $(PASST_SRCS) $(PASST_HEADERS)
> >   seccomp_repair.h: seccomp.sh $(PASST_REPAIR_SRCS) $(PASST_REPAIR_HEADERS)
> >   	@ ARCH="$(TARGET_ARCH)" CC="$(CC)" ./seccomp.sh seccomp_repair.h $(PASST_REPAIR_SRCS)
> >   
> > +seccomp_pesto.h: seccomp.sh $(PESTO_SRCS)
> > +	@ ARCH="$(TARGET_ARCH)" CC="$(CC)" ./seccomp.sh seccomp_pesto.h $(PESTO_SRCS)
> > +
> >   $(BASEBIN): %:
> >   	$(CC) $(BASE_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(filter %.c,$^) -o $@
> >   
> > @@ -116,6 +121,8 @@ qrap: $(QRAP_SRCS) $(QRAP_HEADERS)
> >   
> >   passt-repair: $(PASST_REPAIR_SRCS) $(PASST_REPAIR_HEADERS) seccomp_repair.h
> >   
> > +pesto: $(PESTO_SRCS) $(PESTO_HEADERS) seccomp_pesto.h
> > +
> >   valgrind: EXTRA_SYSCALLS += rt_sigprocmask rt_sigtimedwait rt_sigaction	\
> >   			    rt_sigreturn getpid gettid kill clock_gettime \
> >   			    mmap|mmap2 munmap open unlink gettimeofday futex \
> > @@ -126,7 +133,7 @@ valgrind: all
> >   
> >   .PHONY: clean
> >   clean:
> > -	$(RM) $(BIN) *~ *.o seccomp.h seccomp_repair.h pasta.1 \
> > +	$(RM) $(BIN) *~ *.o seccomp.h seccomp_repair.h seccomp_pesto.h pasta.1 \
> >   		passt.tar passt.tar.gz *.deb *.rpm \
> >   		passt.pid README.plain.md
> >   
> > @@ -183,7 +190,8 @@ docs: README.md
> >   CLANG_TIDY = clang-tidy
> >   CLANG_TIDY_FLAGS = -DCLANG_TIDY_58992
> >   
> > -clang-tidy: passt.clang-tidy passt-repair.clang-tidy qrap.clang-tidy
> > +clang-tidy: passt.clang-tidy passt-repair.clang-tidy pesto.clang-tidy \
> > +	qrap.clang-tidy
> >   
> >   .PHONY: %.clang-tidy
> >   %.clang-tidy:
> > @@ -191,6 +199,7 @@ clang-tidy: passt.clang-tidy passt-repair.clang-tidy qrap.clang-tidy
> >   
> >   passt.clang-tidy: $(PASST_SRCS) $(PASST_HEADERS) seccomp.h
> >   passt-repair.clang-tidy: $(PASST_REPAIR_SRCS) $(PASST_REPAIR_HEADERS) seccomp_repair.h
> > +pesto.clang-tidy: $(PESTO_SRCS) $(PESTO_HEADERS) seccomp_pesto.h
> >   qrap.clang-tidy: $(QRAP_SRCS) $(QRAP_HEADERS)
> >   
> >   CPPCHECK = cppcheck
> > @@ -206,7 +215,7 @@ CPPCHECK_FLAGS = --std=c11 --error-exitcode=1 --enable=all --force	\
> >   	--suppress=unusedStructMember					\
> >   	 -D CPPCHECK_6936
> >   
> > -cppcheck: passt.cppcheck passt-repair.cppcheck qrap.cppcheck
> > +cppcheck: passt.cppcheck passt-repair.cppcheck pesto.cppcheck qrap.cppcheck
> >   
> >   .PHONY: %.cppcheck
> >   %.cppcheck:
> > @@ -215,6 +224,9 @@ cppcheck: passt.cppcheck passt-repair.cppcheck qrap.cppcheck
> >   passt.cppcheck: $(PASST_SRCS) $(PASST_HEADERS) seccomp.h
> >   passt-repair.cppcheck: $(PASST_REPAIR_SRCS) $(PASST_REPAIR_HEADERS) seccomp_repair.h
> >   
> > +pesto.cppcheck: CPPCHECK_FLAGS += --suppress=unmatchedSuppression
> > +pesto.cppcheck: $(PESTO_SRCS) $(PESTO_HEADERS) seccomp_pesto.h
> > +
> >   qrap.cppcheck: BASE_CPPFLAGS += -DARCH=\"$(TARGET_ARCH)\"
> >   qrap.cppcheck: CPPCHECK_FLAGS += --suppress=unusedFunction
> >   qrap.cppcheck: $(QRAP_SRCS) $(QRAP_HEADERS)
> > diff --git a/common.h b/common.h
> > new file mode 100644
> > index 0000000..a9c115a
> > --- /dev/null
> > +++ b/common.h
> > @@ -0,0 +1,24 @@
> > +/* SPDX-License-Identifier: GPL-2.0-or-later
> > + * Copyright Red Hat
> > + * Author: David Gibson <david@gibson.dropbear.id.au>
> > + *
> > + * Definitions used by both passt/pasta and other tools
> > + */
> > +
> > +#ifndef COMMON_H
> > +#define COMMON_H
> > +
> > +#include <string.h>
> > +
> > +#define VERSION_BLOB							       \
> > +	VERSION "\n"							       \
> > +	"Copyright Red Hat\n"						       \
> > +	"GNU General Public License, version 2 or later\n"		       \
> > +	"  <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>\n"	       \
> > +	"This is free software: you are free to change and redistribute it.\n" \
> > +	"There is NO WARRANTY, to the extent permitted by law.\n\n"
> > +
> > +/* FPRINTF() intentionally silences cert-err33-c clang-tidy warnings */
> > +#define FPRINTF(f, ...)	(void)fprintf(f, __VA_ARGS__)
> > +
> > +#endif /* _COMMON_H */  
> 
> Why "_COMMON_H" and not "COMMON_H"?

I think it was... common, a long time ago, to prefix include guards
with underscores (perhaps in the Linux kernel, I don't remember). I also
happened to write some code with those and fixed it just before sending
out patches.

Somewhat curiously, that's also the case for lineread.h (without the
underscore in the actual include guard name, just in the comment at the
end), and I missed that during review as well:

  https://archives.passt.top/passt-dev/20220623113143.538e9266@elisabeth/

Anyway, fixed in v7.

-- 
Stefano


  reply	other threads:[~2026-05-04 23:10 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-03 21:55 [PATCH v6 00/18] Dynamic configuration update implementation Stefano Brivio
2026-05-03 21:55 ` [PATCH v6 01/18] conf, fwd: Stricter rule checking in fwd_rule_add() Stefano Brivio
2026-05-04  8:38   ` Laurent Vivier
2026-05-03 21:55 ` [PATCH v6 02/18] fwd_rule: Move ephemeral port probing to fwd_rule.c Stefano Brivio
2026-05-03 21:55 ` [PATCH v6 03/18] fwd, conf: Move rule parsing code to fwd_rule.[ch] Stefano Brivio
2026-05-03 21:55 ` [PATCH v6 04/18] fwd_rule: Move conflict checking back within fwd_rule_add() Stefano Brivio
2026-05-03 21:55 ` [PATCH v6 05/18] fwd: Generalise fwd_rules_info() Stefano Brivio
2026-05-03 21:55 ` [PATCH v6 06/18] pif: Limit pif names to 128 bytes Stefano Brivio
2026-05-04  9:12   ` Laurent Vivier
2026-05-04 23:10     ` Stefano Brivio
2026-05-03 21:55 ` [PATCH v6 07/18] fwd_rule: Fix some format specifiers Stefano Brivio
2026-05-04  9:59   ` Laurent Vivier
2026-05-03 21:55 ` [PATCH v6 08/18] pesto: Introduce stub configuration tool Stefano Brivio
2026-05-04 10:51   ` Laurent Vivier
2026-05-04 23:10     ` Stefano Brivio [this message]
2026-05-03 21:55 ` [PATCH v6 09/18] pesto, log: Share log.h (but not log.c) with pesto tool Stefano Brivio
2026-05-04  9:49   ` Laurent Vivier
2026-05-04 23:11     ` Stefano Brivio
2026-05-03 21:55 ` [PATCH v6 10/18] pesto, conf: Have pesto connect to passt and check versions Stefano Brivio
2026-05-04 12:01   ` Laurent Vivier
2026-05-04 12:13     ` Laurent Vivier
2026-05-03 21:55 ` [PATCH v6 11/18] pesto: Expose list of pifs to pesto and optionally display Stefano Brivio
2026-05-04 14:34   ` Laurent Vivier
2026-05-04 23:10     ` Stefano Brivio
2026-05-03 21:55 ` [PATCH v6 12/18] ip: Prepare ip.[ch] for sharing with pesto tool Stefano Brivio
2026-05-04 14:52   ` Laurent Vivier
2026-05-04 23:10     ` Stefano Brivio
2026-05-03 21:55 ` [PATCH v6 13/18] inany: Prepare inany.[ch] " Stefano Brivio
2026-05-04 15:37   ` Laurent Vivier
2026-05-03 21:55 ` [PATCH v6 14/18] pesto: Read current ruleset from passt/pasta and optionally display it Stefano Brivio
2026-05-04 16:10   ` Laurent Vivier
2026-05-04 23:11     ` Stefano Brivio
2026-05-03 21:55 ` [PATCH v6 15/18] pesto: Parse and add new rules from command line Stefano Brivio
2026-05-04 16:44   ` Laurent Vivier
2026-05-04 23:11     ` Stefano Brivio
2026-05-04 23:18       ` Stefano Brivio
2026-05-03 21:55 ` [PATCH v6 16/18] pesto, conf: Send updated rules from pesto back to passt/pasta Stefano Brivio
2026-05-03 21:56 ` [PATCH v6 17/18] conf, fwd: Allow switching to new rules received from pesto Stefano Brivio
2026-05-03 21:56 ` [PATCH v6 18/18] fwd_rule: Fix static checkers warnings in fwd_rule_add() Stefano Brivio

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=20260505011042.476b0f17@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=jmaloy@redhat.com \
    --cc=lvivier@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).