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=pMIwZZiQ; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id D7E415A0271 for ; Tue, 06 Jan 2026 07:10:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202512; t=1767679848; bh=Eh+MvL1g6rLCV+5JrUpf0gZjhRq31krPE1i2CHlzHYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pMIwZZiQg7635kace0/2G2seGnWxJcWFAz6T44jHYtAH4oHAnT8NYBEIQxjc7qxWX ZTZFhHhmOAFhm+EhSmU8ZCXyxnJWyIcJABgVC5V6symDppCv5rHZnWSOFlkZ8lMGGb H+jOlHHUdpgOllZIK9h0BNVSswzVB8EhWMDu0khzejCKZZL1QecfnxPVjWrZwI93bc gc/yYF1CYIwRoRHKWGf6h8RJvaQCtnd4HSZF57HGRx61+WGt9W9JtGvg49qHwQpBEc vSMWbH+ttKHRUQ0UGE5cLyhS5B0hykBs8O5sWCQUN/isuRKsgnP7iQ6JH4cLXaa7e1 dSpCWgqOlQfIA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4dlglD1bdfz4wGT; Tue, 06 Jan 2026 17:10:48 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 1/2] fwd: Remove now-unnecessary handling of unspecified oaddr from splice Date: Tue, 6 Jan 2026 17:10:45 +1100 Message-ID: <20260106061046.3623968-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260106061046.3623968-1-david@gibson.dropbear.id.au> References: <20260106061046.3623968-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: LX4OPCB7BXJUE6NVLQVUDRELYYD3LAD2 X-Message-ID-Hash: LX4OPCB7BXJUE6NVLQVUDRELYYD3LAD2 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: fwd_nat_from_splice() has several cases that deal with the possibility of ini->oaddr being unspecified. That used to be a possible case, but since e3c4c4175ce6 ("tcp: Always populate oaddr field for socket initiated flows") and 59cc89f4cc01 ("udp, udp_flow: Track our specific address on socket interfaces") we now always populate ini->oaddr with a specified address for all flows. Remove the now-unnecessary fallback logic. Signed-off-by: David Gibson --- fwd.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/fwd.c b/fwd.c index 44a0e109..9b701ad0 100644 --- a/fwd.c +++ b/fwd.c @@ -650,7 +650,7 @@ uint8_t fwd_nat_from_splice(const struct ctx *c, uint8_t proto, const struct flowside *ini, struct flowside *tgt) { if (!inany_is_loopback(&ini->eaddr) || - (!inany_is_loopback(&ini->oaddr) && !inany_is_unspecified(&ini->oaddr))) { + !inany_is_loopback(&ini->oaddr)) { char estr[INANY_ADDRSTRLEN], fstr[INANY_ADDRSTRLEN]; debug("Non loopback address on %s: [%s]:%hu -> [%s]:%hu", @@ -660,12 +660,7 @@ uint8_t fwd_nat_from_splice(const struct ctx *c, uint8_t proto, return PIF_NONE; } - if (!inany_is_unspecified(&ini->oaddr)) - tgt->eaddr = ini->oaddr; - else if (inany_v4(&ini->oaddr)) - tgt->eaddr = inany_loopback4; - else - tgt->eaddr = inany_loopback6; + tgt->eaddr = ini->oaddr; /* Preserve the specific loopback address used, but let the kernel pick * a source port on the target side -- 2.52.0