From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id B25C75A0274 for ; Wed, 28 Feb 2024 06:39:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1709098773; bh=GaFw0KCC88LkY0hVLXwN/FApFLBLCOy+xOruW90aexA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gIEtIj8+CkvvAvMtjk4phqGXo5i7ZeOuN10KsH+HkFeNYMXGw32sl2BNAF1cJeFUq mWXF2KbGe9uKBWX2UnQ1FRVSVJnb9K4LdQ2O2WGzH6bhxfnr/xt2cdF820MuxYcCAF EHiaQq8WSgRwTaW+jeHZP/i0D1/ViSHFGmKhImkzpgsMgaevBZqg6YVHCvnqUgns0/ LdBnjl/r6yIOK7BYVTFiQJPQxxJzBjRDN3P4YPBD75lRm72776SEGxUg/yys5vrjVn G3wJe8ru6XcbAyyVoOtRDKbLlbbNBSB7aROREScysX8ppI73pnMYea/C3K1DhAFVic mqBmcrZ4hEXew== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Tl38533bqz4wc6; Wed, 28 Feb 2024 16:39:33 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top, Laurent Vivier Subject: [PATCH v2 1/5] udp: Don't attempt to translate a 0.0.0.0 source address Date: Wed, 28 Feb 2024 16:39:25 +1100 Message-ID: <20240228053929.1570254-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240228053929.1570254-1-david@gibson.dropbear.id.au> References: <20240228053929.1570254-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: HN5ZN4RNIYFH6JKNN7TGWK4S7XX7VPCM X-Message-ID-Hash: HN5ZN4RNIYFH6JKNN7TGWK4S7XX7VPCM 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: If an incoming packet has a source address of 0.0.0.0 we translate that to the gateway address. This doesn't really make sense, because we have no way to do a reverse translation for reply packets. Certain UDP protocols do use an unspecified source address in some circumstances (e.g. DHCP). These generally either require no reply, a multicast reply, or provide a suitable reply address by other means. In none of those cases does translating it in passt/pasta make sense. The best we can really do here is just leave it as is. Signed-off-by: David Gibson --- udp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/udp.c b/udp.c index b19e76db..3d44f81e 100644 --- a/udp.c +++ b/udp.c @@ -599,7 +599,6 @@ static size_t udp_update_hdr4(const struct ctx *c, int n, in_port_t dstport, src_port == 53) { b->iph.saddr = c->ip4.dns_match.s_addr; } else if (IN4_IS_ADDR_LOOPBACK(&b->s_in.sin_addr) || - IN4_IS_ADDR_UNSPECIFIED(&b->s_in.sin_addr)|| IN4_ARE_ADDR_EQUAL(&b->s_in.sin_addr, &c->ip4.addr_seen)) { b->iph.saddr = c->ip4.gw.s_addr; udp_tap_map[V4][src_port].ts = now->tv_sec; -- 2.43.2