Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Nov 2008 17:45:23 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
To:        Eitan Shefi <eitans@mellanox.co.il>
Cc:        freebsd-net@freebsd.org
Subject:   Re: IP fragmentation 
Message-ID:  <20081123173627.V61259@maildrop.int.zabbadoz.net>
In-Reply-To: <5D49E7A8952DC44FB38C38FA0D758EAD0105450B@mtlexch01.mtl.com>
References:  <5D49E7A8952DC44FB38C38FA0D758EAD0105450B@mtlexch01.mtl.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081123173627.V61259>