How to detect TCP sequence number wrap around in a netfilter kernel module
I am wrtiting a netfilter based kernel module to play around with
TCP. My module is on server application side and client connect to
I am trying to keep last acknowledged numbers (most recent) for
both side of channel.
Currently i am using simpel check like if (last_ack <
new_ack_num ) && packet has ACK flag set, then update my last_ack .
So trying to update my last_ack only when i see *new* /next ack . But
this is not going to work if seq/ack numbers gets wrapped around.
because my condition should be exactly reversed of original and
should be (last_ack > new_ack_num). Till i see all the
acknowlegements upto FFFFFFFF and after that again it can be
(last_ack < new_ack_num ).
But i do not know how this can be done ?? Simple arithmatic does not
seem to help .(Correct me if i am wrong). Looks like i need to use
some mechanism that TCP uses to detect SEQ number wrap around. But
again i do not know peer are using 2 different TCP implementation
which DETECTION scheme is used by TCP.(to detect SEQ number wrap
around ). Is there anything that some RFC enforces and all TCP
implemenations adhere to it.
I need a way to detect this wrap around and change my checking
Anything u wud like to tell me ??