diff options
author | Pravin B Shelar <pshelar@nicira.com> | 2013-02-22 02:30:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-02-25 15:47:41 -0500 |
commit | 490ab08127cebc25e3a260a74556b56ce5f47c0f (patch) | |
tree | 61a662927a56a72ae7d567728edae1ce2bc9c8c5 /include | |
parent | 2bedc2e65bf58676afc4b380617327e018a97270 (diff) |
IP_GRE: Fix IP-Identification.
GRE-GSO generates ip fragments with id 0,2,3,4... for every
GSO packet, which is not correct. Following patch fixes it
by setting ip-header id unique id of fragments are allowed.
As Eric Dumazet suggested it is optimized by using inner ip-header
whenever inner packet is ipv4.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/ipip.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/net/ipip.h b/include/net/ipip.h index 21947cf4fa46..fd19625ff99d 100644 --- a/include/net/ipip.h +++ b/include/net/ipip.h | |||
@@ -71,4 +71,21 @@ static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | static inline void tunnel_ip_select_ident(struct sk_buff *skb, | ||
75 | const struct iphdr *old_iph, | ||
76 | struct dst_entry *dst) | ||
77 | { | ||
78 | struct iphdr *iph = ip_hdr(skb); | ||
79 | |||
80 | if (iph->frag_off & htons(IP_DF)) | ||
81 | iph->id = 0; | ||
82 | else { | ||
83 | /* Use inner packet iph-id if possible. */ | ||
84 | if (skb->protocol == htons(ETH_P_IP) && old_iph->id) | ||
85 | iph->id = old_iph->id; | ||
86 | else | ||
87 | __ip_select_ident(iph, dst, | ||
88 | (skb_shinfo(skb)->gso_segs ?: 1) - 1); | ||
89 | } | ||
90 | } | ||
74 | #endif | 91 | #endif |