提交 33f99dc7 编写于 作者: S Steffen Klassert 提交者: David S. Miller

ipv4: Fix packet size calculation in __ip_append_data

Git commit 59104f06 (ip: take care of last fragment in ip_append_data)
added a check to see if we exceed the mtu when we add trailer_len.
However, the mtu is already subtracted by the trailer length when the
xfrm transfomation bundles are set up. So IPsec packets with mtu
size get fragmented, or if the DF bit is set the packets will not
be send even though they match the mtu perfectly fine. This patch
actually reverts commit 59104f06.
Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d6fe5f4e
...@@ -888,12 +888,9 @@ static int __ip_append_data(struct sock *sk, ...@@ -888,12 +888,9 @@ static int __ip_append_data(struct sock *sk,
* because we have no idea what fragment will be * because we have no idea what fragment will be
* the last. * the last.
*/ */
if (datalen == length + fraggap) { if (datalen == length + fraggap)
alloclen += rt->dst.trailer_len; alloclen += rt->dst.trailer_len;
/* make sure mtu is not reached */
if (datalen > mtu - fragheaderlen - rt->dst.trailer_len)
datalen -= ALIGN(rt->dst.trailer_len, 8);
}
if (transhdrlen) { if (transhdrlen) {
skb = sock_alloc_send_skb(sk, skb = sock_alloc_send_skb(sk,
alloclen + hh_len + 15, alloclen + hh_len + 15,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册