Commit 9b8c6d7b authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

gre: better support for ICMP messages for gre+ipv6

ipgre_err() can call ip6_err_gen_icmpv6_unreach() for proper
support of ipv4+gre+icmp+ipv6+... frames, used for example
by traceroute/mtr.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2d7a3b27
...@@ -157,6 +157,7 @@ struct tnl_ptk_info { ...@@ -157,6 +157,7 @@ struct tnl_ptk_info {
__be16 proto; __be16 proto;
__be32 key; __be32 key;
__be32 seq; __be32 seq;
int hdr_len;
}; };
#define PACKET_RCVD 0 #define PACKET_RCVD 0
......
...@@ -117,6 +117,7 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi, ...@@ -117,6 +117,7 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
if ((*(u8 *)options & 0xF0) != 0x40) if ((*(u8 *)options & 0xF0) != 0x40)
hdr_len += 4; hdr_len += 4;
} }
tpi->hdr_len = hdr_len;
return hdr_len; return hdr_len;
} }
EXPORT_SYMBOL(gre_parse_header); EXPORT_SYMBOL(gre_parse_header);
......
...@@ -187,6 +187,12 @@ static void ipgre_err(struct sk_buff *skb, u32 info, ...@@ -187,6 +187,12 @@ static void ipgre_err(struct sk_buff *skb, u32 info,
if (!t) if (!t)
return; return;
#if IS_ENABLED(CONFIG_IPV6)
if (tpi->proto == htons(ETH_P_IPV6) &&
!ip6_err_gen_icmpv6_unreach(skb, iph->ihl * 4 + tpi->hdr_len, type))
return;
#endif
if (t->parms.iph.daddr == 0 || if (t->parms.iph.daddr == 0 ||
ipv4_is_multicast(t->parms.iph.daddr)) ipv4_is_multicast(t->parms.iph.daddr))
return; return;
......
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