Skip to content

Commit

Permalink
Removes the explicit broadcast MAC check in eConsiderFrameForProcessi…
Browse files Browse the repository at this point in the history
…ng. Broadcasts are a form of multicasts and will be received when ipconfigSUPPORT_IP_MULTICAST is enabled.
  • Loading branch information
Emil Popov committed Feb 21, 2024
1 parent b3904e3 commit 9ae60f1
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions source/FreeRTOS_IP.c
Original file line number Diff line number Diff line change
Expand Up @@ -1518,12 +1518,7 @@ eFrameProcessingResult_t eConsiderFrameForProcessing( const uint8_t * const pucE
/* The packet was directed to this node - process it. */
eReturn = eProcessBuffer;
}
else if( memcmp( xBroadcastMACAddress.ucBytes, pxEthernetHeader->xDestinationAddress.ucBytes, sizeof( MACAddress_t ) ) == 0 )
{
/* The packet was a broadcast - process it. */
eReturn = eProcessBuffer;
}
else

#if ( ipconfigIS_ENABLED( ipconfigSUPPORT_IP_MULTICAST ) )

/*
Expand All @@ -1532,34 +1527,40 @@ eFrameProcessingResult_t eConsiderFrameForProcessing( const uint8_t * const pucE
* 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.
* Note that the broadcast MAC is a type of multicast so the multicast check covers it.
*/
if( MAC_IS_MULTICAST( pxEthernetHeader->xDestinationAddress.ucBytes ) )
else if( MAC_IS_MULTICAST( pxEthernetHeader->xDestinationAddress.ucBytes ) )
{
eReturn = eProcessBuffer;
}
#else /* ipconfigIS_ENABLED( ipconfigSUPPORT_IP_MULTICAST ) */
else if( memcmp( xBroadcastMACAddress.ucBytes, pxEthernetHeader->xDestinationAddress.ucBytes, sizeof( MACAddress_t ) ) == 0 )
{
/* The packet was a broadcast - process it. */
eReturn = eProcessBuffer;
}
#if ( ( ipconfigUSE_LLMNR == 1 ) && ( ipconfigUSE_DNS != 0 ) )
if( memcmp( xLLMNR_MacAddress.ucBytes, pxEthernetHeader->xDestinationAddress.ucBytes, sizeof( MACAddress_t ) ) == 0 )
else 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 )
else 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 LLMNR - process it. */
eReturn = eProcessBuffer;
}
#if ( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) )
else if( ( pxEthernetHeader->xDestinationAddress.ucBytes[ 0 ] == ipMULTICAST_MAC_ADDRESS_IPv6_0 ) &&
( pxEthernetHeader->xDestinationAddress.ucBytes[ 1 ] == ipMULTICAST_MAC_ADDRESS_IPv6_1 ) )
{
/* The packet is an IPv6 multicast - process it. */
eReturn = eProcessBuffer;
}
#endif /* ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) */
#endif /* ipconfigIS_ENABLED( ipconfigSUPPORT_IP_MULTICAST ) */
else
{
Expand Down

0 comments on commit 9ae60f1

Please sign in to comment.