On Thu, Jun 27, 2024 at 12:49:41AM +0200, Stefano Brivio wrote:On Fri, 14 Jun 2024 16:13:38 +1000 David Gibson <david(a)gibson.dropbear.id.au> wrote:Actually, I think this version is already on top of that, but the commit message is a bit out of date. The steps here are: 1. Add flow_target() which takes an explicit target pif (already merged) 2. Replace flow_target() with variants which also take explicit target addresses (patch #2 in this series) 3. Replace flow_target_*() variants with plain flow_target() which automatically determines the target addresses based on the forwarding logic (this patch)Currently the code to translate host side addresses and ports to guest side addresses and ports, and vice versa, is scattered across the TCP code. This includes both port redirection as controlled by the -t and -T options, and our special case NAT controlled by the --no-map-gw option. Gather this logic into fwd_nat_from_*() functions for each input interface in fwd.c which take protocol and address information for the initiating side and generates the pif and address information for the forwarded side. This performs any NAT or port forwarding needed. We create a flow_target() helper which applies those forwarding functions as needed to automatically move a flow from INI to TGT state.Given that you already added flow_target() in another series, I didn't really review that part of this patch as I guess it will change.The rest of the patches from 8/26 to 17/26 all look good to me: after all, changes from v5 look rather minimal for those. I didn't review patches starting from 18/26, as you mentioned they will change substantially.18/26 itself is probably fine, but the ones after that are being more or less entirely rewritten, yes. -- 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