Repository navigation
[multicast_dns] Send IPv4 queries on each interface - #49
Open
NemesisDevX wants to merge 4 commits into
Open
NemesisDevX wants to merge 4 commits into
NemesisDevX wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the MDnsClient to send IPv4 mDNS queries over each configured network interface by creating and managing a list of interface-specific sockets (_ipv4InterfaceSockets). It also adds corresponding unit tests to verify this behavior. Feedback on the changes suggests wrapping the socket transmission loop in a try-catch block to ensure that a failure or SocketException on one network interface does not prevent queries from being sent on the remaining interfaces.
If creating an interface socket throws partway through start(), the sockets already created were leaked and _starting stayed true, leaving the client permanently unable to start. Close all sockets, reset the starting flag, and rethrow so the client can be retried. Also fix the send-failure test so the SocketException is actually armed: host is the InterfaceAddress wrapper, so compare by address string rather than object identity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes flutter/flutter#196244
On IPv4, queries were sent through the wildcard listener socket, leaving multicast egress to the system routing table. When cellular is the default route, this can send mDNS queries away from the Wi-Fi LAN.
This change opens one IPv4 sending socket for each discovered IPv4 interface, sets IP_MULTICAST_IF to that interface's address, sends queries through those sockets, and closes them with the client. The wildcard socket remains responsible for receiving and joining the multicast group; the prior wildcard send path remains the fallback when no interfaces are discovered. Regression coverage verifies the per-interface socket option, one query per interface, socket cleanup, and continuing sends after an interface send failure.
Verification:
Pre-Review Checklist
AI disclosure: implementation and test work were assisted by ChatGPT; I reviewed the complete patch and reported verification status as of the current head.