ulApplicationGetNextSequenceNumber undefined

I’m porting FreeRTOS V10.1.0 and FreeRTOS +TCP V2.0.7 to our STM32F217. I’m now having an issue that doesn’t seem to be documented. ulApplicationGetNextSequenceNumber, used in FreeRTOSTCPIP.c is undefined. It is defined in FreeRTOSTCPIP.c as an external function. The only info I can find is commented: “Generate a randomized TCP Initial Sequence Number per RFC.” Problem seems to be the same in the examples. Some help will be needed. Thank you. Best regards Thomas

ulApplicationGetNextSequenceNumber undefined

The change improves security by enabling less predictability of sequence numbers – abut apologies – it seems the update to the demo application that demonstrated how to do this somehow got reverted and didn’t make it into the release – the docs also need updating. In the mean time, if you want a quick and dirty implementation of ulApplicationGetNextSequenceNumber() you can ignore the input parameters and just return a random number, thus:
/*
* Callback that provides the inputs necessary to generate a randomized TCP
* Initial Sequence Number per RFC 6528.  In this case just a psuedo random
* number is used so THIS IS NOT RECOMMENDED FOR PRODUCTION SYSTEMS.
*/
extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t 
ulSourceAddress,
     uint16_t usSourcePort,
     uint32_t ulDestinationAddress,
     uint16_t usDestinationPort )
{
     ( void ) ulSourceAddress;
     ( void ) usSourcePort;
     ( void ) ulDestinationAddress;
     ( void ) usDestinationPort;

     return uxRand();
}
If you want a full implementation as per the RFC then have a look here, although this implementation has dependencies on other libraries it gives a reference: https://github.com/aws/amazon-freertos/blob/master/lib/securesockets/portable/freertosplustcp/awssecure_sockets.c#L625 Also, if you are using a version of FreeRTOS prior to V10.1.0 you will also need to set configENABLEBACKWARDCOMPATIBILITY to 1 in FreeRTOSConfig.h.

ulApplicationGetNextSequenceNumber undefined

Another remark, in addition to what Richard is writing: if you define your own version of uxRand(), please make sure that the seed gets a random value after each reboot. You may use a randomiser peripheral in the CPU, or measure some analogue input, or the current time ( if you have ) to generate a random seed.