From owner-freebsd-net@FreeBSD.ORG Tue Jun 7 17:14:06 2005 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 79D4C16A41C for ; Tue, 7 Jun 2005 17:14:06 +0000 (GMT) (envelope-from julian@elischer.org) Received: from bigwoop.vicor-nb.com (bigwoop.vicor-nb.com [208.206.78.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4838543D5C for ; Tue, 7 Jun 2005 17:14:06 +0000 (GMT) (envelope-from julian@elischer.org) Received: from [208.206.78.97] (julian.vicor-nb.com [208.206.78.97]) by bigwoop.vicor-nb.com (Postfix) with ESMTP id 1D3CA7A403; Tue, 7 Jun 2005 10:14:06 -0700 (PDT) Message-ID: <42A5D5DE.2010407@elischer.org> Date: Tue, 07 Jun 2005 10:14:06 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.7) Gecko/20050423 X-Accept-Language: en, hu MIME-Version: 1.0 To: Christian Kuhtz References: <42A5BCEB.8020109@kuhtz.com> In-Reply-To: <42A5BCEB.8020109@kuhtz.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org Subject: Re: divert sock api q 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, 07 Jun 2005 17:14:06 -0000 Christian Kuhtz wrote: > > Hello, > > I'm using the DIVERT socket API for a proof of concept lab setup here, > and I could use some help.. > > Two boxes are involved, packets traverse both in series. The first > one, lets call her A, is taking the UDP packet off the wire, inserts a > few bytes after the UDP header, and sticks it back on the wire. The > second machine, lets call her B, grabs the packet as it comes in, > strips the bytes we inserted, and sticks it back on the wire. > > Or so goes the theory. > > What I'm running into is the following.. When I sendto() the modified > frame on A, the size is correctly reported as what the frame was > modified to be. When the frame arrives on B, I only recvfrom() as > many bytes as the virgin packet used to be when it entered A prior to > the modification. > > Anyone have any idea what's going on here and how to fix this length > mismatch? I thought the API updates the length when the frame is > sent, and sendto() does report the correct length.. > > I apologize for being so exceptionally dense, this is driving me > completely up the walls.. if you are receiving the entire IP packet in user space (first byte is 0x42 or 0x45 usually) then you need to update teh packet length field of the IP packet, as well as changing the number of bytes written back. > > Regards, > Christian > > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"