Listening for Multicast UDP packets

larrydew wrote on Tuesday, June 04, 2019:

How do I configure a socket to listen to a Multicast address range?

heinbali01 wrote on Wednesday, June 05, 2019:

Multicast is not yet available in FreeRTOS+TCP.

What it would need is a few changes:

Add some code in NetworkInterface.c to tell the NIC which multicast addresses you want to use. You will probably see code that allows the LLMNR multicast address (01-00-5E-00-00-FC).
Note that there are often two ways of filtering MAC-addresses: usually there is an array of e.g. 4 MAC-addresses. And sometimes there you can enter hash values (Multicast hash match).

Secondly: make sure that the library allows packets that have a multicast target address.
This happens in prvAllowIPPacket(). Again you will see code that allow LLMNR traffic:

    #if( ipconfigUSE_LLMNR == 1 )
        /* Is it the LLMNR multicast address? */
        ( ulDestinationIPAddress != ipLLMNR_IP_ADDR ) &&

And finally: the address resolution: when replying, make sure that the proper MAC address is found.
Normally, MAC addresses are obtained in either of two ways: address couples are stored upon reception. So when you reply to a UDP message, the ARP table probably contains the IP-address of the peer.
But when you’re the first one to send, an ARP request will be created to lookup the IP-address (and the first UDP packet will get lost). This will not work for Multicast. So that will need a change in the ARP lookup routine. You can read here about IPv4 multicast address resolution.

After making the above changes, you can use an ordinary UDP socket to communicate.

larrydew wrote on Saturday, June 08, 2019: