@@ -658,10 +658,11 @@ struct xIPv6_Couple
658
658
* @brief Check IP-type, IP- and MAC-address found in the network packet.
659
659
*/
660
660
#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. */
665
666
666
667
NetworkEndPoint_t * pxEasyFit ( const NetworkInterface_t * pxNetworkInterface ,
667
668
const uint16_t usFrameType ,
@@ -688,15 +689,14 @@ struct xIPv6_Couple
688
689
{
689
690
NetworkEndPoint_t * pxEndPoint ;
690
691
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 };
694
695
BaseType_t xIndex ;
695
696
BaseType_t xIsIPv6 = ( usFrameType == ipIPv6_FRAME_TYPE ) ? pdTRUE : pdFALSE ;
696
697
BaseType_t xGatewayTarget = pdFALSE ;
697
698
BaseType_t xTargetGlobal = pdFALSE ;
698
699
699
- ( void ) pxIPAddressFrom ;
700
700
( void ) xGatewayTarget ;
701
701
( void ) xTargetGlobal ;
702
702
@@ -778,6 +778,11 @@ struct xIPv6_Couple
778
778
pxFound [ rMATCH_IP_ADDR ] = pxEndPoint ;
779
779
xCount [ rMATCH_IP_ADDR ]++ ;
780
780
}
781
+ else if ( FreeRTOS_InterfaceEndPointOnNetMask ( pxNetworkInterface , pxIPAddressFrom -> ulIP_IPv4 ) == pxEndPoint )
782
+ {
783
+ pxFound [ rMATCH_NETMASK ] = pxEndPoint ;
784
+ xCount [ rMATCH_NETMASK ]++ ;
785
+ }
781
786
else
782
787
{
783
788
/* do nothing, coverity happy */
@@ -912,16 +917,11 @@ struct xIPv6_Couple
912
917
/* coverity[misra_c_2012_rule_11_3_violation] */
913
918
const ARPPacket_t * pxARPFrame = ( const ARPPacket_t * ) pucEthernetBuffer ;
914
919
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 ) )
916
921
{
917
922
( void ) memcpy ( xIPAddressFrom .xIP_IPv6 .ucBytes , pxPacket -> xARPPacket .xARPHeader .ucSenderProtocolAddress , sizeof ( uint32_t ) );
918
923
xIPAddressTo .ulIP_IPv4 = pxPacket -> xARPPacket .xARPHeader .ulTargetProtocolAddress ;
919
924
}
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
- }
925
925
else
926
926
{
927
927
/* do nothing, coverity happy */
0 commit comments