responding to mDNS queries fail in iOS 14

Hi,

I am using mDNS to discover local peers (iOS, Mac, Linux, Windows, Android) to be able to do file transfers among them. The mDNS part is a Rust lib shared among the platforms. I understand that using mDNS(Bonjour) doesn't require any special entitlement (multicast one). When I run this on iOS, I am able to read mDNS peers publishing the same service but I am not able to respond to queries in the Rust lib, it fails with (no route to host, I am not able to write to the mDNS multicast address). Even though I am publishing the service defined in Info.plist and I am asking for local network permissions.

It's not really possible for me to special case iOS here since the whole networking stack is in Rust. I am at a loss trying to understand what I am doing wrong.

I would much rather not ask for the multicast entitlement as that doesn't seem required anyway.

Please help.

no route to host, I am not able to write to the mDNS multicast address

Presumably some system call is returning EHOSTUNREACH. What system call is that?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

So, it seems that you’ve implemented your own mDNS / DNS-SD responder rather than using the system’s built-in one. I strongly recommend against doing that; it’s a lot of extra work and it’s likely to cause ongoing problems down the line. This is a case in point. You wrote:

I understand that using mDNS (Bonjour) doesn't require any special entitlement (multicast one).

That’s true if you use the system responder. If you implement your own responder then you’ll need to use multicast and that requires the multicast entitlement.

It's not really possible for me to special case iOS here since the whole networking stack is in Rust.

I’m pretty sure that Rust has the ability to call C APIs — indeed, you’re already doing that to call BSD Sockets — so you can fix this by adding a Bonjour platform layer in your Rust code. On platforms that have built-in Bonjour support it can call through to the platform API. On platforms that don’t it can call through to your own implementation.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

If you don't mind pointing me to some documentation/apis/examples

Yeah, the DNS-SD API is a low-level API and so quite… hmmm… challenging to use (-: My go-to sample for this is DNSSDObjects. While its focus is on Objective-C, I figured that any working code is a start and you can evolve things from there.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks Quinn for suggesting DNS-SD API. That was exactly what I needed. For posterity, this is a rust lib which wraps this API https://github.com/windy1/zeroconf-rs works like a charm. All permissions and entitlements work as expected since we are using built in APIs.

responding to mDNS queries fail in iOS 14
 
 
Q