Skip to content

fix: return NODATA instead of NXDOMAIN for known names - #729

Open
BTF-Kabir-2020 wants to merge 1 commit into
containers:mainfrom
BTF-Kabir-2020:fix/nxdomain-aaaa-nodata-679
Open

fix: return NODATA instead of NXDOMAIN for known names#729
BTF-Kabir-2020 wants to merge 1 commit into
containers:mainfrom
BTF-Kabir-2020:fix/nxdomain-aaaa-nodata-679

Conversation

@BTF-Kabir-2020

@BTF-Kabir-2020 BTF-Kabir-2020 commented Aug 6, 2026

Copy link
Copy Markdown

fix: treat empty AAAA answers as NODATA for known names

reply_ip already returns after a successful backend lookup, so an
IPv4-only name queried for AAAA gets NOERROR with an empty answer
instead of falling through as a miss. Add a regression test for that.

Fixes #679

@BTF-Kabir-2020
BTF-Kabir-2020 force-pushed the fix/nxdomain-aaaa-nodata-679 branch from 91b576d to 68ce2f9 Compare August 6, 2026 18:23
@mheon

mheon commented Aug 6, 2026

Copy link
Copy Markdown
Member

LGTM, but your new test is failing

@BTF-Kabir-2020

Copy link
Copy Markdown
Author

Thanks — the integration failure was the MX dig on the short name timing out because it was forwarded upstream. Pushed a fix: return NODATA when the name exists locally before forwarding, and assert NXDOMAIN against \does-not-exist.dns.podman.

@BTF-Kabir-2020

Copy link
Copy Markdown
Author

@mheon @Luap99 Thanks again for the earlier LGTM note. The integration flake was the short-name MX path forwarding upstream; HEAD now returns NODATA for known local names before forwarding. Would appreciate another look once CI is green.

@Luap99 Luap99 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That does not seem correct to me, doing the lookup after we know what request type we got seems wrong. We should not be messing with requests we do not understand and just keep forwarding them.

In particular doing this extra lookup for PTR or MX requests is simply wrong.
We already performed the lookup in reply_ip sop IMO this should be contained there in one place and not do a second lookup later

I do not know where you picked up MX, but since we do not handle at all atm we should not just randomly return NOERROR without an answer section. The MX handling has nothing to do with the issue.

Also the commits should be squashed.

And we are not part in the new podman org here but I would still refer to https://github.com/podman-container-tools/community/blob/main/LLM_POLICY.md
These AI PR descriptions add no value, just paste your commit message, how you tested that is irrelevant since we see what test is being added in the diff and only that counts anyway.

Comment thread src/dns/coredns.rs Outdated
Comment on lines +505 to +507
// Name exists in our zone. Even with no answers of this type (e.g. AAAA
// for an IPv4-only container), return NOERROR/NODATA — not a miss that
// would fall through to NXDOMAIN.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment makes no sense in the current version since you did not actually handle this at all in reply_ip

Comment thread src/dns/coredns.rs
// No match found, forwarding below.
}

// TODO: handle MX here like docker does

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be removed, you do not handle that at all

reply_ip already returns after a successful backend lookup, so an
IPv4-only name queried for AAAA gets NOERROR with an empty answer
instead of falling through as a miss. Add a regression test for that.

Fixes containers#679

Signed-off-by: BTF Kabir <PouyaGH2080@gmail.com>
@BTF-Kabir-2020
BTF-Kabir-2020 force-pushed the fix/nxdomain-aaaa-nodata-679 branch from c5baccf to 3ca9058 Compare August 7, 2026 11:22
@BTF-Kabir-2020

Copy link
Copy Markdown
Author

@Luap99 thanks for the review.

Dropped the extra lookup and the MX stuff — that was the wrong approach. Left the NODATA behavior in reply_ip only and trimmed the test to AAAA. Squashed to one commit.

@BTF-Kabir-2020
BTF-Kabir-2020 requested a review from Luap99 August 7, 2026 11:41
@Luap99

Luap99 commented Aug 7, 2026

Copy link
Copy Markdown
Member

Mhh, how can we fix an issue if there are not code changes here? What exactly is the current status vs what is described in the issue? Clearly if we already return NOERROR for A/AAAA requests that means the issues description must be wrong. What requests is host actually sending and what does it expect?

@BTF-Kabir-2020

Copy link
Copy Markdown
Author

@Luap99 fair point, sorry for the confusion.

I went back to the issue and the code. reply_ip already returns Some(req) once the backend lookup succeeds, so an ipv4-only name queried for AAAA already gets NOERROR with an empty answer on main. My PR doesn't change that, it just adds a regression test for it. So the AAAA part of the issue looks like it was already fixed.

The NXDOMAIN from the issue output comes from the MX query I believe. host (bind-tools) sends A, AAAA and MX by default. aardvark doesn't handle MX so those get forwarded upstream, and upstream answers NXDOMAIN for names in our zone. That part still doesn't match the expected behavior.

So I'm not sure what the best path is. Either I make MX (and other unhandled types) return NODATA for names we know, like Docker does, or we close this PR as stale and keep the regression test. I can do either, just let me know which direction you prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NXDOMAIN returned for AAAA queries on IPv4-only container hostnames

3 participants