Skip to content

meshtastic: set SO_REUSEADDR on UDP socket to fix multicast delivery#8

Merged
aanon4 merged 1 commit intokn6plv:mainfrom
USA-RedDragon:localhost-multicast-fix
Apr 1, 2026
Merged

meshtastic: set SO_REUSEADDR on UDP socket to fix multicast delivery#8
aanon4 merged 1 commit intokn6plv:mainfrom
USA-RedDragon:localhost-multicast-fix

Conversation

@USA-RedDragon
Copy link
Copy Markdown
Contributor

@USA-RedDragon USA-RedDragon commented Mar 31, 2026

Localhost multicast sockets require SO_REUSEADDR so that multiple processes can bind to the same (address, port) pair and both receive multicast traffic. Without it, the kernel does not deliver multicast packets to all bound sockets.

Needed to work on a service that can run on AREDN nodes bridging any USB-connected serial meshtastic device to Raven (or any meshtastic over LAN clients) over localhost. Still testing https://github.com/USA-RedDragon/meshtastic-serial-udp

meshtastic.uc Outdated
s.bind({
port: PORT
});
s.setopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be before the bind?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof, yep, fixed in rebase

Localhost multicast sockets require SO_REUSEADDR so that multiple processes can bind to the same (address, port) pair and both receive multicast traffic. Without it, the kernel does not deliver multicast packets to all bound sockets
@USA-RedDragon USA-RedDragon force-pushed the localhost-multicast-fix branch from 92c0f59 to b2c4ee4 Compare April 1, 2026 07:14
@aanon4 aanon4 merged commit 24aa4bc into kn6plv:main Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants