Pre-RFC: Adding support for source-specific multicast

IP Multicast comes in two flavours: any-source multicast (ASM) which uses just a group IP address, and source-specific multicast (SSM defined in RFC 4607 ) which uses a tuple of source and group address.

std::net:UdpSocket has support for ASM via join_multicast_v4 and join_multicast_v6 and their equivalent leave functions. However, AFAICT there is not an explicit friendly API for SSM. This is unfortunate because there are several classes of problem which exist for ASM (see this IETF draft document that discusses deprecation of ASM for interdomain multicast), and which SSM fixes.

A couple of years ago I wanted to build a Node.js SSM application and found that it too didn't expose a nice API. So I opened this PR to add one, which itself was built on top of a PR to libuv. Those PRs were landed recently but since my interests have now moved to Rust, I figured I'd start the ball rolling here by creating a topic and getting some feedback. Especially the testing aspects of multicast can be a bit quirky, so getting a handle on that early would be a help.

1 Like


I'm not from the language team, but I have the impression that these little API additions are often done without RFC, just by opening an issue on the Rust repo, with the proposed API. If there's no opposition, you'd then send a pull request with implementation (under a feature gate).

Anyway, all that does take time. If you want to have an immediate solution, all the sockets expose as_raw_fd/as_raw_handle and I think it would be enough to allow you call the relevant C functions on these. You could probably even create a crate with an extension trait, adding the right Rust API on top of the sockets.


Thanks for the pointers, I'll try some of your suggestions.

1 Like