kernel module, TCP state, and mbuf question

John-Mark Gurney jmg at funkthat.com
Fri May 6 16:24:32 UTC 2011


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."


More information about the freebsd-net mailing list