internet: (fixes #1040) Multicast receive overhaul
I recently found that multicast packet reception is severely questionable.
This is a tentative to make it more logical (but still somewhat close to Linux).
To receive a multicast packet you'll have to:
- Open a socket
- Bind to an address (
ANY
or a unicast address) - Call
UdpSocket::MulticastJoinGroup(targetAddr, interfaceIndex);
(or use 0 for all the interfaces)
or
- Open a socket
- Bind to a multicast address
To be done:
-
Remove the multicast address from IPv4 when the endpoint (or the socket) is removed -
Mirror the changes to IPv6 -
Add multicast support to Ipv[4,6]RawSocket
-
Write a test -
Write an example -
Documentation
To be tested:
-
What happens if you try to send a packet over a socket bound to a multicast address (probably nothing good).
Tried - for the records the simulation hangs. A socket bound to a multicast address can only receive data, obviously. I might (or might not) force the receive-only behavior. I think I'll not force it, so that we'll spot people that don't think.
Edited by Tommaso Pecorella