net: ListenMulticastUDP doesn't limit data to packets from the declared group port on Linux #73484
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes, also tested on 1.24.2 linux/amd64
tested on
debian trixie - kernel 6.12.22-amd64
ubuntu 24.04 - kernel 6.8.0-51-generic
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
join a multicast group using net.ListenMulticastUDP.
example / repoduction scenario
A sender process sends multicast packets every second on group A (239.0.10.10).
A proxy process listens for multicast packets on group A if a packet is received it sends a packet with different content on group B (239.0.10.11)
A receiver process listens for multicast packets on group B
mc_sender process: https://gist.github.com/mrinny/3c948eb86fc9cfa151cdf4b089980cbc
mc_proxy process: https://gist.github.com/mrinny/bbe1884dea72a4d08ad4101301f9b258
mc_receiver process: https://gist.github.com/mrinny/2e38dede9d32ebea222b28176537b55f
What did you expect to see?
reading from the connection should only return data send to multicast group which was decared as the remote address (group address and port).
the proxy process prints out "hello world" every second
the receiver process prints out "hello proxy" every second
What did you see instead?
Data from any linux kernel joined group is being returned by calling ReadFromUDP.
The proxy process prints out "hello world" followed by lots of "hello proxy"
the proxy process prints out "hello proxy"
Further Information
On OSX the behavior seems to be as expected.
The example reproduction uses three go programs to demonstrate the issue. Though it can also be observed with other programs.
For example:
The moment the linux ip stack joins the multicast group. I start seeing the proxy process printout the binary video data. While the poxy process never actually joined the group being used for the rtp multicast.
Instead of the call ListenMulticastUDP I've also tried the net.ListenPacket => ipv4.PacketConn => JoinGroup approach. Though this gives the same result.
The text was updated successfully, but these errors were encountered: