Skip to content

Commit 3e63765

Browse files
committed
Fix Zynq7000 EMAC MAC address setup
Set solicited-node addresses independent of LLMNR. For mDNS set IPv4/6 MAC depending on ipconfigUSE_IPv6.
1 parent 2eaa162 commit 3e63765

File tree

1 file changed

+32
-23
lines changed

1 file changed

+32
-23
lines changed

source/portable/NetworkInterface/Zynq/NetworkInterface.c

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -256,43 +256,52 @@ static BaseType_t xZynqNetworkInterfaceInitialise( NetworkInterface_t * pxInterf
256256

257257
#if ( ipconfigUSE_LLMNR == 1 )
258258
{
259-
/* Also add LLMNR multicast MAC address. */
260259
#if ( ipconfigUSE_IPv6 == 0 )
261260
{
262261
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xLLMNR_MacAddress.ucBytes );
263262
}
264263
#else
265264
{
266-
NetworkEndPoint_t * pxEndPoint;
267-
NetworkInterface_t * pxInterface = pxMyInterfaces[ xEMACIndex ];
268-
269-
for( pxEndPoint = FreeRTOS_FirstEndPoint( pxInterface );
270-
pxEndPoint != NULL;
271-
pxEndPoint = FreeRTOS_NextEndPoint( pxInterface, pxEndPoint ) )
272-
{
273-
if( pxEndPoint->bits.bIPv6 != pdFALSE_UNSIGNED )
274-
{
275-
unsigned char ucMACAddress[ 6 ] = { 0x33, 0x33, 0xff, 0, 0, 0 };
276-
ucMACAddress[ 3 ] = pxEndPoint->ipv6_settings.xIPAddress.ucBytes[ 13 ];
277-
ucMACAddress[ 4 ] = pxEndPoint->ipv6_settings.xIPAddress.ucBytes[ 14 ];
278-
ucMACAddress[ 5 ] = pxEndPoint->ipv6_settings.xIPAddress.ucBytes[ 15 ];
279-
XEmacPs_SetHash( pxEMAC_PS, ( void * ) ucMACAddress );
280-
}
281-
}
282-
283265
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xLLMNR_MacAddressIPv6.ucBytes );
284266
}
285267
#endif /* if ( ipconfigUSE_IPv6 == 0 ) */
286268
}
287269
#endif /* ipconfigUSE_LLMNR == 1 */
288270

289-
#if ( ( ipconfigUSE_MDNS == 1 ) && ( ipconfigUSE_IPv6 != 0 ) )
290-
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xMDNS_MacAddress.ucBytes );
291-
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xMDNS_MacAddressIPv6.ucBytes );
292-
#endif
271+
#if ( ipconfigUSE_MDNS == 1 )
272+
{
273+
#if ( ipconfigUSE_IPv6 == 0 )
274+
{
275+
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xMDNS_MacAddress.ucBytes );
276+
}
277+
#else
278+
{
279+
XEmacPs_SetHash( pxEMAC_PS, ( void * ) xMDNS_MacAddressIPv6.ucBytes );
280+
}
281+
#endif /* if ( ipconfigUSE_IPv6 == 0 ) */
282+
}
283+
#endif /* ( ipconfigUSE_MDNS == 1 ) */
293284

294-
pxEndPoint = FreeRTOS_NextEndPoint( pxInterface, pxEndPoint );
285+
#if ( ipconfigUSE_IPv6 != 0 )
286+
{
287+
/* set the solicited-node multicast address */
288+
for( NetworkEndPoint_t * pxEndPointIter = FreeRTOS_FirstEndPoint( pxInterface );
289+
pxEndPointIter != NULL;
290+
pxEndPointIter = FreeRTOS_NextEndPoint( pxInterface, pxEndPointIter ) )
291+
{
292+
if( pxEndPointIter->bits.bIPv6 != pdFALSE_UNSIGNED )
293+
{
294+
unsigned char ucSsolicitedNodeMAC[ 6 ] = { 0x33, 0x33, 0xff, 0, 0, 0 };
295+
ucSsolicitedNodeMAC[ 3 ] = pxEndPointIter->ipv6_settings.xIPAddress.ucBytes[ 13 ];
296+
ucSsolicitedNodeMAC[ 4 ] = pxEndPointIter->ipv6_settings.xIPAddress.ucBytes[ 14 ];
297+
ucSsolicitedNodeMAC[ 5 ] = pxEndPointIter->ipv6_settings.xIPAddress.ucBytes[ 15 ];
298+
XEmacPs_SetHash( pxEMAC_PS, ( void * ) ucSsolicitedNodeMAC );
299+
}
300+
}
301+
}
302+
#endif /* if ( ipconfigUSE_IPv6 == 0 ) */
295303

304+
pxEndPoint = FreeRTOS_NextEndPoint( pxInterface, pxEndPoint );
296305
if( pxEndPoint != NULL )
297306
{
298307
/* If there is a second end-point, store the MAC

0 commit comments

Comments
 (0)