Skip to content

Conversation

@ActoryOu
Copy link
Member

@ActoryOu ActoryOu commented Feb 4, 2025

Set MDNS AA bit while answering MDNS request.

Description

From forum question FreeRTOS+TCP mDNS behaviour on receiving request, the AA bit of MDNS reply is not set correctly.

Here is the description in RFC6762 18.4.

In response messages for Multicast domains, the Authoritative Answer
bit MUST be set to one (not setting this bit would imply there’s some
other place where “better” information may be found) and MUST be
ignored on reception.

So in this PR, we add the AA bit for MDNS query. And keep the behavior unchanged for LLMNR query.

Test Steps

  1. Add unit test to parse MDNS request.
  2. Check the flag in the DNS header to see if it's 0x8400. (with QR bit and AA bit set)

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

https://forums.freertos.org/t/freertos-tcp-mdns-behaviour-on-receiving-request/22455

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ActoryOu ActoryOu requested a review from a team as a code owner February 4, 2025 07:48
@htibosch
Copy link
Contributor

Hello @ActoryOu, thanks for you PR.

When you have time can you merge
FreeRTOS:main into ActoryOu:MdnsAABit?

It is a bit confusing now to understand what has changed.
I will test the PR and review it.
Thanks

PS. I'm still curious why I decided to include the questions when answering.

@htibosch
Copy link
Contributor

I encounter the same problem when I lookup a device using mDNS from Linux, even though the authoritative flag is set.
Now I will try leaving out the questions asked. Which is not so easy.

@htibosch
Copy link
Contributor

It appears that the implementation of mDNS in FreeRTOS_DNS_Parser.c needs two changes:

  • Set the authoritative flag in the reply
  • Do not include Questions when replying

I tested the new version with Linux and Windows as clients, and that both worked.

I committed the changes in PR #1292.

I think that this PR can now be closed. Thank you @ActoryOu

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.

4 participants