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.
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();
}
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.