diff --git a/source/FreeRTOS_TCP_Transmission.c b/source/FreeRTOS_TCP_Transmission.c index 99864f24c2..2c045213f0 100644 --- a/source/FreeRTOS_TCP_Transmission.c +++ b/source/FreeRTOS_TCP_Transmission.c @@ -64,12 +64,21 @@ /* Just make sure the contents doesn't get compiled if TCP is not enabled. */ #if ipconfigUSE_TCP == 1 + static BaseType_t prvTCPMakeSurePrepared( FreeRTOS_Socket_t * pxSocket ); + /* * Let ARP look-up the MAC-address of the peer and initialise the first SYN * packet. */ static BaseType_t prvTCPPrepareConnect( FreeRTOS_Socket_t * pxSocket ); + #if ipconfigIS_ENABLED( ipconfigUSE_TCP_WIN ) + static uint8_t prvWinScaleFactor( const FreeRTOS_Socket_t * pxSocket ); + #endif + + static BaseType_t prvTCPSendSpecialPacketHelper( NetworkBufferDescriptor_t * const pxNetworkBuffer, + uint8_t ucTCPFlags ); + /*------------------------------------------------------------------------*/ /** @@ -1305,35 +1314,44 @@ * * @return pdFAIL always indicating that the packet was not consumed. */ - BaseType_t prvTCPSendSpecialPacketHelper( NetworkBufferDescriptor_t * pxNetworkBuffer, - uint8_t ucTCPFlags ) + static BaseType_t prvTCPSendSpecialPacketHelper( NetworkBufferDescriptor_t * const pxNetworkBuffer, + uint8_t ucTCPFlags ) { BaseType_t xReturn = pdTRUE; + configASSERT( pxNetworkBuffer != NULL ); + configASSERT( pxNetworkBuffer->pucEthernetBuffer != NULL ); - #if ( ipconfigIGNORE_UNKNOWN_PACKETS == 1 ) + #if ipconfigIS_ENABLED( ipconfigIGNORE_UNKNOWN_PACKETS ) /* Configured to ignore unknown packets just suppress a compiler warning. */ ( void ) pxNetworkBuffer; ( void ) ucTCPFlags; #else { - switch( uxIPHeaderSizePacket( pxNetworkBuffer ) ) - { - #if ( ipconfigUSE_IPv4 != 0 ) - case ipSIZE_OF_IPv4_HEADER: - xReturn = prvTCPSendSpecialPktHelper_IPV4( pxNetworkBuffer, ucTCPFlags ); - break; - #endif /* ( ipconfigUSE_IPv4 != 0 ) */ + /* Map the ethernet buffer onto the TCPPacket_t struct for easy access to the fields. */ - #if ( ipconfigUSE_IPv6 != 0 ) - case ipSIZE_OF_IPv6_HEADER: - xReturn = prvTCPSendSpecialPktHelper_IPV6( pxNetworkBuffer, ucTCPFlags ); - break; - #endif /* ( ipconfigUSE_IPv6 != 0 ) */ + /* MISRA Ref 11.3.1 [Misaligned access] */ + /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */ + /* coverity[misra_c_2012_rule_11_3_violation] */ + TCPHeader_t * const pxTCPHeader = ( ( TCPHeader_t * ) &( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + uxIPHeaderSizePacket( pxNetworkBuffer ) ] ) ); + const uint32_t ulSendLength = uxIPHeaderSizePacket( pxNetworkBuffer ) + ipSIZE_OF_TCP_HEADER; /* Plus 0 options. */ + const uint8_t ucFlagsReceived = pxTCPHeader->ucTCPFlags; - default: - xReturn = pdFAIL; - break; + configASSERT( pxNetworkBuffer->xDataLength >= ( ipSIZE_OF_ETH_HEADER + ulSendLength ) ); + + pxTCPHeader->ucTCPFlags = ucTCPFlags; + pxTCPHeader->ucTCPOffset = ( ipSIZE_OF_TCP_HEADER ) << 2; + + if( ( ucFlagsReceived & tcpTCP_FLAG_SYN ) != 0U ) + { + /* A synchronize packet is received. It counts as 1 pseudo byte of data, + * so increase the variable with 1. Before sending a reply, the values of + * 'ulSequenceNumber' and 'ulAckNr' will be swapped. */ + uint32_t ulSequenceNumber = FreeRTOS_ntohl( pxTCPHeader->ulSequenceNumber ); + ulSequenceNumber++; + pxTCPHeader->ulSequenceNumber = FreeRTOS_htonl( ulSequenceNumber ); } + + prvTCPReturnPacket( NULL, pxNetworkBuffer, ulSendLength, pdFALSE ); } #endif /* !ipconfigIGNORE_UNKNOWN_PACKETS */ diff --git a/source/FreeRTOS_TCP_Transmission_IPv4.c b/source/FreeRTOS_TCP_Transmission_IPv4.c index ae16eac1db..ea8500885e 100644 --- a/source/FreeRTOS_TCP_Transmission_IPv4.c +++ b/source/FreeRTOS_TCP_Transmission_IPv4.c @@ -463,57 +463,6 @@ BaseType_t prvTCPPrepareConnect_IPV4( FreeRTOS_Socket_t * pxSocket ) } /*-----------------------------------------------------------*/ - -/** - * @brief Common code for sending a TCP protocol control packet (i.e. no options, no - * payload, just flags). - * - * @param[in] pxNetworkBuffer The network buffer received from the peer. - * @param[in] ucTCPFlags The flags to determine what kind of packet this is. - * - * @return pdFAIL always indicating that the packet was not consumed. - */ -BaseType_t prvTCPSendSpecialPktHelper_IPV4( NetworkBufferDescriptor_t * pxNetworkBuffer, - uint8_t ucTCPFlags ) -{ - #if ( ipconfigIGNORE_UNKNOWN_PACKETS == 1 ) - /* Configured to ignore unknown packets just suppress a compiler warning. */ - ( void ) pxNetworkBuffer; - ( void ) ucTCPFlags; - #else - { - /* Map the ethernet buffer onto the TCPPacket_t struct for easy access to the fields. */ - - /* MISRA Ref 11.3.1 [Misaligned access] */ -/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */ - /* coverity[misra_c_2012_rule_11_3_violation] */ - TCPPacket_t * pxTCPPacket = ( ( TCPPacket_t * ) pxNetworkBuffer->pucEthernetBuffer ); - const uint32_t ulSendLength = - ipSIZE_OF_IPv4_HEADER + ipSIZE_OF_TCP_HEADER; /* Plus 0 options. */ - - uint8_t ucFlagsReceived = pxTCPPacket->xTCPHeader.ucTCPFlags; - pxTCPPacket->xTCPHeader.ucTCPFlags = ucTCPFlags; - pxTCPPacket->xTCPHeader.ucTCPOffset = ( ipSIZE_OF_TCP_HEADER ) << 2; - - if( ( ucFlagsReceived & tcpTCP_FLAG_SYN ) != 0U ) - { - /* A synchronize packet is received. It counts as 1 pseudo byte of data, - * so increase the variable with 1. Before sending a reply, the values of - * 'ulSequenceNumber' and 'ulAckNr' will be swapped. */ - uint32_t ulSequenceNumber = FreeRTOS_ntohl( pxTCPPacket->xTCPHeader.ulSequenceNumber ); - ulSequenceNumber++; - pxTCPPacket->xTCPHeader.ulSequenceNumber = FreeRTOS_htonl( ulSequenceNumber ); - } - - prvTCPReturnPacket( NULL, pxNetworkBuffer, ulSendLength, pdFALSE ); - } - #endif /* !ipconfigIGNORE_UNKNOWN_PACKETS */ - - /* The packet was not consumed. */ - return pdFAIL; -} -/*-----------------------------------------------------------*/ - /* *INDENT-OFF* */ #endif /* ( ipconfigUSE_IPv4 != 0 ) && ( ipconfigUSE_TCP == 1 ) */ /* *INDENT-ON* */ diff --git a/source/FreeRTOS_TCP_Transmission_IPv6.c b/source/FreeRTOS_TCP_Transmission_IPv6.c index e2afb837e4..af5d2ee4d2 100644 --- a/source/FreeRTOS_TCP_Transmission_IPv6.c +++ b/source/FreeRTOS_TCP_Transmission_IPv6.c @@ -479,58 +479,6 @@ BaseType_t prvTCPPrepareConnect_IPV6( FreeRTOS_Socket_t * pxSocket ) } /*-----------------------------------------------------------*/ - -/** - * @brief Common code for sending a TCP protocol control packet (i.e. no options, no - * payload, just flags). - * - * @param[in] pxNetworkBuffer The network buffer received from the peer. - * @param[in] ucTCPFlags The flags to determine what kind of packet this is. - * - * @return pdFAIL always indicating that the packet was not consumed. - */ -BaseType_t prvTCPSendSpecialPktHelper_IPV6( NetworkBufferDescriptor_t * pxNetworkBuffer, - uint8_t ucTCPFlags ) -{ - #if ( ipconfigIGNORE_UNKNOWN_PACKETS == 1 ) - /* Configured to ignore unknown packets just suppress a compiler warning. */ - ( void ) pxNetworkBuffer; - ( void ) ucTCPFlags; - #else - { - /* Map the ethernet buffer onto the TCPPacket_t struct for easy access to the fields. */ - - /* MISRA Ref 11.3.1 [Misaligned access] */ - /* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */ - /* coverity[misra_c_2012_rule_11_3_violation] */ - TCPPacket_IPv6_t * pxTCPPacket = ( ( TCPPacket_IPv6_t * ) pxNetworkBuffer->pucEthernetBuffer ); - const uint32_t ulSendLength = - ipSIZE_OF_IPv6_HEADER + ipSIZE_OF_TCP_HEADER; /* Plus 0 options. */ - - uint8_t ucFlagsReceived = pxTCPPacket->xTCPHeader.ucTCPFlags; - pxTCPPacket->xTCPHeader.ucTCPFlags = ucTCPFlags; - pxTCPPacket->xTCPHeader.ucTCPOffset = ( ipSIZE_OF_TCP_HEADER ) << 2; - - if( ( ucFlagsReceived & tcpTCP_FLAG_SYN ) != 0U ) - { - /* A synchronize packet is received. It counts as 1 pseudo byte of data, - * so increase the variable with 1. Before sending a reply, the values of - * 'ulSequenceNumber' and 'ulAckNr' will be swapped. */ - uint32_t ulSequenceNumber = FreeRTOS_ntohl( pxTCPPacket->xTCPHeader.ulSequenceNumber ); - ulSequenceNumber++; - pxTCPPacket->xTCPHeader.ulSequenceNumber = FreeRTOS_htonl( ulSequenceNumber ); - } - - prvTCPReturnPacket( NULL, pxNetworkBuffer, ulSendLength, pdFALSE ); - } - #endif /* !ipconfigIGNORE_UNKNOWN_PACKETS */ - - /* The packet was not consumed. */ - return pdFAIL; -} -/*-----------------------------------------------------------*/ - - /* *INDENT-OFF* */ #endif /* ( ipconfigUSE_IPv6 != 0 ) && ( ipconfigUSE_TCP == 1 ) */ /* *INDENT-ON* */ diff --git a/source/include/FreeRTOS_IP_Private.h b/source/include/FreeRTOS_IP_Private.h index 8e6fa6b7df..34c461871e 100644 --- a/source/include/FreeRTOS_IP_Private.h +++ b/source/include/FreeRTOS_IP_Private.h @@ -209,10 +209,13 @@ typedef struct xARP_PACKET ARPPacket_t; */ typedef union XPROT_PACKET { - ARPPacket_t xARPPacket; /**< Union member: ARP packet struct */ - TCPPacket_t xTCPPacket; /**< Union member: TCP packet struct */ - UDPPacket_t xUDPPacket; /**< Union member: UDP packet struct */ - ICMPPacket_t xICMPPacket; /**< Union member: ICMP packet struct */ + ARPPacket_t xARPPacket; /**< Union member: ARP packet struct */ + ICMPPacket_t xICMPPacket; /**< Union member: ICMP packet struct */ + TCPPacket_t xTCPPacket; /**< Union member: TCP packet struct */ + UDPPacket_t xUDPPacket; /**< Union member: UDP packet struct */ + ICMPPacket_IPv6_t xICMPPacketIPv6; /**< Union member: ICMPv6 packet struct */ + TCPPacket_IPv6_t xTCPPacketIPv6; /**< Union member: TCPv6 packet struct */ + UDPPacket_IPv6_t xUDPPacketIPv6; /**< Union member: UDPv6 packet struct */ } ProtocolPacket_t; /** @@ -221,9 +224,10 @@ typedef union XPROT_PACKET */ typedef union xPROT_HEADERS { + ARPHeader_t xARPHeader; /**< Union member: ARP header */ ICMPHeader_t xICMPHeader; /**< Union member: ICMP header */ - UDPHeader_t xUDPHeader; /**< Union member: UDP header */ TCPHeader_t xTCPHeader; /**< Union member: TCP header */ + UDPHeader_t xUDPHeader; /**< Union member: UDP header */ ICMPHeader_IPv6_t xICMPHeaderIPv6; /**< Union member: ICMPv6 header */ } ProtocolHeaders_t; diff --git a/source/include/FreeRTOS_TCP_State_Handling.h b/source/include/FreeRTOS_TCP_State_Handling.h index 21208c5e21..deaa73ba17 100644 --- a/source/include/FreeRTOS_TCP_State_Handling.h +++ b/source/include/FreeRTOS_TCP_State_Handling.h @@ -79,27 +79,6 @@ FreeRTOS_Socket_t * prvHandleListen_IPV4( FreeRTOS_Socket_t * pxSocket, FreeRTOS_Socket_t * prvHandleListen_IPV6( FreeRTOS_Socket_t * pxSocket, NetworkBufferDescriptor_t * pxNetworkBuffer ); -/* - * Common code for sending a TCP protocol control packet (i.e. no options, no - * payload, just flags). - */ -BaseType_t prvTCPSendSpecialPacketHelper( NetworkBufferDescriptor_t * pxNetworkBuffer, - uint8_t ucTCPFlags ); - -/* - * Common code for sending a TCP protocol control packet (i.e. no options, no - * payload, just flags). - */ -BaseType_t prvTCPSendSpecialPktHelper_IPV4( NetworkBufferDescriptor_t * pxNetworkBuffer, - uint8_t ucTCPFlags ); - -/* - * Common code for sending a TCP protocol control packet (i.e. no options, no - * payload, just flags). - */ -BaseType_t prvTCPSendSpecialPktHelper_IPV6( NetworkBufferDescriptor_t * pxNetworkBuffer, - uint8_t ucTCPFlags ); - /* * After a listening socket receives a new connection, it may duplicate itself. * The copying takes place in prvTCPSocketCopy. diff --git a/source/include/FreeRTOS_TCP_Transmission.h b/source/include/FreeRTOS_TCP_Transmission.h index ab1eae67b2..9484762dc7 100644 --- a/source/include/FreeRTOS_TCP_Transmission.h +++ b/source/include/FreeRTOS_TCP_Transmission.h @@ -164,6 +164,7 @@ NetworkBufferDescriptor_t * prvTCPBufferResize( const FreeRTOS_Socket_t * pxSock NetworkBufferDescriptor_t * pxNetworkBuffer, int32_t lDataLen, UBaseType_t uxOptionsLength ); + /* *INDENT-OFF* */ #ifdef __cplusplus } /* extern "C" */ diff --git a/test/unit-test/FreeRTOS_TCP_Transmission/FreeRTOS_TCP_Transmission_stubs.c b/test/unit-test/FreeRTOS_TCP_Transmission/FreeRTOS_TCP_Transmission_stubs.c index 126b0f71bf..662921f617 100644 --- a/test/unit-test/FreeRTOS_TCP_Transmission/FreeRTOS_TCP_Transmission_stubs.c +++ b/test/unit-test/FreeRTOS_TCP_Transmission/FreeRTOS_TCP_Transmission_stubs.c @@ -79,13 +79,3 @@ BaseType_t prvTCPPrepareConnect_IPV6( FreeRTOS_Socket_t * pxSocket ) { return pdTRUE; } - -/* - * Common code for sending a TCP protocol control packet (i.e. no options, no - * payload, just flags). - */ -BaseType_t prvTCPSendSpecialPktHelper_IPV6( NetworkBufferDescriptor_t * pxNetworkBuffer, - uint8_t ucTCPFlags ) -{ - return pdTRUE; -} diff --git a/test/unit-test/FreeRTOS_TCP_Transmission/FreeRTOS_TCP_Transmission_utest.c b/test/unit-test/FreeRTOS_TCP_Transmission/FreeRTOS_TCP_Transmission_utest.c index 8fcb44c80c..68d37bd563 100644 --- a/test/unit-test/FreeRTOS_TCP_Transmission/FreeRTOS_TCP_Transmission_utest.c +++ b/test/unit-test/FreeRTOS_TCP_Transmission/FreeRTOS_TCP_Transmission_utest.c @@ -2448,17 +2448,15 @@ void test_prvSendData_AckMsg_Null_Syn_State_Data_To_Send_Rcv_Zero( void ) /* test prvTCPSendSpecialPacketHelper function with incorrect header size */ void test_prvTCPSendSpecialPacketHelper_Incorrect_HeaderSize( void ) { - BaseType_t Return = pdTRUE; - pxSocket = &xSocket; pxNetworkBuffer = &xNetworkBuffer; pxNetworkBuffer->pucEthernetBuffer = ucEthernetBuffer; + pxNetworkBuffer->xDataLength = 0; - uxIPHeaderSizePacket_ExpectAnyArgsAndReturn( 0 ); - - Return = prvTCPSendSpecialPacketHelper( pxNetworkBuffer, tcpTCP_FLAG_ACK ); + uxIPHeaderSizePacket_IgnoreAndReturn( 0 ); - TEST_ASSERT_EQUAL( pdFALSE, Return ); + catch_assert( prvTCPSendSpecialPacketHelper( pxNetworkBuffer, tcpTCP_FLAG_ACK ) ); + pxNetworkBuffer->xDataLength = ipconfigNETWORK_MTU; } /* test prvTCPSendSpecialPacketHelper function with incorrect header size */ @@ -2470,7 +2468,7 @@ void test_prvTCPSendSpecialPacketHelper_IPv6_HeaderSize( void ) pxNetworkBuffer = &xNetworkBuffer; pxNetworkBuffer->pucEthernetBuffer = ucEthernetBuffer; - uxIPHeaderSizePacket_ExpectAnyArgsAndReturn( ipSIZE_OF_IPv6_HEADER ); + uxIPHeaderSizePacket_IgnoreAndReturn( ipSIZE_OF_IPv6_HEADER ); Return = prvTCPSendSpecialPacketHelper( pxNetworkBuffer, tcpTCP_FLAG_ACK ); @@ -2506,7 +2504,7 @@ void test_prvTCPSendSpecialPacketHelper( void ) eARPGetCacheEntry_ReturnThruPtr_ppxEndPoint( &pxEndPoint ); Return = prvTCPSendSpecialPacketHelper( pxNetworkBuffer, tcpTCP_FLAG_ACK ); - TEST_ASSERT_EQUAL( pdFALSE, Return ); + TEST_ASSERT_EQUAL( pdTRUE, Return ); TEST_ASSERT_EQUAL( 1, NetworkInterfaceOutputFunction_Stub_Called ); TEST_ASSERT_EQUAL( tcpTCP_FLAG_ACK, pxTCPPacket->xTCPHeader.ucTCPFlags ); TEST_ASSERT_EQUAL( 0x50, pxTCPPacket->xTCPHeader.ucTCPOffset ); @@ -2543,7 +2541,7 @@ void test_prvTCPSendSpecialPacketHelper_flagSYN( void ) eARPGetCacheEntry_ReturnThruPtr_ppxEndPoint( &pxEndPoint ); Return = prvTCPSendSpecialPacketHelper( pxNetworkBuffer, tcpTCP_FLAG_ACK ); - TEST_ASSERT_EQUAL( pdFALSE, Return ); + TEST_ASSERT_EQUAL( pdTRUE, Return ); TEST_ASSERT_EQUAL( 1, NetworkInterfaceOutputFunction_Stub_Called ); TEST_ASSERT_EQUAL( tcpTCP_FLAG_ACK, pxTCPPacket->xTCPHeader.ucTCPFlags ); TEST_ASSERT_EQUAL( 0x50, pxTCPPacket->xTCPHeader.ucTCPOffset ); @@ -2579,7 +2577,7 @@ void test_prvTCPSendChallengeAck( void ) eARPGetCacheEntry_ReturnThruPtr_ppxEndPoint( &pxEndPoint ); Return = prvTCPSendChallengeAck( pxNetworkBuffer ); - TEST_ASSERT_EQUAL( pdFALSE, Return ); + TEST_ASSERT_EQUAL( pdTRUE, Return ); TEST_ASSERT_EQUAL( 1, NetworkInterfaceOutputFunction_Stub_Called ); TEST_ASSERT_EQUAL( tcpTCP_FLAG_ACK, pxTCPPacket->xTCPHeader.ucTCPFlags ); TEST_ASSERT_EQUAL( 0x50, pxTCPPacket->xTCPHeader.ucTCPOffset ); @@ -2615,7 +2613,7 @@ void test_prvTCPSendReset( void ) Return = prvTCPSendReset( pxNetworkBuffer ); TEST_ASSERT_EQUAL( 1, NetworkInterfaceOutputFunction_Stub_Called ); - TEST_ASSERT_EQUAL( pdFALSE, Return ); + TEST_ASSERT_EQUAL( pdTRUE, Return ); TEST_ASSERT_EQUAL( tcpTCP_FLAG_ACK | tcpTCP_FLAG_RST, pxTCPPacket->xTCPHeader.ucTCPFlags ); TEST_ASSERT_EQUAL( 0x50, pxTCPPacket->xTCPHeader.ucTCPOffset ); } diff --git a/test/unit-test/FreeRTOS_TCP_Transmission_IPv6/FreeRTOS_TCP_Transmission_IPv6_utest.c b/test/unit-test/FreeRTOS_TCP_Transmission_IPv6/FreeRTOS_TCP_Transmission_IPv6_utest.c index a2d8f82a23..47de8b883d 100644 --- a/test/unit-test/FreeRTOS_TCP_Transmission_IPv6/FreeRTOS_TCP_Transmission_IPv6_utest.c +++ b/test/unit-test/FreeRTOS_TCP_Transmission_IPv6/FreeRTOS_TCP_Transmission_IPv6_utest.c @@ -552,47 +552,3 @@ void test_prvTCPPrepareConnect_IPV6_HappyPath_IPv6( void ) TEST_ASSERT_EQUAL( pdPASS, xReturn ); TEST_ASSERT_EQUAL_MEMORY( pxSocket->pxEndPoint, pxEndPoint, sizeof( NetworkEndPoint_t ) ); } - -/** - * @brief This function validates sending a TCP protocol control packet, - * when an un synchronised packet is received. - */ -void test_prvTCPSendSpecialPktHelper_IPV6( void ) -{ - NetworkBufferDescriptor_t xNetworkBuffer, * pxNetworkBuffer = &xNetworkBuffer; - TCPPacket_IPv6_t * pxTCPPacket; - uint8_t ucTCPFlags = tcpTCP_FLAG_RST; - BaseType_t xReturn; - - pxNetworkBuffer->pucEthernetBuffer = ucEthernetBuffer; - pxTCPPacket = ( ( TCPPacket_IPv6_t * ) pxNetworkBuffer->pucEthernetBuffer ); - pxTCPPacket->xTCPHeader.ucTCPFlags = 0; - - xReturn = prvTCPSendSpecialPktHelper_IPV6( pxNetworkBuffer, ucTCPFlags ); - - TEST_ASSERT_EQUAL( pdFAIL, xReturn ); - TEST_ASSERT_EQUAL( ucTCPFlags, pxTCPPacket->xTCPHeader.ucTCPFlags ); - TEST_ASSERT_EQUAL( ( ipSIZE_OF_TCP_HEADER ) << 2, pxTCPPacket->xTCPHeader.ucTCPOffset ); -} - -/** - * @brief This function validates sending a TCP protocol control packet, - * when an synchronize packet is received. - */ -void test_prvTCPSendSpecialPktHelper_IPV6_Syn( void ) -{ - NetworkBufferDescriptor_t xNetworkBuffer, * pxNetworkBuffer = &xNetworkBuffer; - TCPPacket_IPv6_t * pxTCPPacket; - uint8_t ucTCPFlags = tcpTCP_FLAG_RST; - BaseType_t xReturn; - - xNetworkBuffer.pucEthernetBuffer = ucEthernetBuffer; - pxTCPPacket = ( ( TCPPacket_IPv6_t * ) xNetworkBuffer.pucEthernetBuffer ); - pxTCPPacket->xTCPHeader.ucTCPFlags = tcpTCP_FLAG_SYN; - - xReturn = prvTCPSendSpecialPktHelper_IPV6( pxNetworkBuffer, ucTCPFlags ); - - TEST_ASSERT_EQUAL( pdFAIL, xReturn ); - TEST_ASSERT_EQUAL( ucTCPFlags, pxTCPPacket->xTCPHeader.ucTCPFlags ); - TEST_ASSERT_EQUAL( ( ipSIZE_OF_TCP_HEADER ) << 2, pxTCPPacket->xTCPHeader.ucTCPOffset ); -}