mDNS responder doesn't set the id for a directed unicast query

# dig -p 5353 @224.0.0.251 _bond._tcp.local. PTR
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0
;; Warning: ID mismatch: expected ID 37664, got 0

Expected

# dig -p 5353 @224.0.0.251 _homekit._tcp.local. PTR

; <<>> DiG 9.16.1-Ubuntu <<>> -p 5353 @224.0.0.251 _homekit._tcp.local. PTR
; (1 server found)
;; global options: +cmd
;; Got answer:
;; WARNING: .local is reserved for Multicast DNS
;; You are currently testing what happens when an mDNS query is leaked to DNS
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50910
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 6

;; QUESTION SECTION:
;_homekit._tcp.local.		IN	PTR

;; ANSWER SECTION:
_homekit._tcp.local.	10	IN	PTR	C04031B0-814D-5917-87C5-96BA5F775FC6._homekit._tcp.local.

;; ADDITIONAL SECTION:
C04031B0-814D-5917-87C5-96BA5F775FC6._homekit._tcp.local. 10 IN	SRV 0 0 60332 Media-12.local.
C04031B0-814D-5917-87C5-96BA5F775FC6._homekit._tcp.local. 10 IN	TXT "si=4D3E0534-11F6-43F1-AA3A-34B78BD3D7D2"
Media-12.local.		10	IN	AAAA	fe80::1483:35e1:aa81:63
Media-12.local.		10	IN	A	192.168.107.116
Media-12.local.		10	IN	AAAA	fd36:63b2:742f:1::1
Media-12.local.		10	IN	AAAA	fd29:74d0:18d:1:452:1f10:2098:34b1

;; Query time: 1 msec
;; SERVER: 192.168.107.116#5353(224.0.0.251)
;; WHEN: Sun Jun 13 15:43:25 HST 2021
;; MSG SIZE  rcvd: 269

root@ha-dev:~# 
>>> import zeroconf
>>> zeroconf.DNSIncoming(b"\0\0\204\0\0\0\0\3\0\0\0\1\5_bond\4_tcp\5local\0\0\f\0\1\0\0\21\224\0\f\tZZDI31544\300\f\300(\0!\0\1\0\0\0x\0\22\0\0\0\0\0P\tZZDI31544\300\27\300(\0\20\0\1\0\0\21\224\0\1\0\300F\0\1\0\1\0\0\0x\0\4\300\250k\241")
<DNSIncoming:{id=0, flags=33792, n_q=0, n_ans=3, n_auth=0, n_add=1, questions=[], answers=[record[ptr,in,_bond._tcp.local.]=4500/4499,ZZDI31544._bond._tcp.local., record[srv,in,ZZDI31544._bond._tcp.local.]=120/119,ZZDI31544.local.:80, record[txt,in,ZZDI31544._bond._tcp.local.]=4500/4499,b'\x00', record[a,in,ZZDI31544.local.]=120/119,192.168.107.161]}>
>>> zeroconf.DNSIncoming(b"\0\0\204\0\0\0\0\3\0\0\0\1\5_bond\4_tcp\5local\0\0\f\0\1\0\0\21\224\0\f\tZZDI31544\300\f\300(\0!\0\1\0\0\0x\0\22\0\0\0\0\0P\tZZDI31544\300\27\300(\0\20\0\1\0\0\21\224\0\1\0\300F\0\1\0\1\0\0\0x\0\4\300\250k\241").id
0

It does respond, but just without the id set. The id should only be 0 for _services._dns-sd._udp rfc6763

@merck This looks like a bug in the mDNS stack in the firmware.

@bdraco thanks for the report. I see a serial number starting in ZZDI. That uses an Espressif ESP32 with ESP-IDF v3.3.4 (as of our latest fw release), so we would need to send this bug report upstream. Luckily, it’s an open-source stack, so if there is a known patch there’s a chance we can bring it in without waiting on our vendor.

Can you please let us know what problem(s) this non-compliance causes for your application? This will help in prioritizing it.

1 Like

I’m having to do multicast queries when I only want a unicast response which is increasing network traffic. Thanks!

1 Like