Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MLDv1 support for IPv6 multicast #1205

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions source/FreeRTOS_IPv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,34 @@ eFrameProcessingResult_t eHandleIPv6ExtensionHeaders( NetworkBufferDescriptor_t
}


/*-----------------------------------------------------------*/

/**
* @brief Send an MLDv1 report for the given multicast address.
*
* @param[in] pxEndPoint The end-point that wants to send the MLDv1 report.
* @param[in] pxAddress The IPv6 multicast address to report.
*/
void vSendMLDv1Report( const struct xNetworkEndPoint * pxEndPoint,
const IPv6_Address_t * pxAddress )
{
/* Implementation of MLDv1 report sending. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the implementation left out?

}

/*-----------------------------------------------------------*/

/**
* @brief Send an MLDv1 done message for the given multicast address.
*
* @param[in] pxEndPoint The end-point that wants to send the MLDv1 done message.
* @param[in] pxAddress The IPv6 multicast address to report.
*/
void vSendMLDv1Done( const struct xNetworkEndPoint * pxEndPoint,
const IPv6_Address_t * pxAddress )
{
/* Implementation of MLDv1 done message sending. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

}

/*-----------------------------------------------------------*/

/* *INDENT-OFF* */
Expand Down
56 changes: 56 additions & 0 deletions source/FreeRTOS_IPv6_Utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,62 @@ void vManageSolicitedNodeAddress( const struct xNetworkEndPoint * pxEndPoint,
}
/*-----------------------------------------------------------*/

/**
* @brief Join an IPv6 multicast group.
*
* @param[in] pxEndPoint The end-point that wants to join the multicast group.
* @param[in] pxAddress The IPv6 multicast address to join.
*/
void vJoinMulticastGroup( const struct xNetworkEndPoint * pxEndPoint,
const IPv6_Address_t * pxAddress )
{
MACAddress_t xMACAddress;

configASSERT( pxEndPoint != NULL );
configASSERT( pxEndPoint->pxNetworkInterface != NULL );

/* Calculate the multicast MAC that corresponds to the IPv6 address. */
vSetMultiCastIPv6MacAddress( pxAddress, &xMACAddress );

/* Update the network driver filter */
if( pxEndPoint->pxNetworkInterface->pfAddAllowedMAC != NULL )
{
pxEndPoint->pxNetworkInterface->pfAddAllowedMAC( pxEndPoint->pxNetworkInterface, xMACAddress.ucBytes );
}

/* Send MLDv1 report for the multicast address. */
vSendMLDv1Report( pxEndPoint, pxAddress );
}
/*-----------------------------------------------------------*/

/**
* @brief Leave an IPv6 multicast group.
*
* @param[in] pxEndPoint The end-point that wants to leave the multicast group.
* @param[in] pxAddress The IPv6 multicast address to leave.
*/
void vLeaveMulticastGroup( const struct xNetworkEndPoint * pxEndPoint,
const IPv6_Address_t * pxAddress )
{
MACAddress_t xMACAddress;

configASSERT( pxEndPoint != NULL );
configASSERT( pxEndPoint->pxNetworkInterface != NULL );

/* Calculate the multicast MAC that corresponds to the IPv6 address. */
vSetMultiCastIPv6MacAddress( pxAddress, &xMACAddress );

/* Update the network driver filter */
if( pxEndPoint->pxNetworkInterface->pfRemoveAllowedMAC != NULL )
{
pxEndPoint->pxNetworkInterface->pfRemoveAllowedMAC( pxEndPoint->pxNetworkInterface, xMACAddress.ucBytes );
}

/* Send MLDv1 done message for the multicast address. */
vSendMLDv1Done( pxEndPoint, pxAddress );
}
/*-----------------------------------------------------------*/

/* *INDENT-OFF* */
#endif /* ( ipconfigUSE_IPv6 != 0 ) */
/* *INDENT-ON* */
7 changes: 7 additions & 0 deletions source/include/FreeRTOS_IPv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ uint32_t FreeRTOS_dnslookup6( const char * pcHostName,
BaseType_t xGetExtensionOrder( uint8_t ucProtocol,
uint8_t ucNextHeader );

/* MLDv1 group management function declarations */
void vSendMLDv1Report( const struct xNetworkEndPoint * pxEndPoint,
const IPv6_Address_t * pxAddress );

void vSendMLDv1Done( const struct xNetworkEndPoint * pxEndPoint,
const IPv6_Address_t * pxAddress );

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
Expand Down
8 changes: 8 additions & 0 deletions source/include/FreeRTOS_IPv6_Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ size_t usGetExtensionHeaderLength( const uint8_t * pucEthernetBuffer,
void vManageSolicitedNodeAddress( const struct xNetworkEndPoint * pxEndPoint,
BaseType_t xNetworkGoingUp );

/* Declare vJoinMulticastGroup function */
void vJoinMulticastGroup( const struct xNetworkEndPoint * pxEndPoint,
const IPv6_Address_t * pxAddress );

/* Declare vLeaveMulticastGroup function */
void vLeaveMulticastGroup( const struct xNetworkEndPoint * pxEndPoint,
const IPv6_Address_t * pxAddress );

/* *INDENT-OFF* */
#ifdef __cplusplus
} /* extern "C" */
Expand Down
Loading