aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2026-11-22 23:37:05 +0100
committerStefano Brivio <sbrivio@redhat.com>2026-11-30 00:37:09 +0100
commit9206a818976540ba1f6fdb976891a2dbf5734f50 (patch)
treee1f64055b3d605622e270dc5308252c989c4a1e3
parent15980a90f9a60e6ae9a3865bb85d20a3d8379deb (diff)
downloadpasst-9206a818976540ba1f6fdb976891a2dbf5734f50.tar
passt-9206a818976540ba1f6fdb976891a2dbf5734f50.tar.gz
passt-9206a818976540ba1f6fdb976891a2dbf5734f50.tar.bz2
passt-9206a818976540ba1f6fdb976891a2dbf5734f50.tar.lz
passt-9206a818976540ba1f6fdb976891a2dbf5734f50.tar.xz
passt-9206a818976540ba1f6fdb976891a2dbf5734f50.tar.zst
passt-9206a818976540ba1f6fdb976891a2dbf5734f50.zip
fwd: Drop implicit fallbacks to host loopback resolver
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 <dan@bodar.com> Suggested-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--fwd.c6
1 files 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);