]> git.hungrycats.org Git - linux/commit
[IPV4/IPV6]: Fix suboptimal fragment sizing for last fragment
authorPatrick McHardy <kaber@trash.net>
Thu, 2 Sep 2004 07:26:24 +0000 (00:26 -0700)
committerDavid S. Miller <davem@nuts.davemloft.net>
Thu, 2 Sep 2004 07:26:24 +0000 (00:26 -0700)
commit041d6e0468098eb2ae9fbdd96457203ae5a17719
tree54f4de4a74850d59fc93ea6d368eb7b7fc09b1f9
parent0dbf2dbb1a6a7a70c74869f047cbedc67ddc3494
[IPV4/IPV6]: Fix suboptimal fragment sizing for last fragment

Yoshifuji's recent fragment patch prevents unnecessary fragmentation
when the data can be kept in a single packet, but only for the first
packet. When fragmenting, all fragments are still truncated to
multiples of 8 and we might end up creating an unnecessary fragment.

This dump shows the problem (MTU 1499):

172.16.1.123.32771 > 172.16.195.3.4135: udp 2937 (frag 7066:1472@0+)
172.16.1.123 > 172.16.195.3: udp (frag 7066:1472@1472+)
172.16.1.123 > 172.16.195.3: udp (frag 7066:1@2944)

This patch always builds mtu sized fragments and truncates the previous
fragment to a multiple of 8 bytes when allocating a new one. With the
patch the dump looks like this:

172.16.1.123.32772 > 172.16.195.3.4135: udp 2937 (frag 49641:1472@0+)
172.16.1.123 > 172.16.195.3: udp (frag 49641:1473@1472)

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_output.c
net/ipv6/ip6_output.c