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

mDNS resolver doesn't work if IPv4 is disabled #86477

Open
kevinior opened this issue Feb 28, 2025 · 1 comment
Open

mDNS resolver doesn't work if IPv4 is disabled #86477

kevinior opened this issue Feb 28, 2025 · 1 comment
Assignees
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@kevinior
Copy link
Contributor

kevinior commented Feb 28, 2025

Describe the bug

The mDNS resolver always times out if only IPv6 is enabled, even if there has been a valid response to the query.

I have tested this with both our own hardware (STM32H743-based) and the ST Nucleo-H563ZI. The problem is present in both Zephyr 3.7.1 and current main (commit 95c1c85).

I tried enabling more debug output but it seems like the response packet is being ignored at a low level because I couldn't see any indication of it being received.

To Reproduce

Configure the samples/net/dns_resolve sample with IPv4 disabled, here are the diffs in my samples/net/dns_resolve/prj.conf:

diff --git a/samples/net/dns_resolve/prj.conf b/samples/net/dns_resolve/prj.conf
index de837ae0828..4c90263efbf 100644
--- a/samples/net/dns_resolve/prj.conf
+++ b/samples/net/dns_resolve/prj.conf
@@ -11,7 +11,7 @@ CONFIG_NET_LOG=y
 CONFIG_LOG=y
 
 CONFIG_NET_IPV6=y
-CONFIG_NET_IPV4=y
+CONFIG_NET_IPV4=n
 CONFIG_NET_DHCPV4=n
 
 CONFIG_ZVFS_POLL_MAX=5
@@ -33,8 +33,8 @@ CONFIG_DNS_SERVER_IP_ADDRESSES=y
 CONFIG_DNS_NUM_CONCUR_QUERIES=5
 
 # Use local dnsmasq server for testing
-CONFIG_DNS_SERVER1="[2001:db8::2]:15353"
-CONFIG_DNS_SERVER2="192.0.2.2:15353"
+CONFIG_DNS_SERVER1="[fe80::a92:4ff:fe49:be3b]:15353"
+# CONFIG_DNS_SERVER2="192.0.2.2:15353"
 
 # Google DNS IPv4 and IPv6 servers
 #CONFIG_DNS_SERVER1="8.8.8.8"
@@ -50,10 +50,10 @@ CONFIG_NET_SHELL=y
 
 CONFIG_NET_CONFIG_SETTINGS=y
 CONFIG_NET_CONFIG_NEED_IPV6=y
-CONFIG_NET_CONFIG_NEED_IPV4=y
+# CONFIG_NET_CONFIG_NEED_IPV4=y
 CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1"
-CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::2"
-CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
-CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"
+CONFIG_NET_CONFIG_PEER_IPV6_ADDR="fe80::a92:4ff:fe49:be3b"
+# CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
+# CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"
 
 CONFIG_MAIN_STACK_SIZE=1504

Build: west build -p -b nucleo_h563zi dns_resolve/
and flash west flash

Connect the board directly to a Linux PC and run mDNS responders for IPv4 and IPv6 addresses: avahi-publish-address -R ferroamp.local fe80::a92:4ff:fe49:be3b and avahi-publish-address -R 192.0.2.2

Expected behavior

mDNS queries are resolved:

uart:~$ net dns query ferroamp.local
Query for 'ferroamp.local' sent.
dns: 192.0.2.2
dns: All results received
uart:~$ net dns query ferroamp.local AAAA
IPv6 address type
Query for 'ferroamp.local' sent.
dns: fe80::a92:4ff:fe49:be3b
dns: All results received

Actual behavior

mDNS queries time out:

uart:~$ net dns query ferroamp.local
Query for 'ferroamp.local' sent.
dns: Timeout while resolving name.
uart:~$ net dns query ferroamp.local AAAA
IPv6 address type
Query for 'ferroamp.local' sent.
dns: Timeout while resolving name.

Impact

Our system is intended to run in an IPv6-only environment, so this is a significant annoyance.

Logs and console output

Wireshark captures attached: mdns_ok.pcapng, mdns_fail.pcapng

mdns.zip

net iface output:

Interface eth0 (0x20001328) (Ethernet) [1]
===================================
Link addr : 00:80:E1:CD:40:91
MTU       : 1500
Flags     : AUTO_START,IPv4,IPv6
Device    : ethernet@40028000 (0x8024030)
Status    : oper=UP, admin=UP, carrier=ON
Ethernet capabilities supported:
	10 Mbits
	100 Mbits
Ethernet PHY device: <none> (0)
IPv6 unicast addresses (max 3):
	fe80::280:e1ff:fecd:4091 autoconf preferred infinite
	2001:db8::1 manual preferred infinite
IPv6 multicast addresses (max 5):
	ff02::1
	ff02::1:ffcd:4091
	ff02::1:ff00:1
IPv6 prefixes (max 2):
	<none>
IPv6 hop limit           : 64
IPv6 base reachable time : 30000
IPv6 reachable time      : 38761
IPv6 retransmit timer    : 0
IPv4 unicast addresses (max 1):
	192.0.2.1/255.255.255.0 manual preferred infinite
IPv4 multicast addresses (max 2):
	224.0.0.1
IPv4 gateway : 0.0.0.0

Environment (please complete the following information):

  • OS: Ubuntu 24.04
  • Toolchain: zephyr-sdk-0.16.5
  • Commit SHA: 9f82428 (tag v3.7.1)
  • Commit SHA: 95c1c85 (main)
@kevinior kevinior added the bug The issue is a bug, or the PR is fixing a bug label Feb 28, 2025
@jukkar
Copy link
Member

jukkar commented Feb 28, 2025

I could replicate the issue. The device should be able to receive the DNS response if you set CONFIG_MDNS_RESPONDER=y.
It seems that we do not join ff02::fb multicast group if mDNS responder is not set, which means that the mDNS response sent by avahi is ignored. We should probably join the group even if the mDNS responder is not activated, I will investigate this more.

@jukkar jukkar added the priority: low Low impact/importance bug label Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

3 participants