Skip to content

fix(ext/node): allow IPv6 multicast addresses in UDP addMembership/dropMembership#32739

Merged
bartlomieju merged 1 commit intodenoland:mainfrom
littledivy:fix-udp-multicast-ipv6
Mar 15, 2026
Merged

fix(ext/node): allow IPv6 multicast addresses in UDP addMembership/dropMembership#32739
bartlomieju merged 1 commit intodenoland:mainfrom
littledivy:fix-udp-multicast-ipv6

Conversation

@kajukitli
Copy link
Contributor

The validation in addMembership and dropMembership was only checking for IPv4 addresses using isValidIPv4Address(), making the IPv6 code path unreachable:

addMembership(multicastAddress: string, interfaceAddress?: string): number {
  if (!isValidIPv4Address(multicastAddress, interfaceAddress)) {
    return codeMap.get("EINVAL")!;  // Always fails for IPv6!
  }
  // ...
  if (this.#family === "IPv6") {
    op_node_udp_join_multi_v6(this.#rid, multicastAddress, 0);  // Unreachable
  }
}

This refactors validation to check addresses based on the socket family:

  • IPv4 sockets validate IPv4 multicast + optional interface addresses
  • IPv6 sockets validate IPv6 multicast addresses (interface is by index, not address)

Also uses the existing isIP() helper instead of manual octet parsing.

@kajukitli kajukitli force-pushed the fix-udp-multicast-ipv6 branch 2 times, most recently from 8933642 to 5e297e1 Compare March 15, 2026 07:18
…opMembership

The validation was only checking for IPv4 addresses, making the IPv6
code path unreachable. This refactors validation to check addresses
based on the socket family - IPv4 sockets validate IPv4 addresses,
IPv6 sockets validate IPv6 addresses.

Also uses the existing isIP() helper instead of manual octet parsing.
@kajukitli kajukitli force-pushed the fix-udp-multicast-ipv6 branch from 5e297e1 to 9c10261 Compare March 15, 2026 07:22
@bartlomieju bartlomieju merged commit 408ddbe into denoland:main Mar 15, 2026
112 checks passed
@bartlomieju bartlomieju deleted the fix-udp-multicast-ipv6 branch March 15, 2026 08:56
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