From df2c754c4e0c2d7b5356ba71c03a76d32c8dcab0 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Wed, 23 Oct 2013 10:28:17 +0000 Subject: [PATCH] Ensure the private port number wrap check is inside the critical section in prvGetPrivatePortNumber() (UDP). Add missing default values for some of the trace macros. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2074 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../FreeRTOS-Plus-UDP/FreeRTOS_Sockets.c | 18 ++++++++++-------- .../include/IPTraceMacroDefaults.h | 19 ++++++++++++++++++- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_Sockets.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_Sockets.c index 4ce79b1c4..5c9ff73de 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_Sockets.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_Sockets.c @@ -932,17 +932,19 @@ uint16_t usReturn; /* Assign the next port in the range. */ taskENTER_CRITICAL(); + { usNextPortToUse++; - taskEXIT_CRITICAL(); - /* Has it overflowed? */ - if( usNextPortToUse == 0U ) - { - /* Don't go right back to the start of the dynamic/private port - range numbers as any persistent sockets are likely to have been - create first so the early port numbers may still be in use. */ - usNextPortToUse = socketAUTO_PORT_ALLOCATION_RESET_NUMBER; + /* Has it overflowed? */ + if( usNextPortToUse == 0U ) + { + /* Don't go right back to the start of the dynamic/private port + range numbers as any persistent sockets are likely to have been + create first so the early port numbers may still be in use. */ + usNextPortToUse = socketAUTO_PORT_ALLOCATION_RESET_NUMBER; + } } + taskEXIT_CRITICAL(); usReturn = FreeRTOS_htons( usNextPortToUse ); diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/IPTraceMacroDefaults.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/IPTraceMacroDefaults.h index 892ba111f..29b42df4e 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/IPTraceMacroDefaults.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/include/IPTraceMacroDefaults.h @@ -164,7 +164,7 @@ http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/UDP_IP_Trace.shtml */ #endif #ifndef iptraceWAITING_FOR_TX_DMA_DESCRIPTOR - #define iptraceWAITING_FOR_TX_DMA_DESCRIPTOR + #define iptraceWAITING_FOR_TX_DMA_DESCRIPTOR() #endif #ifndef ipconfigINCLUDE_EXAMPLE_FREERTOS_PLUS_TRACE_CALLS @@ -174,4 +174,21 @@ http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/UDP_IP_Trace.shtml */ #ifndef iptraceFAILED_TO_NOTIFY_SELECT_GROUP #define iptraceFAILED_TO_NOTIFY_SELECT_GROUP( xSocket ) #endif + +#ifndef iptraceRECVFROM_TIMEOUT + #define iptraceRECVFROM_TIMEOUT() +#endif + +#ifndef iptraceNO_BUFFER_FOR_SENDTO + #define iptraceNO_BUFFER_FOR_SENDTO() +#endif + +#ifndef iptraceSENDTO_SOCKET_NOT_BOUND + #define iptraceSENDTO_SOCKET_NOT_BOUND() +#endif + +#ifndef iptraceSENDTO_DATA_TOO_LONG + #define iptraceSENDTO_DATA_TOO_LONG() +#endif + #endif /* UDP_TRACE_MACRO_DEFAULTS_H */ -- 2.39.5