Skip to content

net: dns-sd: support service instance query #88954

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
toonst opened this issue Apr 23, 2025 · 1 comment
Open

net: dns-sd: support service instance query #88954

toonst opened this issue Apr 23, 2025 · 1 comment
Assignees
Labels
area: Networking Enhancement Changes/Updates/Additions to existing features

Comments

@toonst
Copy link
Contributor

toonst commented Apr 23, 2025

There are three DNS‑SD query types in mDNS:

1) Service Instance Query

The query includes an instance name along with the service type, protocol, and domain (e.g. zephyr._http._tcp.local.). This query asks for all records associated with that specific service instance, including SRV, TXT, and address records (A/AAAA).

On Mac:
dns-sd -i <your_nic> -L zephyr _http._tcp local
In Linux (not sure if this works):
avahi-browse -i <your_nic> -rt zephyr._http._tcp -d local

Note: I'm using a _http service as example here, the mdns_responder sample registers a _zephyr service.

2) Service Enumeration Query

In this case, the query omits the instance name and only includes the service type, protocol, and domain (e.g. _http._tcp.local.). This lets the client discover all devices on the network that have this service type. The response is typically a set of PTR records listing the individual service instance names.

On Mac:
dns-sd -i <your_nic> -B _http._tcp local
On Linux:
avahi-browse -i <your_nic> -rt _http._tcp -d local

3) Service Type Enumeration Query

This is a special meta-query using the reserved service name _services._dns-sd._udp.local.. When a client sends a query for this name, it receives a list of all service types currently advertised on the local network. (More info RFC 6763: DNS-Based Service Discovery)

On Mac:
dns-sd -i <your_nic> -B _services._dns-sd._udp local
On Linux:
avahi-browse -i <your_nic> -rt _services._dns-sd._udp -d local
or
avahi-browse -i <your_nic> -a -d local

Describe the bug

When an app sends a service type enumeration query or service enumeration query, zephyr responds correctly:

[00:29:26.639,345] <dbg> net_mdns_responder: dns_read: (net_socket_service): Received 1 query from 169.254.76.202:5353
[00:29:26.639,399] <dbg> net_mdns_responder: dns_read: (net_socket_service): [1] query PTR/IN label ._zephyr._tcp.local (19 bytes)
[00:29:26.639,587] <dbg> net_mdns_responder: send_sd_response: (net_socket_service): matched query: zephyr._zephyr._tcp.local port: 50515

However, we send a regular service instance query, zephyr does not respond:

[00:32:08.827,275] <dbg> net_mdns_responder: dns_read: (net_socket_service): Received 1 query from 169.254.76.202:5353
[00:32:08.827,329] <dbg> net_mdns_responder: dns_read: (net_socket_service): [1] query SRV/IN label .zephyr._zephyr._tcp.local (26 bytes)

As you can also see, the mdns_responder correctly receives these service enumeration queries, but does not reply to them. This is a missing feature/bug in the Zephyr implementation.

To Reproduce

west build samples/net/mdns_responder -- -DCONFIG_MDNS_RESPONDER_LOG_LEVEL_DBG=y

Environment (please complete the following information):

@toonst toonst added the bug The issue is a bug, or the PR is fixing a bug label Apr 23, 2025
@jukkar jukkar added Enhancement Changes/Updates/Additions to existing features and removed bug The issue is a bug, or the PR is fixing a bug labels Apr 23, 2025
@jukkar
Copy link
Member

jukkar commented Apr 23, 2025

This looks more like an enhancement than a bug so changing labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

4 participants