net: gre: use icmp_hdr() to get inner ip header
Subsystems (3)
PATCH v2 1/1 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.
---
v2: use icmp_hdr() instead of conditional pulling of headers
net/ipv4/ip_gre.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/ip_gre.c +1 -1
@@ -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);
Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: Duan Jiong <[email protected]>
Date: Tue, 28 Jan 2014 11:49:43 +0800
Quoted 9 lines
When dealing with icmp messages, the
skb->datapoints the ip header that triggered the sending of the icmp message.In
gre_cisco_err(), theparse_gre_header()is called, and theiptunnel_pull_header()is called to pull the skb at the end of theparse_gre_header(), so theskb->datadoesn't point the inner ip header.
Quoted 6 lines
Unfortunately, the
ipgre_errstill needs those ip addresses in inner ip header to look up tunnel byip_tunnel_lookup().So just use
icmp_hdr()to get inner ip header instead ofskb->data.Signed-off-by Duan Jiong <[email protected]>
Applied and queued up for -stable, thanks.
Quoted 27 lines · Duan Jiong
When dealing with icmp messages, the
skb->datapoints the ip header that triggered the sending of the icmp message.In
gre_cisco_err(), theparse_gre_header()is called, and theiptunnel_pull_header()is called to pull the skb at the end of theparse_gre_header(), so theskb->datadoesn't point the inner ip header.Unfortunately, the
ipgre_errstill needs those ip addresses in inner ip header to look up tunnel byip_tunnel_lookup().So just use
icmp_hdr()to get inner ip header instead ofskb->data.Signed-off-by Duan Jiong <[email protected]>---
v2: use
icmp_hdr()instead of conditional pulling of headersnet/ipv4/ip_gre.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/ipv4/ip_gre.c +0
-0
net/ipv4/ip_gre.c static int ipgre_err(struct sk_buff *skb, u32 info, · line 184
Quoted 8 lines
net/ipv4/ip_gre.c +1
-1@@ -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);
Don't we need to pull inner ip header first?
Quoted 6 lines
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html