Skip to content

Commit adfb1d1

Browse files
Merge branch 'main' into dev-stm32
2 parents f737291 + cad1f75 commit adfb1d1

30 files changed

+1127
-474
lines changed

.github/.cSpellWords.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ DIVIDEBY
248248
DIVIDEDBY
249249
DLPSTATE
250250
DMAARBITRATION
251+
DMAB
251252
DMABD
252253
DMABMR
253254
DMAC
@@ -1577,6 +1578,7 @@ x
15771578
xaxiemacif
15781579
XCOL
15791580
xemac
1581+
XEMACMAP
15801582
xemacps
15811583
XEMACPS
15821584
xemacpsp

source/FreeRTOS_ARP.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ static BaseType_t prvFindCacheEntry( const MACAddress_t * pxMACAddress,
979979
if( pxEndPoint != NULL )
980980
{
981981
/* For multi-cast, use the first IPv4 end-point. */
982-
memcpy( pxMACAddress->ucBytes, pxEndPoint->xMACAddress.ucBytes, sizeof( pxMACAddress->ucBytes ) );
982+
( void ) memcpy( pxMACAddress->ucBytes, pxEndPoint->xMACAddress.ucBytes, sizeof( pxMACAddress->ucBytes ) );
983983
*( ppxEndPoint ) = pxEndPoint;
984984
eReturn = eARPCacheHit;
985985
}

source/FreeRTOS_DNS.c

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -63,41 +63,45 @@ const MACAddress_t xLLMNR_MacAddress = { { 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfc }
6363
/** @brief The IPv6 link-scope multicast MAC address */
6464
const MACAddress_t xLLMNR_MacAddressIPv6 = { { 0x33, 0x33, 0x00, 0x01, 0x00, 0x03 } };
6565

66+
#if ( ( ipconfigUSE_LLMNR != 0 ) && ( ipconfigUSE_IPv6 != 0 ) )
6667
/** @brief The IPv6 link-scope multicast address */
67-
const IPv6_Address_t ipLLMNR_IP_ADDR_IPv6 =
68-
{
69-
{ /* ff02::1:3 */
70-
0xff, 0x02,
71-
0x00, 0x00,
72-
0x00, 0x00,
73-
0x00, 0x00,
74-
0x00, 0x00,
75-
0x00, 0x00,
76-
0x00, 0x01,
77-
0x00, 0x03,
78-
}
79-
};
68+
const IPv6_Address_t ipLLMNR_IP_ADDR_IPv6 =
69+
{
70+
{ /* ff02::1:3 */
71+
0xff, 0x02,
72+
0x00, 0x00,
73+
0x00, 0x00,
74+
0x00, 0x00,
75+
0x00, 0x00,
76+
0x00, 0x00,
77+
0x00, 0x01,
78+
0x00, 0x03,
79+
}
80+
};
81+
#endif /* ( ( ipconfigUSE_LLMNR != 0 ) && ( ipconfigUSE_IPv6 != 0 ) ) */
8082

8183
/** @brief The MAC address used for MDNS. */
8284
const MACAddress_t xMDNS_MacAddress = { { 0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb } };
8385

8486
/** @brief The IPv6 multicast DNS MAC address. */
8587
const MACAddress_t xMDNS_MacAddressIPv6 = { { 0x33, 0x33, 0x00, 0x00, 0x00, 0xFB } };
8688

89+
#if ( ( ipconfigUSE_MDNS != 0 ) && ( ipconfigUSE_IPv6 != 0 ) )
8790
/** @brief multicast DNS IPv6 address */
88-
const IPv6_Address_t ipMDNS_IP_ADDR_IPv6 =
89-
{
90-
{ /* ff02::fb */
91-
0xff, 0x02,
92-
0x00, 0x00,
93-
0x00, 0x00,
94-
0x00, 0x00,
95-
0x00, 0x00,
96-
0x00, 0x00,
97-
0x00, 0x00,
98-
0x00, 0xfb,
99-
}
100-
};
91+
const IPv6_Address_t ipMDNS_IP_ADDR_IPv6 =
92+
{
93+
{ /* ff02::fb */
94+
0xff, 0x02,
95+
0x00, 0x00,
96+
0x00, 0x00,
97+
0x00, 0x00,
98+
0x00, 0x00,
99+
0x00, 0x00,
100+
0x00, 0x00,
101+
0x00, 0xfb,
102+
}
103+
};
104+
#endif /* ( ( ipconfigUSE_MDNS != 0 ) && ( ipconfigUSE_IPv6 != 0 ) ) */
101105

102106
/* Exclude the entire file if DNS is not enabled. */
103107
#if ( ipconfigUSE_DNS != 0 )

source/FreeRTOS_IP.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ BaseType_t FreeRTOS_IPInit_Multi( void )
982982
{
983983
static StaticTask_t xIPTaskBuffer;
984984
static StackType_t xIPTaskStack[ ipconfigIP_TASK_STACK_SIZE_WORDS ];
985-
xIPTaskHandle = xTaskCreateStatic( prvIPTask,
985+
xIPTaskHandle = xTaskCreateStatic( &prvIPTask,
986986
"IP-Task",
987987
ipconfigIP_TASK_STACK_SIZE_WORDS,
988988
NULL,
@@ -997,7 +997,7 @@ BaseType_t FreeRTOS_IPInit_Multi( void )
997997
}
998998
#else /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
999999
{
1000-
xReturn = xTaskCreate( prvIPTask,
1000+
xReturn = xTaskCreate( &prvIPTask,
10011001
"IP-task",
10021002
ipconfigIP_TASK_STACK_SIZE_WORDS,
10031003
NULL,

source/FreeRTOS_IPv4.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,7 @@ enum eFrameProcessingResult prvAllowIPPacketIPv4( const struct xIP_PACKET * cons
321321
( FreeRTOS_FindEndPointOnIP_IPv4( ulDestinationIPAddress ) == NULL ) &&
322322
/* Is it an IPv4 broadcast address x.x.x.255 ? */
323323
( ( FreeRTOS_ntohl( ulDestinationIPAddress ) & 0xffU ) != 0xffU ) &&
324-
( xIsIPv4Multicast( ulDestinationIPAddress ) == pdFALSE ) &&
325-
/* Or (during DHCP negotiation) we have no IP-address yet? */
326-
( FreeRTOS_IsNetworkUp() != pdFALSE ) )
324+
( xIsIPv4Multicast( ulDestinationIPAddress ) == pdFALSE ) )
327325
{
328326
/* Packet is not for this node, release it */
329327
eReturn = eReleaseBuffer;

source/FreeRTOS_Routing.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,6 @@ struct xIPv6_Couple
388388
#endif
389389
{
390390
if( ( ulIPAddress == 0U ) ||
391-
( pxEndPoint->ipv4_settings.ulIPAddress == 0U ) ||
392391
( pxEndPoint->ipv4_settings.ulIPAddress == ulIPAddress ) )
393392
{
394393
break;

source/FreeRTOS_TCP_State_Handling.c

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,8 @@
584584
{
585585
/* Peer is requesting to stop, see if we're really finished. */
586586
xMayClose = pdTRUE;
587+
ulIntermediateResult = ulSequenceNumber + ulReceiveLength - pxTCPWindow->rx.ulCurrentSequenceNumber;
588+
lDistance = ( int32_t ) ulIntermediateResult;
587589

588590
/* Checks are only necessary if we haven't sent a FIN yet. */
589591
if( pxSocket->u.xTCP.bits.bFinSent == pdFALSE_UNSIGNED )
@@ -601,22 +603,28 @@
601603
( int ) bRxComplete,
602604
( int ) bTxDone ) );
603605
xMayClose = pdFALSE;
604-
}
605-
else
606-
{
607-
ulIntermediateResult = ulSequenceNumber + ulReceiveLength - pxTCPWindow->rx.ulCurrentSequenceNumber;
608-
lDistance = ( int32_t ) ulIntermediateResult;
609606

610-
if( lDistance > 1 )
607+
/* This action is necessary to ensure proper handling of any subsequent packets that
608+
* may arrive after the refused FIN packet. Note that we only update it when the sequence
609+
* of FIN packet is correct. Otherwise, we wait for re-transmission. */
610+
if( lDistance <= 1 )
611611
{
612-
FreeRTOS_debug_printf( ( "Refusing FIN: Rx not complete %d (cur %u high %u)\n",
613-
( int ) lDistance,
614-
( unsigned ) ( pxTCPWindow->rx.ulCurrentSequenceNumber - pxTCPWindow->rx.ulFirstSequenceNumber ),
615-
( unsigned ) ( pxTCPWindow->rx.ulHighestSequenceNumber - pxTCPWindow->rx.ulFirstSequenceNumber ) ) );
616-
617-
xMayClose = pdFALSE;
612+
pxTCPWindow->rx.ulCurrentSequenceNumber = pxTCPWindow->rx.ulFINSequenceNumber + 1U;
618613
}
619614
}
615+
else if( lDistance > 1 )
616+
{
617+
FreeRTOS_debug_printf( ( "Refusing FIN: Rx not complete %d (cur %u high %u)\n",
618+
( int ) lDistance,
619+
( unsigned ) ( pxTCPWindow->rx.ulCurrentSequenceNumber - pxTCPWindow->rx.ulFirstSequenceNumber ),
620+
( unsigned ) ( pxTCPWindow->rx.ulHighestSequenceNumber - pxTCPWindow->rx.ulFirstSequenceNumber ) ) );
621+
622+
xMayClose = pdFALSE;
623+
}
624+
else
625+
{
626+
/* Empty else marker. */
627+
}
620628
}
621629

622630
if( xTCPWindowLoggingLevel > 0 )

source/include/FreeRTOS_DNS.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ extern const MACAddress_t xLLMNR_MacAddress;
4747
/* The LLMNR IPv6 MAC address is 33:33:00:01:00:03 */
4848
extern const MACAddress_t xLLMNR_MacAddressIPv6;
4949

50+
#if ( ( ipconfigUSE_LLMNR != 0 ) && ( ipconfigUSE_IPv6 != 0 ) )
5051
/* The LLMNR IPv6 address is ff02::1:3 */
51-
extern const IPv6_Address_t ipLLMNR_IP_ADDR_IPv6;
52+
extern const IPv6_Address_t ipLLMNR_IP_ADDR_IPv6;
53+
#endif /* ( ( ipconfigUSE_LLMNR != 0 ) && ( ipconfigUSE_IPv6 != 0 ) ) */
5254

5355
/* The MDNS MAC address is 01:00:5e:00:00:fc */
5456
extern const MACAddress_t xMDNS_MacAddress;
@@ -61,8 +63,10 @@ extern const MACAddress_t xMDNS_MacAddressIPv6;
6163
/* Guarantee backward compatibility. */
6264
#define xMDNS_MACAddressIPv6 xMDNS_MacAddressIPv6
6365

66+
#if ( ( ipconfigUSE_MDNS != 0 ) && ( ipconfigUSE_IPv6 != 0 ) )
6467
/* The MDNS IPv6 address is ff02::1:3 */
65-
extern const IPv6_Address_t ipMDNS_IP_ADDR_IPv6;
68+
extern const IPv6_Address_t ipMDNS_IP_ADDR_IPv6;
69+
#endif /* ( ( ipconfigUSE_MDNS != 0 ) && ( ipconfigUSE_IPv6 != 0 ) ) */
6670

6771
/** @brief While doing integration tests, it is necessary to influence the choice
6872
* between DNS/IPv4 and DNS/IPv4. Depending on this, a DNS server will be

source/portable/NetworkInterface/ATSAM4E/NetworkInterface.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@
8888
static BaseType_t xGMACWaitLS( TickType_t xMaxTime );
8989

9090
#if ( ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM == 1 ) && ( ipconfigHAS_TX_CRC_OFFLOADING == 0 )
91-
void vGMACGenerateChecksum( uint8_t * apBuffer );
91+
void vGMACGenerateChecksum( uint8_t * pucBuffer,
92+
size_t uxLength );
9293
#endif
9394

9495
/*
@@ -405,9 +406,10 @@ static BaseType_t xGMACWaitLS( TickType_t xMaxTime )
405406

406407
/*#if( ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM == 1 ) && ( ipconfigHAS_TX_CRC_OFFLOADING == 0 ) */
407408

408-
void vGMACGenerateChecksum( uint8_t * apBuffer )
409+
void vGMACGenerateChecksum( uint8_t * pucBuffer,
410+
size_t uxLength )
409411
{
410-
ProtocolPacket_t * xProtPacket = ( ProtocolPacket_t * ) apBuffer;
412+
ProtocolPacket_t * xProtPacket = ( ProtocolPacket_t * ) pucBuffer;
411413

412414
if( xProtPacket->xTCPPacket.xEthernetHeader.usFrameType == ipIPv4_FRAME_TYPE )
413415
{
@@ -419,7 +421,7 @@ void vGMACGenerateChecksum( uint8_t * apBuffer )
419421
pxIPHeader->usHeaderChecksum = ~FreeRTOS_htons( pxIPHeader->usHeaderChecksum );
420422

421423
/* Calculate the TCP checksum for an outgoing packet. */
422-
usGenerateProtocolChecksum( ( uint8_t * ) apBuffer, pdTRUE );
424+
usGenerateProtocolChecksum( ( uint8_t * ) pucBuffer, uxLength, pdTRUE );
423425
}
424426
}
425427

source/portable/NetworkInterface/ATSAM4E/gmac.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,8 @@ uint32_t gmac_dev_read( gmac_device_t * p_gmac_dev,
642642
}
643643

644644

645-
extern void vGMACGenerateChecksum( uint8_t * apBuffer );
645+
extern void vGMACGenerateChecksum( uint8_t * pucBuffer,
646+
size_t uxLength );
646647

647648
/**
648649
* \brief Send ulLength bytes from pcFrom. This copies the buffer to one of the
@@ -715,7 +716,7 @@ uint32_t gmac_dev_write( gmac_device_t * p_gmac_dev,
715716
memcpy( ( void * ) p_tx_td->addr, p_buffer, ul_size );
716717
}
717718
#endif /* ipconfigZERO_COPY_TX_DRIVER */
718-
vGMACGenerateChecksum( ( uint8_t * ) p_tx_td->addr );
719+
vGMACGenerateChecksum( ( uint8_t * ) p_tx_td->addr, ( size_t ) ul_size );
719720
}
720721

721722
#if ( GMAC_USES_TX_CALLBACK != 0 )

0 commit comments

Comments
 (0)