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=azAmUdcZ; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 406B95A0269 for ; Wed, 11 Mar 2026 02:39:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1773193182; bh=JyDhZjhW2XQQitY7Qeze9eBTKV26d+M+Vbvxf8cQjb4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=azAmUdcZZTJbq0+6FcdrFfI+KeWtFClwpAav6AMZvxMPVBZ4Ro8FNw57WY2Wj7Ul4 GvZ551Tn3nsa1wOfKRWyYA70wJrN9OfjHoSkUlLe9QgsUkyfu/aDQ1JVxM9kiOEVv1 YErhKb4rO0dC1o1LwSOE5d4pFqfB03JQQ6BVppZwh+a/9PdS22OFnVO8GKSS/RpK0s N9rRmyD4zV1+R82/WuZcJbyZygy2jQlPLDr1Oy/RdxfPAXmSmc++edvM0WbDyQCjX2 hkMxv20BAqltjhcyvKFTw7oiyLWrvQK8A8KFZqyN6agZ6ZW84KdJOZdwvc+APqff3e LoRHrhizaiWAQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4fVtht13PGz4wCk; Wed, 11 Mar 2026 12:39:42 +1100 (AEDT) Date: Wed, 11 Mar 2026 12:34:27 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 1/6] conf, fwd: Make overall forwarding mode local to conf path Message-ID: References: <20260310041605.1322552-1-david@gibson.dropbear.id.au> <20260310041605.1322552-2-david@gibson.dropbear.id.au> <20260310203307.732079b9@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="rY8wFXYFmN1V1AZp" Content-Disposition: inline In-Reply-To: <20260310203307.732079b9@elisabeth> Message-ID-Hash: KOZFBESMJ3QPRNZ75VRVGZ7TN3Z3R3HX X-Message-ID-Hash: KOZFBESMJ3QPRNZ75VRVGZ7TN3Z3R3HX 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: --rY8wFXYFmN1V1AZp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 10, 2026 at 08:33:11PM +0100, Stefano Brivio wrote: > On Tue, 10 Mar 2026 15:16:00 +1100 > David Gibson wrote: >=20 > > The 'mode' field of struct fwd_ports records the overall forwarding mod= e. > > Now that runtime forwarding decisions are made based on the forwarding > > table, this is almost unused outside conf(). > >=20 > > 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. > >=20 > > Once that's done, make the mode purely local to conf(). While we're th= ere > > rename the constants to FWD_MODE_* to avoid confusion with the forwardi= ng > > rule flag bits, which are also prefixed with FWD_. > >=20 > > Signed-off-by: David Gibson > > --- > > conf.c | 82 ++++++++++++++++++++++++++++++++++++---------------------- > > fwd.c | 27 ++++++++++++++----- > > fwd.h | 10 ------- > > 3 files changed, 72 insertions(+), 47 deletions(-) > >=20 > > 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, > > } > > } > > =20 > > +/** > > + * enum fwd_mode - Overall forwarding mode for a direction and protocol > > + */ >=20 > 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. >=20 > 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: >=20 > * @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 >=20 > ? Done. --=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 --rY8wFXYFmN1V1AZp Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmmwxpUACgkQzQJF27ox 2GcZDA/+L5Izy0BzLJBTdEhIf00P+YxQkkFFJ+RrBTOJ/3YFvJ1TN3m8WtOVI1X0 mgpQ0ZLpC1CxlVDVbcOw5HOlhfZObOZGf3a2Z75YQOn2nCYUcd5VcyQMH0UoQ3Yx 9Z5lMUbtD1HhcyGxKoSZJ9dBoteaYtErA1F0QV6oMgkRlbSmFETihWRLeBKukTpv 5rS8/kBKrIyJi4SDU7/Fz7RDwGlVLj04HZhgRBKbh72/wo6jeK5uEf1Q/EBzQtAL vsISeFFIHXyXFdR44USaMzT3nc3BtMcqVD/E6/VRL1u1N9Zfp9fiJ15SUZVySN4/ L5J01hUAI40hNEPpkow/l60jddxAhQhdIGmeO00+rtoEzK1cGuRj/mnweCeCbC0L iDLJJBw2f2isdomAiugUgQDu9s1CdQXauEQaAzHwaDgvfA/JhkXGtvcgNMwPf3RQ LjxEOUJcD3AAg/VkH+Ik7AgT4jo5OG1eUGoaxGP3IPX0OStw/llyZrmHHEjnMknq d+ePcmKrBRCh57fObNKue4PvBW4kBwhQVJVnwvUD/G13vWdO+PFpbBXf8J7vXasE jBzf0Em8obkNeE0FDgLO4lBWYLnercGFUQIvmmXzGU/hgFsmWltJle3siH/MD8aL 1OYiMQMsDiG/Ywo/rtQr+m5Ja1OjgsS28Qwr1yzynR6wX/NYx28= =BCEZ -----END PGP SIGNATURE----- --rY8wFXYFmN1V1AZp--