[En-Nut-Discussion] local tcp port randomisation
harald.kipp at egnite.de
Tue Jul 3 16:30:33 CEST 2012
On 03.07.2012 16:13, Nathan Moore wrote:
> Is there any reason not to just use the negative port numbers (if you
> interpret them as signed int so top bit = 1) as the ephemeral ports?
> The range testing is greatly simplified.
Let me resend my code fragment:
ticks = (uint16_t) NutGetMillis();
port = ticks;
port += ticks & 0x000F;
port |= 0xC000;
Where do you think that signed interpretation combined with a increased range of 32768 to 65535 could simplify the code above. Note, that the IANA range of 49152 to 65535 includes all shorts with two MSBs set.
More information about the En-Nut-Discussion