Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[firefly-linux-kernel-4.4.55.git] / net / ipv4 / tunnel4.c
index 0d7d386dac2287bbfb9ef42ec6bbf0d83bb5073f..8d30c48f090e59dd9ac96b40252b0ac4c9099246 100644 (file)
@@ -8,6 +8,8 @@
 #include <linux/mutex.h>
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
+#include <net/icmp.h>
+#include <net/ip.h>
 #include <net/protocol.h>
 #include <net/xfrm.h>
 
@@ -70,10 +72,16 @@ static int tunnel4_rcv(struct sk_buff *skb)
 {
        struct xfrm_tunnel *handler;
 
+       if (!pskb_may_pull(skb, sizeof(struct iphdr)))
+               goto drop;
+
        for (handler = tunnel4_handlers; handler; handler = handler->next)
                if (!handler->handler(skb))
                        return 0;
 
+       icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
+
+drop:
        kfree_skb(skb);
        return 0;
 }