Skip to content

Commit 33f99dc

Browse files
klassertdavem330
authored andcommitted
ipv4: Fix packet size calculation in __ip_append_data
Git commit 59104f0 (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 59104f0. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d6fe5f4 commit 33f99dc

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

net/ipv4/ip_output.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -888,12 +888,9 @@ static int __ip_append_data(struct sock *sk,
888888
* because we have no idea what fragment will be
889889
* the last.
890890
*/
891-
if (datalen == length + fraggap) {
891+
if (datalen == length + fraggap)
892892
alloclen += rt->dst.trailer_len;
893-
/* make sure mtu is not reached */
894-
if (datalen > mtu - fragheaderlen - rt->dst.trailer_len)
895-
datalen -= ALIGN(rt->dst.trailer_len, 8);
896-
}
893+
897894
if (transhdrlen) {
898895
skb = sock_alloc_send_skb(sk,
899896
alloclen + hh_len + 15,

0 commit comments

Comments
 (0)