@@ -254,42 +254,56 @@ static BaseType_t xZynqNetworkInterfaceInitialise( NetworkInterface_t * pxInterf
254254 /* Initialize the mac and set the MAC address at position 1. */
255255 XEmacPs_SetMacAddress ( pxEMAC_PS , ( void * ) pxEndPoint -> xMACAddress .ucBytes , 1 );
256256
257- #if ( ipconfigUSE_LLMNR == 1 )
257+ #if ( ipconfigIS_ENABLED ( ipconfigUSE_LLMNR ) )
258258 {
259- /* Also add LLMNR multicast MAC address. */
260- #if ( ipconfigUSE_IPv6 == 0 )
259+ #if ( ipconfigIS_ENABLED ( ipconfigUSE_IPv4 ) )
261260 {
262261 XEmacPs_SetHash ( pxEMAC_PS , ( void * ) xLLMNR_MacAddress .ucBytes );
263262 }
264- #else
263+ #endif /* ( ipconfigIS_ENABLED( ipconfigUSE_IPv4 ) */
264+
265+ #if ( ipconfigIS_ENABLED ( ipconfigUSE_IPv6 ) )
265266 {
266- NetworkEndPoint_t * pxEndPoint ;
267- NetworkInterface_t * pxInterface = pxMyInterfaces [ xEMACIndex ];
267+ XEmacPs_SetHash ( pxEMAC_PS , ( void * ) xLLMNR_MacAddressIPv6 .ucBytes );
268+ }
269+ #endif /* ( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) ) */
270+ }
271+ #endif /* ( ipconfigIS_ENABLED( ipconfigUSE_LLMNR ) ) */
268272
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- }
273+ #if ( ipconfigIS_ENABLED ( ipconfigUSE_MDNS ) )
274+ {
275+ #if ( ipconfigIS_ENABLED ( ipconfigUSE_IPv4 ) )
276+ {
277+ XEmacPs_SetHash ( pxEMAC_PS , ( void * ) xMDNS_MacAddress .ucBytes );
278+ }
279+ #endif /* ( ipconfigIS_ENABLED( ipconfigUSE_IPv4 ) */
282280
283- XEmacPs_SetHash ( pxEMAC_PS , ( void * ) xLLMNR_MacAddressIPv6 .ucBytes );
281+ #if ( ipconfigIS_ENABLED ( ipconfigUSE_IPv6 ) )
282+ {
283+ XEmacPs_SetHash ( pxEMAC_PS , ( void * ) xMDNS_MacAddressIPv6 .ucBytes );
284284 }
285- #endif /* if ( ipconfigUSE_IPv6 == 0 ) */
285+ #endif /* ( ipconfigIS_ENABLED ( ipconfigUSE_IPv6 ) ) */
286286 }
287- #endif /* ipconfigUSE_LLMNR == 1 */
287+ #endif /* ( ipconfigIS_ENABLED( ipconfigUSE_MDNS) ) */
288288
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
289+ #if ( ipconfigIS_ENABLED ( ipconfigUSE_IPv6 ) )
290+ {
291+ /* set the solicited-node multicast address */
292+ for ( NetworkEndPoint_t * pxEndPointIter = FreeRTOS_FirstEndPoint ( pxInterface );
293+ pxEndPointIter != NULL ;
294+ pxEndPointIter = FreeRTOS_NextEndPoint ( pxInterface , pxEndPointIter ) )
295+ {
296+ if ( pxEndPointIter -> bits .bIPv6 != pdFALSE_UNSIGNED )
297+ {
298+ unsigned char ucSsolicitedNodeMAC [ 6 ] = { 0x33 , 0x33 , 0xff , 0 , 0 , 0 };
299+ ucSsolicitedNodeMAC [ 3 ] = pxEndPointIter -> ipv6_settings .xIPAddress .ucBytes [ 13 ];
300+ ucSsolicitedNodeMAC [ 4 ] = pxEndPointIter -> ipv6_settings .xIPAddress .ucBytes [ 14 ];
301+ ucSsolicitedNodeMAC [ 5 ] = pxEndPointIter -> ipv6_settings .xIPAddress .ucBytes [ 15 ];
302+ XEmacPs_SetHash ( pxEMAC_PS , ( void * ) ucSsolicitedNodeMAC );
303+ }
304+ }
305+ }
306+ #endif /* ( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) ) */
293307
294308 pxEndPoint = FreeRTOS_NextEndPoint ( pxInterface , pxEndPoint );
295309
@@ -378,7 +392,8 @@ static BaseType_t xZynqNetworkInterfaceOutput( NetworkInterface_t * pxInterface,
378392 * the protocol checksum to have a value of zero. */
379393 pxPacket = ( ProtocolPacket_t * ) ( pxBuffer -> pucEthernetBuffer );
380394
381- #if ( ipconfigUSE_IPv6 != 0 )
395+ #if ( ipconfigIS_ENABLED ( ipconfigUSE_IPv6 ) )
396+ {
382397 ICMPPacket_IPv6_t * pxICMPPacket = ( ICMPPacket_IPv6_t * ) pxBuffer -> pucEthernetBuffer ;
383398
384399 if ( ( pxPacket -> xICMPPacket .xEthernetHeader .usFrameType == ipIPv6_FRAME_TYPE ) &&
@@ -389,16 +404,21 @@ static BaseType_t xZynqNetworkInterfaceOutput( NetworkInterface_t * pxInterface,
389404 * so for ICMP and other protocols it must be done manually. */
390405 usGenerateProtocolChecksum ( pxBuffer -> pucEthernetBuffer , pxBuffer -> xDataLength , pdTRUE );
391406 }
392- #endif
407+ }
408+ #endif /* ( ipconfigIS_ENABLED( ipconfigUSE_IPv6 ) ) */
393409
394- if ( ( pxPacket -> xICMPPacket .xEthernetHeader .usFrameType == ipIPv4_FRAME_TYPE ) &&
395- ( pxPacket -> xICMPPacket .xIPHeader .ucProtocol == ipPROTOCOL_ICMP ) )
410+ #if ( ipconfigIS_ENABLED ( ipconfigUSE_IPv4 ) )
396411 {
397- /* The EMAC will calculate the checksum of the IP-header.
398- * It can only calculate protocol checksums of UDP and TCP,
399- * so for ICMP and other protocols it must be done manually. */
400- usGenerateProtocolChecksum ( pxBuffer -> pucEthernetBuffer , pxBuffer -> xDataLength , pdTRUE );
412+ if ( ( pxPacket -> xICMPPacket .xEthernetHeader .usFrameType == ipIPv4_FRAME_TYPE ) &&
413+ ( pxPacket -> xICMPPacket .xIPHeader .ucProtocol == ipPROTOCOL_ICMP ) )
414+ {
415+ /* The EMAC will calculate the checksum of the IP-header.
416+ * It can only calculate protocol checksums of UDP and TCP,
417+ * so for ICMP and other protocols it must be done manually. */
418+ usGenerateProtocolChecksum ( pxBuffer -> pucEthernetBuffer , pxBuffer -> xDataLength , pdTRUE );
419+ }
401420 }
421+ #endif /* ( ipconfigIS_ENABLED( ipconfigUSE_IPv4 ) ) */
402422 }
403423 #endif /* ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM */
404424
0 commit comments