Fix Darwin multicast loopback by binding to INADDR_ANY#75
Merged
thebentern merged 3 commits intoJun 27, 2026
Merged
Conversation
listenMulticast() bound the UDP socket to the multicast group address (224.0.0.69:port). Linux delivers looped-back multicast to sibling processes bound this way, but Darwin/BSD does not, so two meshtasticd native nodes on the same macOS host never exchanged NodeInfo over UDP. Bind to INADDR_ANY:port on __APPLE__ instead; the uv_udp_set_membership() group join still filters received traffic. Linux keeps binding to the group address so the existing SO_BROADCAST receive-fanout behavior is unchanged. Validated: two native-macos meshtasticd nodes now mesh over 224.0.0.69:4403 (both node DBs cross-populate); Linux meshing (verified in Docker) is unaffected. Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Adjusts UDP multicast listening on macOS/Darwin so multiple native nodes on the same host can receive looped-back multicast by binding to INADDR_ANY instead of the multicast group address.
Changes:
- Add an Apple-specific bind target override to
0.0.0.0:portinAsyncUDP::listenMulticast(). - Document the cross-platform rationale (Linux vs. Darwin/BSD behavior) in code comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
AsyncUDP::listenMulticast()bound the UDP socket to the multicast group address (224.0.0.69:port). Linux loops those datagrams back to sibling processes on the same host, but Darwin/BSD does not — so twomeshtasticdnative nodes on one macOS host never exchanged NodeInfo over UDP multicast.Bind to
INADDR_ANY:porton__APPLE__instead. Theuv_udp_set_membership()group join above still filters received traffic to the group. Linux is unchanged (still binds the group address, preserving the existingSO_BROADCASTreceive-fanout behavior).Test plan
native-macos(meshtastic/firmware) with-DHAS_UDP_MULTICAST=1and confirmed two native nodes now mesh over224.0.0.69:4403— both node DBs cross-populate.meshtasticdDocker image cross-populate and deliver a text message.