From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 64BFB5A027E for ; Thu, 22 Feb 2024 00:21:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1708557678; bh=dLUgDvBT/AAo1F8na7HxbbMO2s1X7XuqpwHOIqGe3M8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QmscKj8+ViHlj3uBMSo1lqL8I7woJgqrMSpBQa3Td7sRS788RefP8ktmhNK/LtgpC p6ouo9DtLRJ5fP2Eqov5OencFiwY3Co9zTj7LJbrHKM5t7PTUdbWpOZvRMlE3Ou5JT aKNT6b+rxSax+lB7s1RnbB9DI+hrgY/to8x2jaHZKbtscmvHATTnirYBE+gsXVjm9I HO3DLcSTkFlSN5Pt37I7waPR7UuTnmacAwZCt6u8TuCWqh8McjUWElIK58SOPv5MHc fb9G1BgE3GKN2YNPoDUbPMYOigqcMJIP0ilfGKxv8DKeDw6a4vyq+eOya/qoCYWJZa sOX2lQ6hwr0/g== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4TgC2Q1qz1z4wxX; Thu, 22 Feb 2024 10:21:18 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 1/7] udp: Don't attempt to translate a 0.0.0.0 source address Date: Thu, 22 Feb 2024 10:21:09 +1100 Message-ID: <20240221232115.1376333-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240221232115.1376333-1-david@gibson.dropbear.id.au> References: <20240221232115.1376333-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: HVMI3VUQCMSMSCSLLGVXILXUQVHHLNZX X-Message-ID-Hash: HVMI3VUQCMSMSCSLLGVXILXUQVHHLNZX 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 a3961bfd..d2f8027c 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