Date: Fri, 6 May 2011 15:49:15 +0200 From: Cole <cole@opteqint.net> To: freebsd-net@freebsd.org Subject: kernel module, TCP state, and mbuf question Message-ID: <BANLkTin__GBFkT-T90rg8StKeyYEf-vuog@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi. 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. In my kernel module I am using pfil_add_hook to hook into the outgoing packets, and from there I am inspecting and modifying the packets as needed. My function definition for the function I pass to pfil_add_hook is the default one as follows: chkoutput(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, struct inpcb *inp) I was wondering if it is possible to somehow get access to the TCP state for the tcp stream for the mbuf/packet I have received and if I can modify the th_seq to match my new values, or if I will need to keep my own state information for any streams I modify and then update the outgoing packets th_seq values as needed? Any information or help will be gladly appreciated. Regards /Cole
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTin__GBFkT-T90rg8StKeyYEf-vuog>