summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuan Jiong <duanj.fnst@cn.fujitsu.com>2014-01-28 11:49:43 +0800
committerDavid S. Miller <davem@davemloft.net>2014-01-27 20:38:26 -0800
commitc0c0c50ff7c3e331c90bab316d21f724fb9e1994 (patch)
tree8890196c79356a199374c1e54ef6b61b1043545b
parent3d9667a9e1e463c107cb47a810ef7e85d9a31e62 (diff)
downloadlinux-c0c0c50ff7c3e331c90bab316d21f724fb9e1994.tar.gz
linux-c0c0c50ff7c3e331c90bab316d21f724fb9e1994.tar.bz2
linux-c0c0c50ff7c3e331c90bab316d21f724fb9e1994.zip
net: gre: use icmp_hdr() to get inner ip header
When dealing with icmp messages, the skb->data points the ip header that triggered the sending of the icmp message. In gre_cisco_err(), the parse_gre_header() is called, and the iptunnel_pull_header() is called to pull the skb at the end of the parse_gre_header(), so the skb->data doesn't point the inner ip header. Unfortunately, the ipgre_err still needs those ip addresses in inner ip header to look up tunnel by ip_tunnel_lookup(). So just use icmp_hdr() to get inner ip header instead of skb->data. Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/ip_gre.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index e7a92fdb36f6..ec4f762efda5 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -178,7 +178,7 @@ static int ipgre_err(struct sk_buff *skb, u32 info,
else
itn = net_generic(net, ipgre_net_id);
- iph = (const struct iphdr *)skb->data;
+ iph = (const struct iphdr *)(icmp_hdr(skb) + 1);
t = ip_tunnel_lookup(itn, skb->dev->ifindex, tpi->flags,
iph->daddr, iph->saddr, tpi->key);