xfrm4: Don't call icmp_send on local error
authorSteffen Klassert <steffen.klassert@secunet.com>
Wed, 29 Jun 2011 23:20:41 +0000 (23:20 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 2 Jul 2011 00:33:19 +0000 (17:33 -0700)
Calling icmp_send() on a local message size error leads to
an incorrect update of the path mtu. So use ip_local_error()
instead to notify the socket about the error.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/xfrm4_output.c

index 2d51840e53a114be661abd42200a632b9ebf791e..327a617d594cd04929ffa668082ed575b0f54d7f 100644 (file)
@@ -32,7 +32,12 @@ static int xfrm4_tunnel_check_size(struct sk_buff *skb)
        dst = skb_dst(skb);
        mtu = dst_mtu(dst);
        if (skb->len > mtu) {
-               icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
+               if (skb->sk)
+                       ip_local_error(skb->sk, EMSGSIZE, ip_hdr(skb)->daddr,
+                                      inet_sk(skb->sk)->inet_dport, mtu);
+               else
+                       icmp_send(skb, ICMP_DEST_UNREACH,
+                                 ICMP_FRAG_NEEDED, htonl(mtu));
                ret = -EMSGSIZE;
        }
 out: