IP_GRE: Fix IP-Identification.
[linux-2.6-block.git] / include / net / ipip.h
index 21947cf4fa4678f5cb301ec29ddb65b74492a6d6..fd19625ff99db290fd289b3caf18f32c9b72ffc3 100644 (file)
@@ -71,4 +71,21 @@ static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev)
        }
 }
 
+static inline void tunnel_ip_select_ident(struct sk_buff *skb,
+                                         const struct iphdr  *old_iph,
+                                         struct dst_entry *dst)
+{
+       struct iphdr *iph = ip_hdr(skb);
+
+       if (iph->frag_off & htons(IP_DF))
+               iph->id = 0;
+       else {
+               /* Use inner packet iph-id if possible. */
+               if (skb->protocol == htons(ETH_P_IP) && old_iph->id)
+                       iph->id = old_iph->id;
+               else
+                       __ip_select_ident(iph, dst,
+                                         (skb_shinfo(skb)->gso_segs ?: 1) - 1);
+       }
+}
 #endif