IP fragmentation
Bjoern A. Zeeb
bzeeb-lists at lists.zabbadoz.net
Sun Nov 23 09:50:13 PST 2008
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.
More information about the freebsd-net
mailing list