This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / net / ipv4 / xfrm4_tunnel.c
index 0d1a0b0..0999f9e 100644 (file)
@@ -6,7 +6,32 @@
 #include <linux/skbuff.h>
 #include <net/xfrm.h>
 #include <net/ip.h>
-#include <net/protocol.h>
+#include <net/icmp.h>
+#include <net/inet_ecn.h>
+
+int xfrm4_tunnel_check_size(struct sk_buff *skb)
+{
+       int mtu, ret = 0;
+       struct dst_entry *dst;
+       struct iphdr *iph = skb->nh.iph;
+
+       if (IPCB(skb)->flags & IPSKB_XFRM_TUNNEL_SIZE)
+               goto out;
+
+       IPCB(skb)->flags |= IPSKB_XFRM_TUNNEL_SIZE;
+       
+       if (!(iph->frag_off & htons(IP_DF)))
+               goto out;
+
+       dst = skb->dst;
+       mtu = dst_pmtu(dst) - dst->header_len - dst->trailer_len;
+       if (skb->len > mtu) {
+               icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
+               ret = -EMSGSIZE;
+       }
+out:
+       return ret;
+}
 
 static int ipip_output(struct sk_buff **pskb)
 {