Commit 4221f405 authored by Pravin B Shelar's avatar Pravin B Shelar Committed by David S. Miller

ip_tunnel: Do not use inner ip-header-id for tunnel ip-header-id.

Using inner-id for tunnel id is not safe in some rare cases.
E.g. packets coming from multiple sources entering same tunnel
can have same id. Therefore on tunnel packet receive we
could have packets from two different stream but with same
source and dst IP with same ip-id which could confuse ip packet
reassembly.

Following patch reverts optimization from commit
490ab081 (IP_GRE: Fix IP-Identification.)

CC: Jarno Rajahalme <jrajahalme@nicira.com>
CC: Ansis Atteka <aatteka@nicira.com>
Signed-off-by: default avatarPravin B Shelar <pshelar@nicira.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 50f850fd
...@@ -145,20 +145,6 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph, ...@@ -145,20 +145,6 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph,
return INET_ECN_encapsulate(tos, inner); return INET_ECN_encapsulate(tos, inner);
} }
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);
/* 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);
}
int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
int iptunnel_xmit(struct net *net, struct rtable *rt, int iptunnel_xmit(struct net *net, struct rtable *rt,
struct sk_buff *skb, struct sk_buff *skb,
......
...@@ -76,9 +76,7 @@ int iptunnel_xmit(struct net *net, struct rtable *rt, ...@@ -76,9 +76,7 @@ int iptunnel_xmit(struct net *net, struct rtable *rt,
iph->daddr = dst; iph->daddr = dst;
iph->saddr = src; iph->saddr = src;
iph->ttl = ttl; iph->ttl = ttl;
tunnel_ip_select_ident(skb, __ip_select_ident(iph, &rt->dst, (skb_shinfo(skb)->gso_segs ?: 1) - 1);
(const struct iphdr *)skb_inner_network_header(skb),
&rt->dst);
err = ip_local_out(skb); err = ip_local_out(skb);
if (unlikely(net_xmit_eval(err))) if (unlikely(net_xmit_eval(err)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment