@@ -658,10 +658,11 @@ struct xIPv6_Couple
658658 * @brief Check IP-type, IP- and MAC-address found in the network packet.
659659 */
660660 #define rMATCH_IP_ADDR 0 /**< Find an endpoint with a matching IP-address. */
661- #define rMATCH_IPv6_TYPE 1 /**< Find an endpoint with a matching IPv6 type (both global or non global). */
662- #define rMATCH_MAC_ADDR 2 /**< Find an endpoint with a matching MAC-address. */
663- #define rMATCH_IP_TYPE 3 /**< Find an endpoint with a matching IP-type, v4 or v6. */
664- #define rMATCH_COUNT 4 /**< The number of methods. */
661+ #define rMATCH_NETMASK 1 /**< Find an endpoint with a matching NetMask. */
662+ #define rMATCH_IPv6_TYPE 2 /**< Find an endpoint with a matching IPv6 type (both global or non global). */
663+ #define rMATCH_MAC_ADDR 3 /**< Find an endpoint with a matching MAC-address. */
664+ #define rMATCH_IP_TYPE 4 /**< Find an endpoint with a matching IP-type, v4 or v6. */
665+ #define rMATCH_COUNT 5 /**< The number of methods. */
665666
666667 NetworkEndPoint_t * pxEasyFit ( const NetworkInterface_t * pxNetworkInterface ,
667668 const uint16_t usFrameType ,
@@ -688,15 +689,14 @@ struct xIPv6_Couple
688689 {
689690 NetworkEndPoint_t * pxEndPoint ;
690691 NetworkEndPoint_t * pxReturn = NULL ;
691- /* endpoints found for IP-type, IP-address, and MAC-address. */
692- NetworkEndPoint_t * pxFound [ rMATCH_COUNT ] = { NULL , NULL , NULL , NULL };
693- BaseType_t xCount [ rMATCH_COUNT ] = { 0 , 0 , 0 , 0 };
692+ /* endpoints found for IP-type, IP-address, NetMask and MAC-address. */
693+ NetworkEndPoint_t * pxFound [ rMATCH_COUNT ] = { NULL , NULL , NULL , NULL , NULL };
694+ BaseType_t xCount [ rMATCH_COUNT ] = { 0 , 0 , 0 , 0 , 0 };
694695 BaseType_t xIndex ;
695696 BaseType_t xIsIPv6 = ( usFrameType == ipIPv6_FRAME_TYPE ) ? pdTRUE : pdFALSE ;
696697 BaseType_t xGatewayTarget = pdFALSE ;
697698 BaseType_t xTargetGlobal = pdFALSE ;
698699
699- ( void ) pxIPAddressFrom ;
700700 ( void ) xGatewayTarget ;
701701 ( void ) xTargetGlobal ;
702702
@@ -778,6 +778,11 @@ struct xIPv6_Couple
778778 pxFound [ rMATCH_IP_ADDR ] = pxEndPoint ;
779779 xCount [ rMATCH_IP_ADDR ]++ ;
780780 }
781+ else if ( FreeRTOS_InterfaceEndPointOnNetMask ( pxNetworkInterface , pxIPAddressFrom -> ulIP_IPv4 ) == pxEndPoint )
782+ {
783+ pxFound [ rMATCH_NETMASK ] = pxEndPoint ;
784+ xCount [ rMATCH_NETMASK ]++ ;
785+ }
781786 else
782787 {
783788 /* do nothing, coverity happy */
@@ -912,16 +917,11 @@ struct xIPv6_Couple
912917 /* coverity[misra_c_2012_rule_11_3_violation] */
913918 const ARPPacket_t * pxARPFrame = ( const ARPPacket_t * ) pucEthernetBuffer ;
914919
915- if ( pxARPFrame -> xARPHeader .usOperation == ( uint16_t ) ipARP_REQUEST )
920+ if ( ( pxARPFrame -> xARPHeader .usOperation == ( uint16_t ) ipARP_REQUEST ) || ( pxARPFrame -> xARPHeader . usOperation == ( uint16_t ) ipARP_REPLY ) )
916921 {
917922 ( void ) memcpy ( xIPAddressFrom .xIP_IPv6 .ucBytes , pxPacket -> xARPPacket .xARPHeader .ucSenderProtocolAddress , sizeof ( uint32_t ) );
918923 xIPAddressTo .ulIP_IPv4 = pxPacket -> xARPPacket .xARPHeader .ulTargetProtocolAddress ;
919924 }
920- else if ( pxARPFrame -> xARPHeader .usOperation == ( uint16_t ) ipARP_REPLY )
921- {
922- ( void ) memcpy ( xIPAddressTo .xIP_IPv6 .ucBytes , pxPacket -> xARPPacket .xARPHeader .ucSenderProtocolAddress , sizeof ( uint32_t ) );
923- xIPAddressFrom .ulIP_IPv4 = pxPacket -> xARPPacket .xARPHeader .ulTargetProtocolAddress ;
924- }
925925 else
926926 {
927927 /* do nothing, coverity happy */
0 commit comments