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=202512 header.b=NB68Q1kN; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id A88375A0624 for ; Thu, 08 Jan 2026 03:29:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202512; t=1767839390; bh=BAEdgXUjGhv8bG7WhplWo3un3QxH9K081pfgubkZLHs=; h=From:To:Cc:Subject:Date:From; b=NB68Q1kNaN7Md4LcDcNW4vv135Xf4lXw4abuBfpFfv8lN8obzQpgujseE8B8wbSFP dZg7wqOQKQe365S7ZccV3q+7z8kqtXKpFhX5RBtDjYUgnTSz1vGA2Uo7ydaMrgKjZM JODBKpQszhRZZQPBAlBGxZgpZwpaeapUkgakquMIxxuBAo3EkBGvRmat6e3oMr03CX R31gZzLJHANslGkAWK8/Esar2YW4fPFeC4lQEJ5886nCfrHRBSg+AQIgRdZc/LAcSt 2w6KFxHQSiImdYLk1gQxXI1Tla3CMjvy5wKuCpdqHtziUmmbs9txEP3ZbEDtL08YeX OaoVp7BAB6AmA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4dmplL2ft2z4wR6; Thu, 08 Jan 2026 13:29:50 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v3 00/14] Introduce forwarding table Date: Thu, 8 Jan 2026 13:29:34 +1100 Message-ID: <20260108022948.2657573-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.52.0 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 6TJOUQWZ7P736FUPL4NLLFNYH3CTDU4H X-Message-ID-Hash: 6TJOUQWZ7P736FUPL4NLLFNYH3CTDU4H 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: David Gibson 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: This creates a new data structure for recording our port forwarding: a table of individual forwarding rules. This is intended to replace the existing forwarding mode, map and delta structures. For now, only the delta[] array is removed. map is still used, but only for automatic forwards. Mode is still used, but only has significance during configuration. There's still a lot that can be done for flexible forwarding, but this introduces the core data structure, and does enough to fix at least one concrete defect with the current logic (bug 187). I think it would be a good point to give it a solid review and maybe merge. I'm aware that this is a very large complex series, that will be difficult to review. I think that's more or less inevitable implementing a feature as broad and complex as "flexible forwarding". If it helps at all, I'm fine if it's not reviewed all at once - I won't assume review is complete until either you say so, or I get comments or R-b on each patch. This applies on top of all 3 of my outstanding series in this area: "Allow listen functions to return fds", "Clean ups to epoll references" (v2) and "Small cleanups to splice forwarding logic". David Gibson (14): inany: Extend inany_ntop() to treat NULL as a fully unspecified address conf, fwd: Keep a table of our port forwarding configuration conf: Accurately record ifname and address for outbound forwards conf, fwd: Record "auto" port forwards in forwarding table fwd: Make space to store listening sockets in forward table ip: Add ipproto_name() function fwd, tcp, udp: Set up listening sockets based on forward table tcp, udp: Remove old auto-forwarding socket arrays conf, fwd: Check forwarding table for conflicting rules fwd: Generate auto-forward exclusions from socket fd tables flow, fwd: Consult rules table when forwarding a new flow from socket fwd: Remap ports based directly on forwarding rule fwd, tcp, udp: Add forwarding rule to listening socket epoll references flow, fwd: Optimise forwarding rule lookup using epoll ref when possible conf.c | 118 +++++++++------ flow.c | 59 ++++++-- flow_table.h | 2 +- fwd.c | 379 ++++++++++++++++++++++++++++++++++++++++++++++--- fwd.h | 68 ++++++++- icmp.c | 2 +- inany.c | 28 +++- inany.h | 1 + ip.c | 26 ++++ ip.h | 2 + tcp.c | 154 ++------------------ tcp.h | 6 +- udp.c | 147 +++---------------- udp.h | 7 +- udp_flow.c | 14 +- udp_flow.h | 2 +- udp_internal.h | 4 +- 17 files changed, 641 insertions(+), 378 deletions(-) -- 2.52.0