How to detect TCP sequence number wrap around in a netfilter kernel module

Discussion in 'Linux Networking' started by Rohit, May 10, 2007.

  1. Rohit

    Rohit Guest

    Hi All,
    I am wrtiting a netfilter based kernel module to play around with
    TCP. My module is on server application side and client connect to
    it.

    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
    conditions accordingly.

    Anything u wud like to tell me ??

    Thanks ,
    Rohit
     
    Rohit, May 10, 2007
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.