aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2016-06-19 00:52:05 -0400
committerDavid S. Miller <davem@davemloft.net>2016-06-19 01:11:39 -0400
commit9b8c6d7bf2e08a7d3eb6660a2bfaf29b8b49c329 (patch)
tree3e887221b1576e9fdcbada9b9fcb7ddb1e779ca8
parent2d7a3b276be2d032a6c1a48ced87a474327ee3d3 (diff)
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: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/ip_tunnels.h1
-rw-r--r--net/ipv4/gre_demux.c1
-rw-r--r--net/ipv4/ip_gre.c6
3 files changed, 8 insertions, 0 deletions
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 9222678426a1..a5e7035fb93f 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -157,6 +157,7 @@ struct tnl_ptk_info {
157 __be16 proto; 157 __be16 proto;
158 __be32 key; 158 __be32 key;
159 __be32 seq; 159 __be32 seq;
160 int hdr_len;
160}; 161};
161 162
162#define PACKET_RCVD 0 163#define PACKET_RCVD 0
diff --git a/net/ipv4/gre_demux.c b/net/ipv4/gre_demux.c
index 4c39f4fd332a..c4c3e439f424 100644
--- a/net/ipv4/gre_demux.c
+++ b/net/ipv4/gre_demux.c
@@ -117,6 +117,7 @@ int gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
117 if ((*(u8 *)options & 0xF0) != 0x40) 117 if ((*(u8 *)options & 0xF0) != 0x40)
118 hdr_len += 4; 118 hdr_len += 4;
119 } 119 }
120 tpi->hdr_len = hdr_len;
120 return hdr_len; 121 return hdr_len;
121} 122}
122EXPORT_SYMBOL(gre_parse_header); 123EXPORT_SYMBOL(gre_parse_header);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 0f8ca3fca00a..ab4cff8e563d 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -187,6 +187,12 @@ static void ipgre_err(struct sk_buff *skb, u32 info,
187 if (!t) 187 if (!t)
188 return; 188 return;
189 189
190#if IS_ENABLED(CONFIG_IPV6)
191 if (tpi->proto == htons(ETH_P_IPV6) &&
192 !ip6_err_gen_icmpv6_unreach(skb, iph->ihl * 4 + tpi->hdr_len, type))
193 return;
194#endif
195
190 if (t->parms.iph.daddr == 0 || 196 if (t->parms.iph.daddr == 0 ||
191 ipv4_is_multicast(t->parms.iph.daddr)) 197 ipv4_is_multicast(t->parms.iph.daddr))
192 return; 198 return;