public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH 1/6] conf, fwd: Make overall forwarding mode local to conf path
Date: Wed, 11 Mar 2026 12:34:27 +1100	[thread overview]
Message-ID: <abDGoyBAZka2i3W6@zatzit> (raw)
In-Reply-To: <20260310203307.732079b9@elisabeth>

[-- Attachment #1: Type: text/plain, Size: 2220 bytes --]

On Tue, Mar 10, 2026 at 08:33:11PM +0100, Stefano Brivio wrote:
> On Tue, 10 Mar 2026 15:16:00 +1100
> David Gibson <david@gibson.dropbear.id.au> wrote:
> 
> > The 'mode' field of struct fwd_ports records the overall forwarding mode.
> > Now that runtime forwarding decisions are made based on the forwarding
> > table, this is almost unused outside conf().
> > 
> > The only exception is the auto-port scanning code, which uses it to
> > determine if a port scan is necessary.  We can instead derive that from the
> > forwarding table itself by checking if there are any entries with the
> > FWD_SCAN flag.
> > 
> > Once that's done, make the mode purely local to conf().  While we're there
> > rename the constants to FWD_MODE_* to avoid confusion with the forwarding
> > rule flag bits, which are also prefixed with FWD_.
> > 
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> >  conf.c | 82 ++++++++++++++++++++++++++++++++++++----------------------
> >  fwd.c  | 27 ++++++++++++++-----
> >  fwd.h  | 10 -------
> >  3 files changed, 72 insertions(+), 47 deletions(-)
> > 
> > diff --git a/conf.c b/conf.c
> > index 11d84536..c436b88e 100644
> > --- a/conf.c
> > +++ b/conf.c
> > @@ -199,15 +199,27 @@ static void conf_ports_range_except(const struct ctx *c, char optname,
> >  	}
> >  }
> >  
> > +/**
> > + * enum fwd_mode - Overall forwarding mode for a direction and protocol
> > + */
> 
> Nit: I'm actually trying to document enums in the matching kerneldoc
> style when it comes to it, see for example enum udp_iov_idx.
> 
> I don't think it's so much of a problem to omit it here, even though
> "SPEC" and "ALL" might not be that obvious. If you respin, maybe:
> 
>  * @FWD_MODE_UNSET	Initial value, not parsed/configured yet
>  * @FWD_MODE_SPEC	Forward specified ports
>  * @FWD_MODE_NONE	No forwarded ports
>  * @FWD_MODE_AUTO	Automatic detection and forwarding based on bound ports
>  * @FWD_MODE_ALL	Bind all free ports
> 
> ?

Done.

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-03-11  1:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10  4:15 [PATCH 0/6] Unify TCP and UDP forwarding tables David Gibson
2026-03-10  4:16 ` [PATCH 1/6] conf, fwd: Make overall forwarding mode local to conf path David Gibson
2026-03-10 19:33   ` Stefano Brivio
2026-03-11  1:34     ` David Gibson [this message]
2026-03-10  4:16 ` [PATCH 2/6] tcp: Remove stale description of port_to_tap field David Gibson
2026-03-10  4:16 ` [PATCH 3/6] fwd: Don't initialise unused port bitmaps David Gibson
2026-03-10  4:16 ` [PATCH 4/6] Fix misnamed field in struct ctx comments David Gibson
2026-03-10  4:16 ` [PATCH 5/6] fwd: Split forwarding table from port scanning state David Gibson
2026-03-10  4:16 ` [PATCH 6/6] fwd: Unify TCP and UDP forwarding tables David Gibson
2026-03-10 19:33   ` Stefano Brivio
2026-03-11  1:39     ` 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=abDGoyBAZka2i3W6@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /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).