Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Skptak authored Jul 20, 2023
2 parents abe3ae2 + 3e26a33 commit 7611514
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 58 deletions.
5 changes: 4 additions & 1 deletion source/FreeRTOS_ND.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,14 +573,17 @@
IPv6_Address_t xTargetIPAddress;
MACAddress_t xMultiCastMacAddress;
NetworkBufferDescriptor_t * pxDescriptor = pxNetworkBuffer;
NetworkBufferDescriptor_t * pxNewDescriptor = NULL;

if( ( pxEndPoint != NULL ) && ( pxEndPoint->bits.bIPv6 != pdFALSE_UNSIGNED ) )
{
uxNeededSize = ipSIZE_OF_ETH_HEADER + ipSIZE_OF_IPv6_HEADER + sizeof( ICMPHeader_IPv6_t );

if( pxDescriptor->xDataLength < uxNeededSize )
{
pxDescriptor = pxDuplicateNetworkBufferWithDescriptor( pxDescriptor, uxNeededSize );
pxNewDescriptor = pxDuplicateNetworkBufferWithDescriptor( pxDescriptor, uxNeededSize );
vReleaseNetworkBufferAndDescriptor( pxDescriptor );
pxDescriptor = pxNewDescriptor;
}

if( pxDescriptor != NULL )
Expand Down
5 changes: 4 additions & 1 deletion source/FreeRTOS_RA.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
NetworkBufferDescriptor_t * pxDescriptor = pxNetworkBuffer;
IPv6_Address_t xSourceAddress;
BaseType_t xHasLocal;
NetworkBufferDescriptor_t * pxNewDescriptor = NULL;

configASSERT( pxEndPoint != NULL );
configASSERT( pxEndPoint->bits.bIPv6 != pdFALSE_UNSIGNED );
Expand All @@ -156,7 +157,9 @@

if( pxDescriptor->xDataLength < uxNeededSize )
{
pxDescriptor = pxDuplicateNetworkBufferWithDescriptor( pxDescriptor, uxNeededSize );
pxNewDescriptor = pxDuplicateNetworkBufferWithDescriptor( pxDescriptor, uxNeededSize );
vReleaseNetworkBufferAndDescriptor( pxDescriptor );
pxDescriptor = pxNewDescriptor;
}

if( pxDescriptor != NULL )
Expand Down
26 changes: 13 additions & 13 deletions source/FreeRTOS_Routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,8 @@ struct xIPv6_Couple
/* This was only for debugging. */
if( pxEndPoint == NULL )
{
FreeRTOS_printf( ( "FreeRTOS_FindEndPointOnNetMask[%d]: No match for %xip\n",
( unsigned ) ulWhere, ( unsigned ) FreeRTOS_ntohl( ulIPAddress ) ) );
FreeRTOS_debug_printf( ( "FreeRTOS_FindEndPointOnNetMask[%d]: No match for %xip\n",
( unsigned ) ulWhere, ( unsigned ) FreeRTOS_ntohl( ulIPAddress ) ) );
}

return pxEndPoint;
Expand Down Expand Up @@ -766,9 +766,9 @@ struct xIPv6_Couple

if( xGatewayTarget == pdTRUE )
{
FreeRTOS_printf( ( " GW address %pip to %pip\n",
pxIPAddressFrom->xIP_IPv6.ucBytes,
pxIPAddressTo->xIP_IPv6.ucBytes ) );
FreeRTOS_debug_printf( ( " GW address %pip to %pip\n",
pxIPAddressFrom->xIP_IPv6.ucBytes,
pxIPAddressTo->xIP_IPv6.ucBytes ) );
}

xTargetGlobal = ( xIPv6_GetIPType( &( pxIPAddressTo->xIP_IPv6 ) ) == eIPv6_Global ) ? pdTRUE : pdFALSE;
Expand Down Expand Up @@ -872,13 +872,13 @@ struct xIPv6_Couple
pcBufferFrom,
sizeof( pcBufferFrom ) );

