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 842485A027F for ; Wed, 17 May 2023 07:05:37 +0200 (CEST) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4QLgzH29Htz4x48; Wed, 17 May 2023 15:05:31 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1684299931; bh=5rs4mUXGErcsDcB8nD3/QbJbe3MEdymKI0bfQULq52Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VBSO+Y1IGUBtBXpfjMeDcSu3TfJsA8m/SMowPSXk+8g1boBPcA8/8w9QEvC0ptnd0 1+PGONNVWx7xIRd9HV5kw6goqpZfgasCFZHlnLkKFC323yOnwhWJeWRm6V6wQbGdFc coMOHUX9eAMC4IzZ5Prx5dX9eYlmmP1yuq4nIrcs= From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 1/5] udp: Don't attempt to translate a 0.0.0.0 source address Date: Wed, 17 May 2023 15:05:25 +1000 Message-Id: <20230517050529.3505590-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230517050529.3505590-1-david@gibson.dropbear.id.au> References: <20230517050529.3505590-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: GXQYLOL4NGCPXYJ3FZMG6VTBWPJJ3C7R X-Message-ID-Hash: GXQYLOL4NGCPXYJ3FZMG6VTBWPJJ3C7R 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 provides 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 39c59d4..78cb221 100644 --- a/udp.c +++ b/udp.c @@ -595,7 +595,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.40.1