From owner-freebsd-questions Tue Oct 23 22:42:53 2001 Delivered-To: freebsd-questions@freebsd.org Received: from pintail.mail.pas.earthlink.net (pintail.mail.pas.earthlink.net [207.217.120.122]) by hub.freebsd.org (Postfix) with ESMTP id 0379137B401 for ; Tue, 23 Oct 2001 22:42:49 -0700 (PDT) Received: from blossom.cjclark.org (dialup-209.245.139.90.Dial1.SanJose1.Level3.net [209.245.139.90]) by pintail.mail.pas.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id WAA08304; Tue, 23 Oct 2001 22:42:38 -0700 (PDT) Received: (from cjc@localhost) by blossom.cjclark.org (8.11.6/8.11.3) id f9O5gWk06321; Tue, 23 Oct 2001 22:42:32 -0700 (PDT) (envelope-from cjc) Date: Tue, 23 Oct 2001 22:42:32 -0700 From: "Crist J. Clark" To: j mckitrick Cc: freebsd-questions@FreeBSD.ORG Subject: Re: question about mtu and fragment offset Message-ID: <20011023224232.B5743@blossom.cjclark.org> Reply-To: cjclark@alum.mit.edu References: <20011019134824.A9949@dogma.freebsd-uk.eu.org> <20011022225420.E364@blossom.cjclark.org> <20011024010617.A50480@dogma.freebsd-uk.eu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011024010617.A50480@dogma.freebsd-uk.eu.org>; from jcm@freebsd-uk.eu.org on Wed, Oct 24, 2001 at 01:06:17AM +0100 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Oct 24, 2001 at 01:06:17AM +0100, j mckitrick wrote: > On Mon, Oct 22, 2001 at 10:54:21PM -0700, Crist J. Clark wrote: > | On Fri, Oct 19, 2001 at 01:48:24PM +0100, j mckitrick wrote: > | > > | > This is for a class project :-) > | > > | > If the mtu of a gateway is 1500, does that mean all fragments larger > | > than this will be broken into packets of 1500 (20 header, 1480 data) or > | > packets of 1496 (20 header, 1476 data) since the fragment offset must be > | > even multiples of 8? > | > | 1500. 1480 is a multiple of 8 last time I checked. > > Okay, I took my time and thought about it to make sure I phrased my > answer correctly. As I understand it, the fragment offset equals the > length of the entire datagram, not just the data. Nope. > So, if a gateway has > an mtu of 1500, since the offset must be a multiple of 8, and 1500/8 is > not even, then the total datagram length could be no more than 1496. If > the header is 20 bytes, that leaves 1476 for data. Even though 1480 is > a multiple of 8, 1500 is not. So 1480 + 20 header bytes would still be > a non-integer number of octets. Am I wrong? Or what have I > misunderstood? The offset field indicates where the data portion of the current fragment datagram lies in the original "complete" datagram. Say we have a 5001 byte (20 bytes of header and 4981 bytes of data) datagram that needs to cross a 1500 MTU network. The fragment datagram will have a 20-byte header too, so we can put 1480 bytes of the data in it. The next fragment will contain data that starts at that 1480-byte offset from the start of the original datagram. The header is _not_ included in offset calculation. The result will be something like, frag # offset bytes of data total datagram length 1: 0 1480 1500 2: 1480 1480 1500 3: 2960 1480 1500 4: 4440 541 561 For kicks, let's actually watch this. # ping -s 4973 blossom The size of 4973 byes is used since the ICMP header is an extra 8 bytes of IP data. 22:39:58.567281 192.168.64.60 > 192.168.64.50: icmp: echo request (frag 29193:1480@0+) (ttl 64, len 1500) 22:39:58.567298 192.168.64.60 > 192.168.64.50: (frag 29193:1480@1480+) (ttl 64, len 1500) 22:39:58.567312 192.168.64.60 > 192.168.64.50: (frag 29193:1480@2960+) (ttl 64, len 1500) 22:39:58.567317 192.168.64.60 > 192.168.64.50: (frag 29193:541@4440) (ttl 64, len 561) And my math checks! :) -- Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message