Repository navigation
NODERAWSOCKETS: support UDP multicast group membership - #28147
Merged
Merged
Conversation
guybedford
marked this pull request as ready for review
November 3, 2026 05:10
There was a problem hiding this comment.
Code Review
This pull request implements UDP multicast membership support (IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP, IPV6_JOIN_GROUP, and IPV6_LEAVE_GROUP) in the Node.js socket filesystem library, ensuring memberships are tracked and applied when sockets are bound or reconnected. A critical bug was identified in the IPv6 group address parsing, where 32-bit integers are incorrectly passed to inetNtop6 instead of a 16-byte array, resulting in invalid IPv6 addresses and causing the corresponding test to be silently skipped.
This was referenced Nov 3, 2026
guybedford
force-pushed
the
gbedford/udp-multicast-membership
branch
from
November 3, 2026 05:43
c93a0a9 to
2d900a3
Compare
sbc100
reviewed
Nov 3, 2026
sbc100
reviewed
Nov 3, 2026
sbc100
reviewed
Nov 3, 2026
sbc100
approved these changes
Nov 3, 2026
guybedford
force-pushed
the
gbedford/udp-multicast-membership
branch
from
November 3, 2026 21:51
2d900a3 to
dde8572
Compare
guybedford
force-pushed
the
gbedford/udp-reconnect-port
branch
from
November 3, 2026 21:52
b9ac161 to
32595c3
Compare
guybedford
force-pushed
the
gbedford/udp-multicast-membership
branch
from
November 3, 2026 21:52
dde8572 to
d5ab72e
Compare
Since setsockopt started rejecting unmodelled options, IP_ADD_MEMBERSHIP and friends fail with ENOPROTOOPT, where before they were silently ignored. Model IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP and IPV6_JOIN_GROUP/ IPV6_LEAVE_GROUP on both the dgram and udp_wrap backends. Joins made before bind() are applied once the socket is bound, and are replayed on the socket swapped in by a re-connect.
guybedford
force-pushed
the
gbedford/udp-multicast-membership
branch
from
November 3, 2026 21:58
629bfeb to
163908f
Compare
guybedford
enabled auto-merge (squash)
November 3, 2026 21:59
sbc100
reviewed
Nov 3, 2026
sbc100
approved these changes
Nov 3, 2026
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.
This adds UDP multicast group membership to
-sNODERAWSOCKETS.Since #27921,
setsockoptrejects options it doesn't model, soIP_ADD_MEMBERSHIPand its IPv6 equivalent now fail withENOPROTOOPT. Before, they were silently accepted and had no effect.Group membership is now modelled on both the dgram and udp_wrap backends, which both expose
addMembership/dropMembership:IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP(struct ip_mreq, orip_mreqnwith an interface address) andIPV6_JOIN_GROUP/IPV6_LEAVE_GROUPbind()is applied once the socket is bound, since otherwise libuv would auto-bind it to an ephemeral portENODEVgetsockoptrejects themtest_noderawsockets_udp_multicast_membershipcovers join and leave, the kernel'sEADDRINUSEon a duplicate join andEADDRNOTAVAILon leaving a group that wasn't joined, a join beforebind(), and a shortoptlen. The IPv6 part is skipped on hosts without an IPv6 multicast route.Made with AI assistance under my review