richardschneider / net-mdns

Simple multicast DNS
MIT License
232 stars 81 forks source link

Trailing dot in domain missing? #30

Closed michaelosthege closed 6 years ago

michaelosthege commented 6 years ago

Hello @richardschneider ,

Together with @gaviriar (and others) we intend to use Makaretu.Mdns as a dependency for a protocol that relies on mDNS. After reading RFC6762 our understanding is that for mDNS every service should announce itself with a local domain, however we are not certain if this should be .local or the fully-qualified .local..

In ServiceProfile.cs#L137 it looks like the FullyQualifiedName does not include a trailing ., which makes it (by definition, as I understand it) not fully-qualified, but just relative.

Would you mind having a look at this, to determine if this is a bug?

kind regards, Michael

richardschneider commented 6 years ago

The trailing . is not required.

In a DNS message, a domain name is never encoded as a "string" but as a sequence of length-prefixed labels with a ending length-prefix of zero. For example, both a.b and a.b. are encoded as "01 61 01 62 00".

Also, a domain name can be compressed, if the leading label(s) have already been encoded; see Section 4.1.4 of RFC1035.

See WireWriter.WriteDomainName for the details.

richardschneider commented 6 years ago

@michaelosthege I'm happy to add features you need for your project. Please raise issues.

michaelosthege commented 6 years ago

@richardschneider thank you for this clarification. We will change to net-mdns in the near future.

I raised issue #29 because this is of importance for our context (communication protocol for laboratory devices). We have to deal with corporate networking, where an often-seen configuration is that the firewall prevents opening UDP:5353 on some network interfaces for security reasons.. As I described in my updated issue description, this causes some trouble with the way how the UdpClient is created. I will probably fork net-mdns and see if I can add optional network interface params.

richardschneider commented 6 years ago

@michaelosthege thanks for the update.

As you may guess, I'm a solo developer and don't deal with "corporate firewalls." However, I would expect a firewall to simply not forward the datagram on a restricted interface/port; which should not cause an issue with creating a UdpClient.

Can you open a new issue that shows the actual exception (and stack trace) you are getting?

As always, I'm happy to get a PR.