From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id BD7015A004F for ; Thu, 27 Jun 2024 00:50:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719442219; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wngPUNWrWLK4j4+q0XGKkFGRnOG1FQOEOmy9SsdmKdE=; b=VNPC0Y1E6bVukdhpychmNlenNiNkITQ13iGOcVNo29MtXpPKeaiVBN77Ufw9jeMshxvgA3 oh2d6WdREEu6ih38OcCV22eCWKIBFAZRs87ULKzOoV5T006bc1jc3L1N4dOEXKGJF97HFd hpaXRV98/Z0LgoiON9IHduBH5VZQh04= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-587-rp2XH6aJMnOLVlawKFP5mA-1; Wed, 26 Jun 2024 18:50:18 -0400 X-MC-Unique: rp2XH6aJMnOLVlawKFP5mA-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6b4f87eb2e1so110189126d6.1 for ; Wed, 26 Jun 2024 15:50:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719442217; x=1720047017; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=wngPUNWrWLK4j4+q0XGKkFGRnOG1FQOEOmy9SsdmKdE=; b=wQmAJBR2lGxSuASYuC3bq3onoL2JRoSIiKIFmLtpmCat8Y2zHvAqzbNouppIWfd/ye aHHE311d9RDy6zuDY2ijxNx/MKOO6jE4Qx3i2tIk4bPQa6el3jl7U2RoE3qeCtk8EhdW z/4W/6/FPorMlSj6PF4zjrGC4c6aKpyku2xb/OFRpd8ZbHrYvrMjLLnnAAMKdWh7ozT9 sIDyTVGtqpC77b7JIxM8qIL5Z0QcetPEoD1GymUewLp214PnDhCOzaW4sH1CJ4sRWQd1 9t8DuqR9FVofcye4Edp3od+D5yfS4c65J2UU5kEcjKCqe5xiqitiJAev2Z8WrAYMQS3l W8WA== X-Gm-Message-State: AOJu0Yy5LdkVyWMSb1yDiqtX6drUmjf0YdSLq68+ioKSs5YkD45fu6Qb 0UEkRAmWXPVUi9Vt81zjCvotRGTNzpIvWQ0pN1+BUMEkZe/XT2jRtr0sKlfvtmZ0z0xhBV4ZMlw ySW+yMu++VNHcIY+sFI/RmqmqZqQ5rQFEqZ1w/O5GRC7HKgqi+w== X-Received: by 2002:a05:6214:acc:b0:6b5:16b:6998 with SMTP id 6a1803df08f44-6b540aa8c12mr153691646d6.42.1719442217491; Wed, 26 Jun 2024 15:50:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZ7Dv+ReoFxh9NzvtTTM0v2d2PZRP70ECNGGQtyf3+W1J+c0TXV6pLOFdPhsKuTVXjGMqeNQ== X-Received: by 2002:a05:6214:acc:b0:6b5:16b:6998 with SMTP id 6a1803df08f44-6b540aa8c12mr153691436d6.42.1719442217040; Wed, 26 Jun 2024 15:50:17 -0700 (PDT) Received: from maya.cloud.tilaa.com (maya.cloud.tilaa.com. [164.138.29.33]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59252f8bcsm157786d6.68.2024.06.26.15.50.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jun 2024 15:50:16 -0700 (PDT) Date: Thu, 27 Jun 2024 00:49:41 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v6 16/26] flow, tcp: Flow based NAT and port forwarding for TCP Message-ID: <20240627004904.6694f634@elisabeth> In-Reply-To: <20240614061348.3814736-17-david@gibson.dropbear.id.au> References: <20240614061348.3814736-1-david@gibson.dropbear.id.au> <20240614061348.3814736-17-david@gibson.dropbear.id.au> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: QJFW52RKFTLGIK5KGIDJEZYZQYAAO2EE X-Message-ID-Hash: QJFW52RKFTLGIK5KGIDJEZYZQYAAO2EE X-MailFrom: sbrivio@redhat.com 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, jmaloy@redhat.com 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: On Fri, 14 Jun 2024 16:13:38 +1000 David Gibson wrote: > 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. -- Stefano