Skip to content

[mdns] probing not performed for Host (AAAA) records when using mDNSResponder library #2890

@EskoDijk

Description

@EskoDijk

Describe the bug A clear and concise description of what the bug is.

This issue may not need an immediate fix: some discussion about feasibility, and pros/cons is also ok. Still I wanted to make people aware of this.

When the Advertising Proxy registers a new host (with AAAA records) via the mDNSResponder library, probing for the (new) host name is not performed on the AIL. Normally, mDNS does perform probing for the host name, to ensure it's not already in use somewhere on the AIL. And that's required by the mDNS RFC as well.

The issue here is that we use mDNSResponder in a special way: as a proxy to other device's host records. If mDNSResponder is used in a normal way (only advertising records/services for a device itself) then the mDNSResponder library will automatically add and probe host records (A/AAAA) for the present host.

But in our case, that can't be used, so the code (see below) explicitly adds the proxied host records.

(mdns_mdnssd.cpp)

        dnsError = DNSServiceRegisterRecord(GetPublisher().mHostsRef, &recordRef, kDNSServiceFlagsShared,
                                            kDNSServiceInterfaceIndexAny, MakeFullHostName(mName).c_str(),
                                            kDNSServiceType_AAAA, kDNSServiceClass_IN, sizeof(address.m8), address.m8,
                                            /* ttl */ 0, HandleRegisterResult, this);

The key point is the kDNSServiceFlagsShared flag here: this is needed because we want to add multiple AAAA records. And these records must not conflict with one another - multiple are allowed. However, this flag also suppresses probing on the AIL for the host name. This means a conflict on AIL is not detected.
This causes a certification test (2.14) to fail, because that was designed to check conflict detection.

A related problem to this is the timing order of mDNS messages on the AIL:

  • It's observed that the Host (AAAA) records are already sent before the probing starts for adding the service.
  • This could mean that e.g. if the mDNS service registration fails on AIL, the Host (AAAA) records were already registered bluntly without probing, which maybe should not have been done then.

To Reproduce Information to reproduce the behavior, including:

  1. Git commit id - any recent
  2. IEEE 802.15.4 hardware platform - e.g. OTBR reference release
  3. Build steps
  4. Network topology - cert test SRP-2.14

Expected behavior A clear and concise description of what you expected to happen.

In general: OTBR performs probing for an SRP-registered host name; and denies the SRP registration with YXDOMAIN error if the name already exists on the AIL.

But, for Matter devices: for Matter devices, it can be actually beneficial to not probe. They already pick a unique hostname by design. If probing were enabled, we would see more "false positives" due to probing, in case the Matter client was also previously registered at another OTBR and now changed to register to a new OTBR on the same AIL. So in case we fix this, we should also discuss the effect on Matter devices.

Possible solutions:

  • Wait until an updated mDNSResponder appears with more complete support for SRP & Advertising Proxy situations like this one. E.g. request Apple to add functions for this.
  • Try to first register the Host's KEY record on the AIL, which is unique. If that succeeds, then register the AAAA records with the flag kDNSServiceFlagsShared after that. If it fails, don't register the AAAA records at all.

Console/log output If applicable, add console/log output to help explain your problem.
PCAP is available if needed.

Additional context Add any other context about the problem here.
Cert test SRP-2.14.
Details of the mDNSResponder API were discussed with Apple.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions