From owner-freebsd-net@FreeBSD.ORG Tue Jun 7 21:29:28 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 D038C16A41C for ; Tue, 7 Jun 2005 21:29:28 +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 97F6743D55 for ; Tue, 7 Jun 2005 21:29:28 +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 2F6E57A403; Tue, 7 Jun 2005 14:29:28 -0700 (PDT) Message-ID: <42A611B8.7040102@elischer.org> Date: Tue, 07 Jun 2005 14:29:28 -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: Charles Swiger References: <42A5BCEB.8020109@kuhtz.com> <42A5D5DE.2010407@elischer.org> <70FFA13A-E2C1-4CCE-B430-F948EECC1B96@mac.com> In-Reply-To: <70FFA13A-E2C1-4CCE-B430-F948EECC1B96@mac.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Christian Kuhtz , 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 21:29:28 -0000 Charles Swiger wrote: > On Jun 7, 2005, at 1:14 PM, Julian Elischer wrote: > >>> 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. > > > I agree with your suggestion, but how can you have an ip_vhl of > 0x42? Doesn't a valid IP packet need to have a header length of at > least 5 (5 << 2 == 20 bytes)? > huh? the first byte of an IP packet is not the length.. the first byte you see on a packet trace will be the 4 bit version followed by a 4 bit HEADER length, followed by 8 bits of TOS (type of Service) and 16 bits of total packet length. you need to change the 16 bit value.. (it's in big-endian format.. beware)