diff --git a/source/FreeRTOS_IP.c b/source/FreeRTOS_IP.c index 9d19ffe324..2bbcbb0c8a 100644 --- a/source/FreeRTOS_IP.c +++ b/source/FreeRTOS_IP.c @@ -1513,28 +1513,43 @@ eFrameProcessingResult_t eConsiderFrameForProcessing( const uint8_t * const pucE eReturn = eProcessBuffer; } else - #if ( ( ipconfigUSE_LLMNR == 1 ) && ( ipconfigUSE_DNS != 0 ) ) - if( memcmp( xLLMNR_MacAddress.ucBytes, pxEthernetHeader->xDestinationAddress.ucBytes, sizeof( MACAddress_t ) ) == 0 ) + #if ( ipconfigIS_ENABLED( ipconfigSUPPORT_IP_MULTICAST ) ) + + /* + * With ipconfigSUPPORT_IP_MULTICAST enabled, FreeRTOS+TCP needs access to all + * multicast packets. It is too early to filter them out here because we don't + * know which socket needs which multicast address. Another thing to consider is + * that unless this function returns eProcessBuffer, eApplicationProcessCustomFrameHook() + * will not be called, so handling custom multicast frames would be impossible. + */ + if( MAC_IS_MULTICAST( pxEthernetHeader->xDestinationAddress.ucBytes ) ) { - /* The packet is a request for LLMNR - process it. */ eReturn = eProcessBuffer; } - else - #endif /* ipconfigUSE_LLMNR */ - #if ( ( ipconfigUSE_MDNS == 1 ) && ( ipconfigUSE_DNS != 0 ) ) - if( memcmp( xMDNS_MacAddress.ucBytes, pxEthernetHeader->xDestinationAddress.ucBytes, sizeof( MACAddress_t ) ) == 0 ) + #else /* ipconfigIS_ENABLED( ipconfigSUPPORT_IP_MULTICAST ) */ + #if ( ( ipconfigUSE_LLMNR == 1 ) && ( ipconfigUSE_DNS != 0 ) ) + if( memcmp( xLLMNR_MacAddress.ucBytes, pxEthernetHeader->xDestinationAddress.ucBytes, sizeof( MACAddress_t ) ) == 0 ) + { + /* The packet is a request for LLMNR - process it. */ + eReturn = eProcessBuffer; + } + else + #endif /* ipconfigUSE_LLMNR */ + #if ( ( ipconfigUSE_MDNS == 1 ) && ( ipconfigUSE_DNS != 0 ) ) + if( memcmp( xMDNS_MacAddress.ucBytes, pxEthernetHeader->xDestinationAddress.ucBytes, sizeof( MACAddress_t ) ) == 0 ) + { + /* The packet is a request for MDNS - process it. */ + eReturn = eProcessBuffer; + } + else + #endif /* ipconfigUSE_MDNS */ + if( ( pxEthernetHeader->xDestinationAddress.ucBytes[ 0 ] == ipMULTICAST_MAC_ADDRESS_IPv6_0 ) && + ( pxEthernetHeader->xDestinationAddress.ucBytes[ 1 ] == ipMULTICAST_MAC_ADDRESS_IPv6_1 ) ) { - /* The packet is a request for MDNS - process it. */ + /* The packet is a request for LLMNR - process it. */ eReturn = eProcessBuffer; } - else - #endif /* ipconfigUSE_MDNS */ - if( ( pxEthernetHeader->xDestinationAddress.ucBytes[ 0 ] == ipMULTICAST_MAC_ADDRESS_IPv6_0 ) && - ( pxEthernetHeader->xDestinationAddress.ucBytes[ 1 ] == ipMULTICAST_MAC_ADDRESS_IPv6_1 ) ) - { - /* The packet is a request for LLMNR - process it. */ - eReturn = eProcessBuffer; - } + #endif /* ipconfigIS_ENABLED( ipconfigSUPPORT_IP_MULTICAST ) */ else { /* The packet was not a broadcast, or for this node, just release diff --git a/source/FreeRTOS_IP_Multicast.c b/source/FreeRTOS_IP_Multicast.c index 5079d48b3e..62b81fb2cb 100644 --- a/source/FreeRTOS_IP_Multicast.c +++ b/source/FreeRTOS_IP_Multicast.c @@ -789,7 +789,7 @@ BaseType_t xEnlistMulticastReport( struct MCastReportDescription * pNewEntry ) IGMPPacket_t * pxIGMPPacket; portBASE_TYPE xReturn = pdFAIL; - configASSERT( pxEndPoint != NULL ) + configASSERT( pxEndPoint != NULL ); if( NULL != ( pxNetworkBuffer = pxGetNetworkBufferWithDescriptor( sizeof( IGMPPacket_t ), 0 ) ) ) { diff --git a/source/include/FreeRTOSIPConfigDefaults.h b/source/include/FreeRTOSIPConfigDefaults.h index a2632a8b4e..1589f38ac4 100644 --- a/source/include/FreeRTOSIPConfigDefaults.h +++ b/source/include/FreeRTOSIPConfigDefaults.h @@ -3301,7 +3301,11 @@ * Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE ) * * When set to ipconfigENABLE, this macro will - * enable the reception of multicast groups addresses. */ + * enable the reception of multicast groups addresses. When enabled, + * It is highly recommended to enable ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES + * and use a network driver that supports MAC filtering through the + * pfAddAllowedMAC/pfRemoveAllowedMAC functions. + */ #ifndef ipconfigSUPPORT_IP_MULTICAST #define ipconfigSUPPORT_IP_MULTICAST ipconfigDISABLE #endif