]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - net/ipv4/icmp.c
Merge tag 'stable/for-linus-3.9-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel...
[mirror_ubuntu-bionic-kernel.git] / net / ipv4 / icmp.c
index 17ff9fd7cddab0db42c718173cfd85a9586d6d16..3ac5dff7962755166b26e1b96f7c775d28508a16 100644 (file)
@@ -934,6 +934,29 @@ error:
        goto drop;
 }
 
+void icmp_err(struct sk_buff *skb, u32 info)
+{
+       struct iphdr *iph = (struct iphdr *)skb->data;
+       struct icmphdr *icmph = (struct icmphdr *)(skb->data+(iph->ihl<<2));
+       int type = icmp_hdr(skb)->type;
+       int code = icmp_hdr(skb)->code;
+       struct net *net = dev_net(skb->dev);
+
+       /*
+        * Use ping_err to handle all icmp errors except those
+        * triggered by ICMP_ECHOREPLY which sent from kernel.
+        */
+       if (icmph->type != ICMP_ECHOREPLY) {
+               ping_err(skb, info);
+               return;
+       }
+
+       if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED)
+               ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_ICMP, 0);
+       else if (type == ICMP_REDIRECT)
+               ipv4_redirect(skb, net, 0, 0, IPPROTO_ICMP, 0);
+}
+
 /*
  *     This table is the definition of how we handle ICMP.
  */