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

fix: match DNS question with unescaped service name #52

Closed b-kamphorst closed 3 weeks ago

b-kamphorst commented 1 month ago

Closes #50

@brutella the test that I added passes for v1.2.11 and fails for v1.2.12 and v1.2.13. I identified the issue to the question/response logic as expected. Either the question should have an escaped name, or the question handler should match to the unescaped service name. I thought that it should be the latter, but please review.

Note: the test that I added is a copy of the test TestRegisterServiceWithExplicitIP with changed service name. No further thought went into that, so feel free to simplify the test.

b-kamphorst commented 1 month ago

Although the test passes, the example in #50 still fails.

b-kamphorst commented 1 month ago

Observation: if I first register the service with name NoSpaces and then start browsing, then in function lookupType, case req := <-ch:, for _, srv := range cache.Services(), the services have a non-empty list for srv.ifaceIPs. If the service was registered with name With Spaces instead, then the srv.ifaceIPs list is empty.

However, I'm not sure about the fix thus far (should question matching logic be altered, or rather the question itself) and I start to delve too deep for my understanding, so I'll pause here. I look forward to your thoughts!

b-kamphorst commented 1 month ago

@brutella friendly asking when you expect to have time to look into this issue/PR?

brutella commented 3 weeks ago

Sorry for the delay. Trying to look into this in the next couple of days.

brutella commented 3 weeks ago

Fixed in v1.2.14.