TCP sequence number wraparound (sequence wraparound) and solution

Initial Sequence Number (ISN) from a tcp stream is not zero, but the use of certain random algorithm generated ISN therefore be large (for example, (32-10 ^ 2)), and therefore the same flow seq tcp numbers may wrap around to 0. We tcp and scrambled packet loss issues are dependent on the comparison of the determined sequence number size. At this point there have been so-called tcp serial number rewind (sequence wraparound) problem.

Core Solution
serial number given in the kernel (serial number rewind solve the problem) Solution judgment is very simple:

/*
* The next routines deal with comparing 32 bit unsigned ints
* and worry about wraparound (automatic with unsigned arithmetic).
*/
static inline int before(__u32 seq1, __u32 seq2)
{
return (__s32)(seq1-seq2) < 0;
}
#define after(seq2, seq1) before(seq1, seq2)

https://blog.csdn.net/hi_software/article/details/51768026

He published 187 original articles · won praise 14 · views 40000 +

Guess you like

Origin blog.csdn.net/LU_ZHAO/article/details/105010778