Skip to content

Incorrect mDNS handling of no questions in response #1052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MightySCollins opened this issue Apr 14, 2025 · 0 comments
Open

Incorrect mDNS handling of no questions in response #1052

MightySCollins opened this issue Apr 14, 2025 · 0 comments

Comments

@MightySCollins
Copy link

Hi,

Apologies if I am looking in the wrong place for this. In #669 one-shot mDNS support was added which I am currently attempting to get working with Embassy and a STM32H7. I have been analysing the packets sent between my mDNS server and the device to identify my problem and notice.

In RFC6762 Section 6 it states:

Multicast DNS responses MUST NOT contain any questions in the
Question Section. Any questions in the Question Section of a
received Multicast DNS response MUST be silently ignored. Multicast
DNS queriers receiving Multicast DNS responses do not care what
question elicited the response; they care only that the information
in the response is true and accurate.

I have also verified with multiple mDNS resolvers the responses they give never include any questions. In the below code there is a check explicitly for question_count != 1 which causes the process function to stop if it's 0 causing the response to be ignored and the mDNS resolver failing to resolve the dns name.

https://github.com/smoltcp-rs/smoltcp/blob/main/src/socket/dns.rs#L416

if p.question_count() != 1 {
    net_trace!("bad question count {:?}", p.question_count());
    return;
}

My suggestion is in the process() function we check the functions UdpRepr port udp_repr.dst_port to see if it equals MDNS_DNS_PORT and if it does we skip the question check but I do not really have a good enough understanding to know if this would be a good enough solution.

If it would help I can provide a full example but it does seem to be just that check which is failing.

Thanks,
Sam

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

No branches or pull requests

1 participant