From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id 85B315A0272; Mon, 23 Nov 2026 01:27:28 +0100 (CET) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH] fwd: Drop implicit fallbacks to host loopback resolver Date: Mon, 23 Nov 2026 01:27:28 +0100 Message-ID: <20261123002728.4072813-1-sbrivio@redhat.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: C4RX4MY6ZPAPBRXKLY3VVLYLUCG2RMAE X-Message-ID-Hash: C4RX4MY6ZPAPBRXKLY3VVLYLUCG2RMAE X-MailFrom: sbrivio@passt.top 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: Daniel Worthington-Bodart , 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 a DNS forward option is (maybe mistakenly) passed for an IP version that doesn't have a matching host-side resolver configured, we currently fall back to translating the destination of DNS queries to 0.0.0.0 / ::. This was intended as fallback, at least for IPv6. The IPv6 version was there almost from the beginning (and then refactored several times) as a convenient workaround for Podman containers where the container's resolv.conf did *not* include an IPv6 resolver, even though they were running on a system where systemd-resolved would offer DNS resolution over IPv6 on the host. However, checking against a recent version of Podman, this doesn't seem to be the case anymore, and moby / rootlesskit never had this issue anyway, so it can go away at this point. I'm not sure if the IPv4 version was ever needed. It might have hidden some setup issues at some point, but I can't reproduce anything like that with Podman right now. In any case, this might be confusing for users, as Dan reported, and doesn't seem to serve any practical purpose anymore, Drop the fallbacks: if no host-side resolver is configured for a given IP version, don't apply any special NAT, even if we see a DNS query with a destination address matching a --dns-forward option for that IP version. Reported-by: Daniel Worthington-Bodart Suggested-by: David Gibson Signed-off-by: Stefano Brivio --- fwd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fwd.c b/fwd.c index 48764c5..add01c0 100644 --- a/fwd.c +++ b/fwd.c @@ -976,10 +976,12 @@ uint8_t fwd_nat_from_tap(const struct ctx *c, uint8_t proto, const struct flowside *ini, struct flowside *tgt) { if (is_dns_flow(proto, ini) && - inany_equals4(&ini->oaddr, &c->ip4.dns_match)) + inany_equals4(&ini->oaddr, &c->ip4.dns_match) && + !IN4_IS_ADDR_UNSPECIFIED(&c->ip4.dns_host)) tgt->eaddr = inany_from_v4(c->ip4.dns_host); else if (is_dns_flow(proto, ini) && - inany_equals6(&ini->oaddr, &c->ip6.dns_match)) + inany_equals6(&ini->oaddr, &c->ip6.dns_match) && + !IN6_IS_ADDR_UNSPECIFIED(&c->ip6.dns_host)) tgt->eaddr.a6 = c->ip6.dns_host; else nat_outbound(c, &ini->oaddr, &tgt->eaddr); -- 2.43.0