From owner-freebsd-net@FreeBSD.ORG Sun Nov 23 17:50:13 2008 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 A158E1065672 for ; Sun, 23 Nov 2008 17:50:13 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27]) by mx1.freebsd.org (Postfix) with ESMTP id 5DD618FC17 for ; Sun, 23 Nov 2008 17:50:13 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from localhost (amavis.str.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 320E341C705; Sun, 23 Nov 2008 18:50:11 +0100 (CET) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([62.111.66.27]) by localhost (amavis.str.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id Bg+UmxD6gXjJ; Sun, 23 Nov 2008 18:50:07 +0100 (CET) Received: by mail.cksoft.de (Postfix, from userid 66) id EEECF41C70C; Sun, 23 Nov 2008 18:50:06 +0100 (CET) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id A62AA444902; Sun, 23 Nov 2008 17:45:23 +0000 (UTC) Date: Sun, 23 Nov 2008 17:45:23 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Eitan Shefi In-Reply-To: <5D49E7A8952DC44FB38C38FA0D758EAD0105450B@mtlexch01.mtl.com> Message-ID: <20081123173627.V61259@maildrop.int.zabbadoz.net> References: <5D49E7A8952DC44FB38C38FA0D758EAD0105450B@mtlexch01.mtl.com> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-net@freebsd.org Subject: Re: IP fragmentation 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: Sun, 23 Nov 2008 17:50:13 -0000 On Sun, 23 Nov 2008, Eitan Shefi wrote: > Hi, > > The IP fragmentation is not like in Linux, and is not clear to me. > > I'm using 2 FreeBSD-6.3 hosts, connected directly. > If I change the MTU of both hosts to 5000, and send "ping" with message > size 4972 bytes ( 4972 = 5000 - 8(which is ICMP Header size) - 20 (which > is IP Header size) ) > from one host to the other, the message is passed as one packet: packet > size 5000 bytes. (as expected) > But if I send "ping" with message size 4973 bytes, the IP fragmentation > to 2 packets is not clear to me: > The first packet is with size: 4116 bytes > The second packet is with size: 905 bytes 4116 = 4096 + 20 20 usually is the size of the IP header 4096 most likely is your PAGE_SIZE I expected the first packet size to be: 4996 = 5000 - ((5000-20) Mod 8) > and the second packet size to be: 25 = 5021 - 4996 > > What is the formula being used in FreeBSD to compute the IP fragments > size? Try this here: http://fxr.watson.org/fxr/source/netinet/ip_output.c#L617 and see how 'len' gets adjusted. /bz -- Bjoern A. Zeeb Stop bit received. Insert coin for new game.