Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 May 2011 09:09:37 -0700
From:      John-Mark Gurney <jmg@funkthat.com>
To:        Cole <cole@opteqint.net>
Cc:        freebsd-net@freebsd.org
Subject:   Re: kernel module, TCP state, and mbuf question
Message-ID:  <20110506160937.GN90732@funkthat.com>
In-Reply-To: <BANLkTin__GBFkT-T90rg8StKeyYEf-vuog@mail.gmail.com>
References:  <BANLkTin__GBFkT-T90rg8StKeyYEf-vuog@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Cole wrote this message on Fri, May 06, 2011 at 15:49 +0200:
> Im currently working on a kernel module to modify data on tcp sessions
> leaving and coming into the box. And I have this working. However I've
> run into the issue where I am now breaking the TCP state.
> When I modify the data in the tcp packets, the size of that data may
> change, meaning that I have to then update the packet size and so
> forth. Now this works for the first packet with data inside it, but
> the rest of the packets leaving on this TCP stream then have the error
> where their sequence number is now wrong. i.e. If I modify the data,
> and the new data size is then less than that of the original packet,
> that means the next sequence number of the out going packet will
> actually be higher than it should be, and the other side will think it
> has missed a packet somewhere.

Why not keep a delta sequence number and always update the sequence
number by this delta?  Where the delta is the number of bytes
added/removed from the stream?

Seems easier than reaching into the TCP structure.

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110506160937.GN90732>