FreeRTOS_printf( ( "EasyFit[%x]: %d %d %d ( %s ->%s ) BAD\n",
usFrameType,
( unsigned ) xCount[ 0 ],
( unsigned ) xCount[ 1 ],
( unsigned ) xCount[ 2 ],
( xRetNtopFrom == NULL ) ? "INVALID" : pcBufferFrom,
( xRetNtopTo == NULL ) ? "INVALID" : pcBufferTo ) );
FreeRTOS_debug_printf( ( "EasyFit[%x]: %d %d %d ( %s ->%s ) BAD\n",
usFrameType,
( unsigned ) xCount[ 0 ],
( unsigned ) xCount[ 1 ],
( unsigned ) xCount[ 2 ],
( xRetNtopFrom == NULL ) ? "INVALID" : pcBufferFrom,
( xRetNtopTo == NULL ) ? "INVALID" : pcBufferTo ) );
}
#endif /* ( ipconfigHAS_PRINTF != 0 ) */

Expand Down Expand Up @@ -984,7 +984,7 @@ struct xIPv6_Couple
/* do nothing, coverity happy */
}

FreeRTOS_printf( ( "pxEasyFit: ARP %xip -> %xip\n", ( unsigned ) FreeRTOS_ntohl( xIPAddressFrom.ulIP_IPv4 ), ( unsigned ) FreeRTOS_ntohl( xIPAddressTo.ulIP_IPv4 ) ) );
FreeRTOS_debug_printf( ( "pxEasyFit: ARP %xip -> %xip\n", ( unsigned ) FreeRTOS_ntohl( xIPAddressFrom.ulIP_IPv4 ), ( unsigned ) FreeRTOS_ntohl( xIPAddressTo.ulIP_IPv4 ) ) );
}
xDoProcessPacket = pdTRUE;
#endif /* ( ipconfigUSE_IPv4 != 0 ) */
Expand Down
6 changes: 3 additions & 3 deletions source/portable/NetworkInterface/STM32Fxx/NetworkInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ static BaseType_t xMayAcceptPacket( uint8_t * pucEthernetBuffer )
#endif
( *ipLOCAL_IP_ADDRESS_POINTER != 0 ) )
{
FreeRTOS_printf( ( "Drop IP %lxip\n", FreeRTOS_ntohl( ulDestinationIPAddress ) ) );
FreeRTOS_debug_printf( ( "Drop IP %lxip\n", FreeRTOS_ntohl( ulDestinationIPAddress ) ) );
return pdFALSE;
}

Expand Down Expand Up @@ -1503,9 +1503,9 @@ static void prvEMACHandlerTask( void * pvParameters )

#if ( ipconfigSUPPORT_NETWORK_DOWN_EVENT != 0 )
{
if( xGetPhyLinkStatus() == pdFALSE )
if( xGetPhyLinkStatus( pxMyInterface ) == pdFALSE )
{
FreeRTOS_NetworkDown();
FreeRTOS_NetworkDown( pxMyInterface );
}
}
#endif /* ( ipconfigSUPPORT_NETWORK_DOWN_EVENT != 0 ) */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ void vMBuffNetifBackendInit( MessageBufferHandle_t * pxSendMsgBuffer,
else
{
pvContextBuffer = pvPortMalloc( sizeof( SlirpBackendContext_t ) );

if( pvContextBuffer == NULL )
{
FreeRTOS_printf( ( "Failed to allocate memory for pvContextBuffer" ) );
configASSERT( 0 );
}
}

if( pvContextBuffer != NULL )
Expand Down Expand Up @@ -472,6 +478,12 @@ static void vEnsurePollfdSize( SlirpBackendContext_t * pxCtx,
if( pxCtx->pxPollFdArray == NULL )
{
pxCtx->pxPollFdArray = ( struct pollfd * ) malloc( xNewSize * sizeof( struct pollfd ) );

if( pxCtx->pxPollFdArray == NULL )
{
FreeRTOS_printf( ( "Failed to allocate memory for pxCtx->pxPollFdArray" ) );
configASSERT( 0 );
}
}
else
{
Expand Down Expand Up @@ -518,6 +530,10 @@ static inline int lSlirpEventsToNativePollEvents( int lSlirpPollFlags )
lPosixPollFlags |= POLLHUP;
}

#if defined( _WIN32 )
lPosixPollFlags &= ~( POLLPRI | POLLERR | POLLHUP );
#endif

return lPosixPollFlags;
}

Expand Down
Loading

0 comments on commit 7611514

Please sign in to comment.