ulApplicationGetNextSequenceNumber undefined

thomasnauw wrote on Tuesday, August 28, 2018:

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 FreeRTOS_TCP_IP.c is undefined. It is defined in FreeRTOS_TCP_IP.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

rtel wrote on Tuesday, August 28, 2018:

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
extern uint32_t ulApplicationGetNextSequenceNumber( uint32_t 
     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:

Also, if you are using a version of FreeRTOS prior to V10.1.0 you will
also need to set configENABLE_BACKWARD_COMPATIBILITY to 1 in

heinbali01 wrote on Tuesday, August 28, 2018:

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.