brutella / dnssd

This library implements Multicast DNS (mDNS) and DNS-Based Service Discovery (DNS-SD) for Zero Configuration Networking in Go.
MIT License
207 stars 33 forks source link

Prevent `dnssd` from answering responses received #48

Open mplzik opened 4 months ago

mplzik commented 4 months ago

dnssd currently answers any DNS packet that has non-empty questions field. This might easily result in double-answering responses from non-compliant responders that are sending responses with the questions section copied from the query packet.

This PR explicitly filters out any packets that have Response bit set from being processed as a part of request handling and also updates the comments to make things more consistent.

Note that there is still an issue with concurrent use of resolver and responder -- if both are in use and a resolver sends a request, it might be received by a resolver, which will silently ignore it. This will need bigger code changes.

Signed-off-by: Milan Plzik milan.plzik@gmail.com

brutella commented 4 months ago

If we don't want to respond to incoming responses, we should check the Response flag at a different level. Ignoring all incoming response messages would break browsing and resolving services.