-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send multicast packets on all multicast-capable interfaces #18
base: master
Are you sure you want to change the base?
Conversation
It would be great to have this feature in anytime soon |
I've just tried this but it isn't quite enough as Server::sendMessage() can be called to send to a multicast address (e.g. in HostnamePrivate::onMessageReceived()). My hack was to call sendMessageToAll() if message.address().isMulticast()... this was introduced in Qt 5.6 but is generic and less error-prone than checking for the MdnsIpv?Address matches. It is possible that the real bug is with Hostname calling sendMessage() rather than sendMessageToAll. The other related change I made was to replicate the protocol check that sendMessage() does, so that the ipv4Socket is only used to send to IpV4 addresses. If I was braver / it was my baby, I would consider having just the sendMessage() function and have it cope with multicast addresses on multi-homed systems and noting the protocol version. NB: I had this issue due to using Hyper-V on Windows, which creates a virtual network interface that becomes an unintended sink for multicast messages that are not properly directed. I can tidy and share my code if @nitroshare says this is wanted and would merge it (this pull request was raised over a year ago, which indicates there is no interest in this issue). |
Hey I'd just like to say that this does interest me and this PR fixed my issues. It was also attributable to Hyper-V on Windows causing default routing of multicast packets getting lost on other interfaces. |
Another common configuration where this fix helps: Standard home router, laptop connected by ethernet. And a device with mDNS service which have mDNS service inside it, working as Wi-Fi client or Wi-Fi Access point. When the device is Wi-Fi client, qmdnsengine works. When the device in AP mode, qmdgsengine can't see it because sending mDNS packets only to ethernet. |
I found another instance where this is occurring, the library isn't tracking which interface a service query came in on, and is sending to a interface, which is not the correct one. I just updated the call to be sendMessageToAll, which isn't very conservative, but works. |
On multi-homed hosts, the interface that will be used for outgoing multicast traffic is implementation-defined. As a result, the mDNS queries don't always go out on the interfaces where the discoverable hosts are.
We want to ensure that
Server::sendMessageToAll()
sends queries to all multicast-capable interfaces, so we should useQUdpSocket::setMulticastInterface()
to do that.