Skip to content
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

DNS local lookups using mDNS repaired #1118

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

htibosch
Copy link
Contributor

Description

Somewhere along the way, active lookups using mDNS got broken.

When a peer answers an mDNS a lookup, in its answer, it will not repeat the questions that were asked by the client.

Test Steps

I did 3 kinds of lookups, each of them in 4 different ways:
A normal DNS lookup
A mDNS lookup of laptop-hp.local
An LLMNR lookup of laptop-hp

I repeated each lookup by either asking for A or for AAAA records. Also I would either use IPv4 or IPv6 to contact the peer/server, setting xDNS_IP_Preference.

Here are the results of of mDNS/LLMNR tests:

DNS_tests.zip

Without the reparation, mDNS would not succeed.

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

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

@htibosch htibosch requested a review from a team as a code owner March 15, 2024 06:09
@htibosch
Copy link
Contributor Author

/bot run uncrustify

@tony-josi-aws
Copy link
Member

@htibosch

Without the reparation, mDNS would not succeed.

I tested the mDNS without the changes using ping (from a Windows PC):

C:\Users\tonyjosi>ping STM32F4.local

Pinging STM32F4.local [192.168.0.102] with 32 bytes of data:
Reply from 192.168.0.102: bytes=32 time=1ms TTL=64
Reply from 192.168.0.102: bytes=32 time=1ms TTL=64
Reply from 192.168.0.102: bytes=32 time=1ms TTL=64
Reply from 192.168.0.102: bytes=32 time=1ms TTL=64

Ping statistics for 192.168.0.102:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 1ms, Average = 1ms

and also with a DNS v4 query from another +TCP DUT. It seems to be working.

Wondering if the tests you performed were different.

@htibosch
Copy link
Contributor Author

and also with a DNS v4 query from another +TCP DUT. It seems to be working.

Wondering if the tests you performed were different.

My tests were about a LLMNR or mDNS lookup lookup that originates from a DUT running FreeRTOS+TCP.

The biggest problem is this code in FreeRTOS_DNS_Parser.c:

if( xSet.usQuestions == 0U )
{
    /* The IP-stack will only accept DNS replies that have a copy
     * of the questions. */
    xReturn = pdFALSE;
    break;
}

As for mDNS it is normal that the questions are not repeated.

@tony-josi-aws
Copy link
Member

@htibosch

Can you help fix the CI checks?

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.

None yet

3 participants