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=a3Gkg0E8; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 4F7935A026E for ; Wed, 08 Apr 2026 03:37:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1775612230; bh=fekNwS6zRldW6FwDDnfPFymshTfQ6CiVqgW6AXpb8FI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=a3Gkg0E8PSzMEAHC9qeyk/cf4dX76JPfXYTn47zRbL5fxK/4bC6U+PKTqcqn93sJm 3jObCrNNEhaIFsmPifsC1PBQ4NF9nE5zmbc1V2jgrDicupxE2XSC7erIfqJUHxYoKN uHVyGxHdoRjpXPD37Co/R5C1mBisgf7bpj2r9tZPh87HG11D4kKzv6qXfZ4lFaNR3Y QXBunix1EzKgnTbwy9y/Ns4l54xXGsP179QS+ON5k4LNx8LFcGTuHVD0QQFXthF78w FW4jkbI4NNNdq1tUPRwmSGJuaTEUtTbikIlwDW6QkgmEFBQ0PYYIJ389d4jns59HCA UyOVj+EW0Tv6g== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4fr5K204zbz4wck; Wed, 08 Apr 2026 11:37:10 +1000 (AEST) Date: Wed, 8 Apr 2026 11:30:29 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 06/18] fwd: Better split forwarding rule specification from associated sockets Message-ID: References: <20260407031630.2457081-1-david@gibson.dropbear.id.au> <20260407031630.2457081-7-david@gibson.dropbear.id.au> <20260408011445.275ff479@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="gCFzIXAG8fqqQ7cs" Content-Disposition: inline In-Reply-To: <20260408011445.275ff479@elisabeth> Message-ID-Hash: 5P2EZCNMMEENOHQ4OW5WGU4WZA3UJMQI X-Message-ID-Hash: 5P2EZCNMMEENOHQ4OW5WGU4WZA3UJMQI 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: --gCFzIXAG8fqqQ7cs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 08, 2026 at 01:14:46AM +0200, Stefano Brivio wrote: > On Tue, 7 Apr 2026 13:16:18 +1000 > David Gibson wrote: >=20 > > 6dad076df037 ("fwd: Split forwarding rule specification from its > > implementation state") created struct fwd_rule_state with a forwarding = rule > > plus the table of sockets used for its implementation. It turns out th= is > > is quite awkward for sharing rule parsing code between passt and the > > upcoming configuration client. >=20 > Indeed, I hated it, in that short moment I had to fiddle with it. Thanks > for coming up with a cleaner solution. Yeah, mea culpa. Seemed like a good idea at the time, but it wasn't. [snip] > > /** > > - * struct fwd_table - Table of forwarding rules (per initiating pif) > > + * struct fwd_table - Forwarding state (per initiating pif) > > * @count: Number of forwarding rules > > * @rules: Array of forwarding rules > > + * @rulesocks: Pointers to socket arrays per-rule >=20 > I don't see this as particularly descriptive (which sockets? What's > the array size?). I'm thinking of something like: >=20 > @socks_ref: Per-rule pointers to associated @socks, @sock_count of them There are @count of them, not @sock_count... which I guess just emphasises the need for a better description. How's this: * struct fwd_table - Forwarding state (per initiating pif) * @count: Number of forwarding rules * @rules: Array of forwarding rules * @rulesocks: Array of @count pointers within @socks giving the start of t= he * corresponding rule's listening sockets within the larger array * @sock_count: Number of entries used in @socks (for all rules combined) * @socks: Listening sockets for forwarding > > * @sock_count: Number of entries used in @socks > > * @socks: Listening sockets for forwarding > > */ > > struct fwd_table { > > unsigned count; > > - struct fwd_rule_state rules[MAX_FWD_RULES]; > > + struct fwd_rule rules[MAX_FWD_RULES]; > > + int *rulesocks[MAX_FWD_RULES]; > > unsigned sock_count; > > int socks[MAX_LISTEN_SOCKS]; > > }; >=20 > --=20 > Stefano >=20 --=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 --gCFzIXAG8fqqQ7cs Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmnVr7QACgkQzQJF27ox 2GeiIRAAq2ByQaclJ1sMvbqkGjkFBqVHynIlQ4WoGaqMdkcma9qBC9LCYnNOVpvK jTtvohTeyu3GktGe9bQIZz6QfD0ikNN1XmWVX91YNlyIsrHdMhlmWx37Py6OZsff jUkRX14NsrlMPYhoWL2otXSKERVOgL+HL3E8yVkk0OufplpxQFW7oNCfSKopVHaL APvSshBk/3LMCVxdgUXXi5A+uOsRQsxk+PuRD93egUQrGSeVkAvqbnqNnbiZxTvF qQwUYFfOrWF63YeaaC8Lo0xBaJfZlwYkdwmYP1pBBzK6AJG+vpZ423OFjujvdWCn Vg+c6Myfrx6AFlpJMyNynVm4Ez3yP/OnCCxT5F7L9+ZHFV3K8ircUnn/crEowy5D vXeMBsyQekA3QUBJ47iD3+6v2ih+35fhBO0jPBV0Bw16GOvly8gXxdsZG4F61ehJ Cs8/Yzumzt70b+EFQ6GA+NJunA9w6E0RnCO9+8EASzXrpjCHu8JZDkEj5iy1qHNL UdQe/b2O/riZmGnVJJAZ/m7U6qO398xFjjfOYvk4vaZuFzxWnJYCVsj2kaftK1lK 1pw+SSshshGY2yPnhQ/gbuy3TdQwTrBH4QQAodWf84MYqZOYgbY1meoBExjaBDmZ 9hA63zX9222S3WMKLW1g0019DfaTnxbqtPu9Vc2xy+VNhUipqIE= =84gM -----END PGP SIGNATURE----- --gCFzIXAG8fqqQ7cs--