From owner-freebsd-net@FreeBSD.ORG Tue May 17 12:22:17 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A81A106564A for ; Tue, 17 May 2011 12:22:17 +0000 (UTC) (envelope-from cole@opteqint.net) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 72B748FC18 for ; Tue, 17 May 2011 12:22:17 +0000 (UTC) Received: by iwn33 with SMTP id 33so500921iwn.13 for ; Tue, 17 May 2011 05:22:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.208.142 with SMTP id gc14mr382732ibb.115.1305634936736; Tue, 17 May 2011 05:22:16 -0700 (PDT) Received: by 10.231.14.2 with HTTP; Tue, 17 May 2011 05:22:16 -0700 (PDT) X-Originating-IP: [196.215.107.196] Date: Tue, 17 May 2011 14:22:16 +0200 Message-ID: From: Cole To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Kern Mod and TCP retrasmit problem X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2011 12:22:17 -0000 Hi. Ive written a kernel module that modifies the data of outgoing TCP packets. I use pfil_hook to insert my module into the outgoing packet stream. Depending on the data, the size of data in the TCP packet may change, either increasing or decreasing. When modifying the data size, I update the mbuf len, the pkthdr len, the size in the IP header, as well as modifying the TCP checksum. I also update the tcpcb->snd_nxt, and tcpcb->snd_max values. The problem I am having at the moment is only when I modify the packet and the data size decreases. Whenever the data size increases I dont have a problem. However, when the data size decreases, the TCP architecture tries to retransmit the missing data. i.e. if original data in the TCP packet is 30 bytes in size, and i modify it and it is now only 18 bytes in size, then the box retransmits the missing 12 bytes that it thought never got transmitted. This is where my problem lies, im trying to find out what variable or structure I need to update so that the box doesnt think that it needs to retransmit those missing bytes. Ive been looking at the tcbcb structure in netinet/tcp_var.h and I cannot seem to see any values inside this structure that point to the data size of the packet. Ive also looked at tcp_output.c and I see that theres functions that use tcpcb->sackhint to see if theres missing bytes. However when examing those in the kernel module of the outgoing packet, the pointer is always NULL. If anyone has any ideas or suggestions, I would be glad to hear. Thanks /Cole